Clueless about integrating omnipay/sagepay

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
thepurpleblob
Posts: 20
Joined: 22 Oct 2020, 15:39

Clueless about integrating omnipay/sagepay

Post by thepurpleblob » 22 Oct 2020, 15:45

Laravel 8
Aimeos 2020.10
PHP 7.4

I'm trying to add Sagepay payments. I've identified and added (using composer) https://github.com/thephpleague/omnipay-sagepay. However, I've no idea what to do next.

The instructions (https://aimeos.org/docs/User_Manual/Adm ... st#Omnipay) say to set the 'type' to the gateway name of the plugin. However, when adding a payment provider type is a drop-down with fixed options. I can't type in anything.

Can anybody point me in the right direction?

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: Clueless about integrating omnipay/sagepay

Post by aimeos » 23 Oct 2020, 17:31

The new documentation contains more infos:
https://aimeos.org/docs/latest/manual/s ... ay-generic
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

thepurpleblob
Posts: 20
Joined: 22 Oct 2020, 15:39

Re: Clueless about integrating omnipay/sagepay

Post by thepurpleblob » 23 Oct 2020, 21:33

Ok - I read that.

Does that mean that I have to install all of...
aimeos/ai-payments
league/omnipay
omnipay/sagepay

...and then create a new service with some magic in the settings that isn't entirely clear to me (but I'll try to figure out)?

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: Clueless about integrating omnipay/sagepay

Post by aimeos » 26 Oct 2020, 09:26

thepurpleblob wrote: 23 Oct 2020, 21:33 Does that mean that I have to install all of...
aimeos/ai-payments
league/omnipay
omnipay/sagepay

...and then create a new service with some magic in the settings that isn't entirely clear to me (but I'll try to figure out)?
Yes, the settings of most Omnipay drivers are not well documented but for Sagepay they are:
https://github.com/thephpleague/omnipay ... asic-usage
Seems, you only need the "type" and "vendor" config.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

thepurpleblob
Posts: 20
Joined: 22 Oct 2020, 15:39

Re: Clueless about integrating omnipay/sagepay

Post by thepurpleblob » 26 Oct 2020, 15:17

I eventually figured out that 'type' is 'SagePay_Server' and the rest is pretty obvious.

But... Doesn't seem to work, I just get..

"The card parameter is required"

I assume this is the 'card' array of data that is supplied to SagePay (the user address and so on), so the basic transaction data doesn't seem to be getting where it should.

I'll need to do some debugging I suppose. Any ideas are appreciated as always.

thepurpleblob
Posts: 20
Joined: 22 Oct 2020, 15:39

Re: Clueless about integrating omnipay/sagepay

Post by thepurpleblob » 26 Oct 2020, 21:18

This is the data passed through to omnipay. However, there's not a sign of the 'card' parameter that should contain the customer address and so on. Aimeos checkout asks for it but I'm not sure why it isn't in the omnipay data.

It seems to be missing this bit... https://omnipay.thephpleague.com/api/cards/

Code: Select all

object(Symfony\Component\HttpFoundation\ParameterBag)#676 (1) {
  ["parameters":protected]=>
  array(18) {
    ["vendor"]=>
    string(13) "xyxyxyxyxyxy"
    ["testMode"]=>
    int(1)
    ["referrerId"]=>
    NULL
    ["language"]=>
    string(2) "en"
    ["useOldBasketFormat"]=>
    int(0)
    ["exitOnResponse"]=>
    int(0)
    ["apply3DSecure"]=>
    int(0)
    ["useAuthenticate"]=>
    NULL
    ["accountType"]=>
    string(1) "E"
    ["transactionId"]=>
    string(1) "8"
    ["amount"]=>
    string(5) "10.00"
    ["currency"]=>
    string(3) "GBP"
    ["description"]=>
    string(7) "Order 8"
    ["clientIp"]=>
    NULL
    ["createToken"]=>
    bool(true)
    ["returnUrl"]=>
    string(42) "http://127.0.0.1:8000/shop/confirm/SagePay"
    ["cancelUrl"]=>
    string(42) "http://127.0.0.1:8000/shop/confirm/SagePay"
    ["notifyUrl"]=>
    string(51) "http://127.0.0.1:8000/update?code=SagePay&orderid=8"
  }
}

thepurpleblob
Posts: 20
Joined: 22 Oct 2020, 15:39

Re: Clueless about integrating omnipay/sagepay

Post by thepurpleblob » 26 Oct 2020, 22:14

Progress = the 'address' parameter needs to be 'Yes'.

The reference to the 'Stripe server' (presumably a copy and paste typo) threw me.

I need to run the code on my live server to test further due to IP restrictions but it's looking much better :)

Post Reply