how to prevent create new order when payment failed

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Ahmad
Posts: 67
Joined: 05 Jul 2017, 15:19

how to prevent create new order when payment failed

Post by Ahmad » 17 Feb 2021, 16:31

Aimeos: 2020.10
Laravel: 7
PHP: 7.4

when customer redirected to payment provider and redirect back with an error, they can try again for payment (even without make any change to order/basket) but when they click on try again button new order with a new order id was added.
I want to prevent this and make change on it such a way that they try again to pay same order with same order id, how can I do this?

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

Re: how to prevent create new order when payment failed

Post by aimeos » 18 Feb 2021, 07:41

It's not possible because payment gateways require a new order ID for each payment. Already used order IDs are not accepted and the will return a "duplicate order ID" error in that case.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Ahmad
Posts: 67
Joined: 05 Jul 2017, 15:19

Re: how to prevent create new order when payment failed

Post by Ahmad » 18 Feb 2021, 11:57

aimeos wrote: 18 Feb 2021, 07:41 It's not possible because payment gateways require a new order ID for each payment. Already used order IDs are not accepted and the will return a "duplicate order ID" error in that case.
my problem is when user goes back from payment gateway and I call verify method of payment gateway from updateSync method of my PaymentServiceProvider i get an error from gateway that say "another verify request is in process for this payment" but I don't know what happen, I think my customer refresh page manually when they back from gateway payment and in this moment I get multiple verification request error from gateway and throw an exception and customer see error message and try again button and he/she click on try again button and another order create in this moment and verification of previous order failed.

Furthermore my payment gateway provide this feature in api to send again order with same id (with created ref id I get from api on process request) to pay it, for example customer goes to gateway and mistakenly click on cancel and goes back to confirm page and try again to pay it.

how can i do for my problem with verifying of payment?

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

Re: how to prevent create new order when payment failed

Post by aimeos » 20 Feb 2021, 08:43

You should check the docs of the payment gateway or call their support.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Ahmad
Posts: 67
Joined: 05 Jul 2017, 15:19

Re: how to prevent create new order when payment failed

Post by Ahmad » 20 Feb 2021, 14:02

aimeos wrote: 20 Feb 2021, 08:43 You should check the docs of the payment gateway or call their support.
no it there is no need to do this, i check the docs with payment gateway and after that realized that aimeos send several times requests to gateway (run separately process method of Payment Provider) when basket checkout, also it seems the checkout form submitted several times when customer click submit order button.
why this happen?

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

Re: how to prevent create new order when payment failed

Post by aimeos » 22 Feb 2021, 14:21

Did you implement a payment service provider on your own? Can you show the code of that service provider?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply