Forum

Thread tagged as: Question, Shop

Perch Shop - Worldpay + Paypal

Hi

Just finished a perch shop development using Worldpay as the payment gateway... client just turned around to me and said "Think we need to offer paypal too"

What's the best way of going about that? Not the greatest at adding any custom PHP into a site and stick to what I know... is it easy?

Any help would be vastly appreciated as the site needs to go live "with paypal" on the 1st September if at all possible

Nik

Nik Gill

Nik Gill 1 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, it's very simple to have both - where are you struggling?

Basically, I've followed the documentation here to set up Worldpay as a gateway

https://docs.grabaperch.com/addons/shop/gateways/worldpay/ https://docs.grabaperch.com/addons/shop/gateways/

But I can't seem to find anything that shows me how to have two gateways... I know you don't want to restrict anyone by pushing them in a certain direction with this add on and I totally respect that

I'm still very new to the Perch Shop add and this has been my first attempt (and has gone very well) - but not ashamed to say I'm quite stuck...

Drew McLellan

Drew McLellan 2638 points
Perch Support

So the next thing to do would be to follow the Paypal gateway instructions and add that to your page.

Duncan Revell

Duncan Revell 78 points
Registered Developer

You know what - I always thought WorldPay could be setup to accept PayPal payments? Or am I wrong about that...

Drew McLellan said:

So the next thing to do would be to follow the Paypal gateway instructions and add that to your page.

Ok, will have a go at that and post back if I have any problems. I assume I put the paypal gateway code beneath my worldpay code on the same page. But set my paypal button to access a different checkout page to the one I set up the worldpay info on? Sounds a little too simple!

Duncan Revell said:

You know what - I always thought WorldPay could be setup to accept PayPal payments? Or am I wrong about that...

Duncan, yeah... in a perfect world... though my client has a funny version of their Worldpay merchant account which doesn't allow paypal to be added to the checkout. They also don't want to switch to another version for reasons they've not been clear on.

Duncan Revell

Duncan Revell 78 points
Registered Developer

Ah, fair enough - I've not personally tried it, but I know it's quite convoluted anyway. It's probably easier to get it working through another gateway...

Right Drew... I've finally managed to get it set up and running (sort of) I've definitely messed up my config file, I'll post below with sensitive details removed of course.

  1. The world pay details worked fine when only worldpay was used as the gateway
  2. The Paypal details link fine to the developer sandbox.
  3. When used in this config, Worldpay doesn't accept the details
  4. When used in this config Perch shop fires off a thank you email as soon as the pay with paypal button is clicked before going to paypal.
<?php
  return [
    'gateways' => [
      'worldpay' => [
        'enabled'   => false,
        'test_mode' => true,
        'live' => [
            'installationId'   => '123456',
            'accountId'        => 'CONAME',
            'secretWord'       => 'secretword',
            'callbackPassword' => 'callback',
        ],
        'test' => [
            'installationId'   => '123456',
            'accountId'        => 'CONAME',
            'secretWord'       => 'secretword',
            'callbackPassword' => 'callback',
        ],
      ],
    ],
     'gateways' => [
      'paypal-express' => [
        'enabled'   => false,
        'test_mode' => true,
        'live' => [
          'username'  => 'paypal_api_username',
          'password'  => 'paypal_api_password',
          'signature' => 'paypal_api_signature',
        ],
        'test' => [
          'username'  => 'paypal_api_username',
          'password'  => 'paypal_api_password',
          'signature' => 'paypal_api_signature',
        ],
      ],
    ],   
  ];
?>

I've also tried this with both gateways in the config file wrapped in separate php tags... in that case Worldpay worked fine and paypal didn't go anywhere, it went straight to the payment failed page (and fired off a thank you email to the customer)

Any ideas what I've done wrong... both gateways seem to work fine individually, but not together in the same config file so I'm sure my cack handed-ness is responsible for that.

Any help much appreciated

Duncan Revell

Duncan Revell 78 points
Registered Developer

I think you only need one gateways array (you have two) - then have your Paypal and worldpay arrays inside it. See if that helps.

Thanks Duncan, so obvious once you pointed it out!