How do i cancel a PayPal (Express Checkout) transaction?

本秂侑毒 提交于 2019-12-11 02:46:46

问题


I have an application that uses Express Checkout to process payments.

I need some way to cancel a transaction after calling SetExpressCheckout (and having the user fill out his details on paypal's page) and before i actually complete it with DoExpressCheckoutPayment.

I can't find the right way to do it in paypal documentation, do i just let it time out or do i need to do some API call?


回答1:


You just let it time out. If you haven't called DoExpressCheckoutPayment yet, no action has yet taken place.
The token automatically expires after three hours.




回答2:


Technically you could just empty the token REQUEST, and unset the reshash SESSION and let it expire without risk (assuming you are using the same named variables the api samples came with. What language are you using? I can further provide examples.

In PHP I would simply do:

// empty token
$_REQUEST['token'] = NULL;

//unset reshash session
$_SESSION['reshash'] = NULL;
unset($_SESSION['reshash']);

Now you would ideally want to redirect the user to a cancellation page, something like

header( 'Location: http://www.example.com/transactionCancelled.html' ) 

Otherwise depending if the user is in the 'ReviewOrder' phase, they will just automatically get redirected back to paypal to start a new transaction.



来源:https://stackoverflow.com/questions/8522835/how-do-i-cancel-a-paypal-express-checkout-transaction

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!