Reputation: 3570
I'm using the Express Checkout flow with the advanced server integration.
So I reserve items in real time once user has clicked the "Checkout" button and wait for the success\fail response. User can just close the browser tab and it will look like a long payment process (there is no way for the JS code to call the onCancel
handler).
So it looks like I don't know if user has closed the browser or just fell asleep. Problem that I can't wait too long (more than ~5 mins) and I want to cancel the payment after this time. And it seems that I can't cancel the Payment myself. So user can come back and pay after N minutes (N > 5) for the item which has been un-reserved and is already out of stock.
This answer says:
user has three hours to approve of the PayPal payment
Upvotes: 2
Views: 997
Reputation: 17108
You can do a GET
on the PAY-XXXX
id.
https://developer.paypal.com/docs/api/payments/#payment_get
The response comes with a create_time
field. You should be able to check the delta from create_time -> now
, and if it's > 5 minutes, don't accept the PAY-XXXX
id / cancel the transaction in your database.
Does that work for your use case?
Also note: No money is moved until you call execute
, so long as you prevent execute
calls for old transactions, you should be ok.
Upvotes: 3
Reputation: 1
I think it is still 3 hours and there is no way to set it up during the payment creation. But i would assume that buyer cannot pay until he returns back to your site either by approving or without approving. So is it not possible to put a check in between the step where buyer comes back and then call to complete the payment is made?
Upvotes: 0