thephpleague / omnipay

A framework agnostic, multi-gateway payment processing library for PHP 5.6+
http://omnipay.thephpleague.com/
MIT License
5.91k stars 925 forks source link

How exactly does `completePurchase` work? #612

Open marbuser opened 3 years ago

marbuser commented 3 years ago

So I've decided I want to give the OmniPay server-side confirmation workflow a try. (Trying to display status pages for webhooks has drove me insane and is super inconsistent.)

But one thing that has always "scared" me about server-side confirmation as opposed to webhooks, what exactly do you do if the payment fails?

For example Stripe, say the user purchases something and they get redirected to 3DS. After they have confirmed we get redirected to the returnUrl where we can call completePurchase with the id. However, what happens in the cases where hypothetically the user clicks pay on the 3DS secure page and it works, but on the redirect back to your server say their internet dies or something that prevents them from executing that completePurchase call.

What exactly happens? Is the payment considered null and do Stripe automatically refund the user after x amount of days? Do we need some sort of catch in place to address this if it happens?