thephpleague / omnipay-worldpay

WorldPay driver for the Omnipay PHP payment processing library
MIT License
23 stars 18 forks source link

"Cart ID" error #23

Closed benrolfe closed 7 years ago

benrolfe commented 7 years ago

After I submit a purchase and follow the redirect, the WorldPay redirect page states:

"No cart ID supplied with the payment request."

I was expecting to be able to set this with $gateway->setCartId( time() ), but this isn't a method.

How can I resolve this?

benrolfe commented 7 years ago

Fixed! When sending the purchase array, ensure that you send a transactionId.

$response = $gateway->purchase([ 'transactionId' => time(), 'amount' => '15.00', 'currency' => 'GBP', 'returnUrl' => route('checkout-worldpay') ])->send();

judgej commented 7 years ago

Be aware that time() has a resolution of just one second, so two payments at once could result in a duplicate ID.