質問

I have a website with two payment processors:

The other processor have an API call to invalidate a token, so if the user still didn't submit his payment info and I revoked his pending payment token -> he'll get an error.

There's a scenario where a (crazy) user can pay using both payment gateways:

1. The user starts a request to paypal
2. The user starts a request to other processor
3. He completes the payment with other processor
4. He then completes the payment with paypal

As I can see it, only revoking the paypal token can solve this condition. If so - does anyone know how to do it programmatically?

Note: Any situation where two transactions are completed successfully is unacceptable (so refund/cancel and similar is not a solution)

役に立ちましたか?

解決

I'm assuming you're using the (popular) express checkout API, and that the situation you're describing is AFTER you've issued a SetExpressCheckout but BEFORE you issued the DoExpressCheckoutPayment.
In that case, as you already redirected the shopper to the PayPal site, it's out of your hands and there's no API to revoke the token. However, there's a simple solution to your case. Even if the shopper approved the transaction at PayPal, you can still ignore the redirect and NOT issue a DoExpressCheckoutPayment request. In this case, the captured funds from his account (which you never got), will be returned to him 3 hours after the initial SetExpressCheckout was issues.
Don't forget to issue a proper notification to the user.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top