I'm building a simple PHP web app that uses Paypal to add credit to an account. (I've just got the basic "Website Payments Standard" account)
Have spent the last hour looking on Paypal's site and Google, but can't find a simple way to return a success variable.
Ideal Scenario
- Buyer clicks 'add credit' on my site and is redirected to Paypal (this part is easy)
- Buyer fills in credit card details and payment approved.
- A variable is posted back to my site (or the equivalent of this) to confirm payment success
- My website c开发者_Python百科onverts the variable into an account credit.
It doesn't need to be the most hack-proof thing in the world, but obviously can't just put the success status in the url and use GET!
Thanks heaps!
According to the PayPal NVP API documentation, you should receive a URL-encoded response string which includes ACK
with one of the following values:
- Success
- SuccessWithWarning
- Failure
- FailureWithWarning
From there, you can possibly use string manipulation to check if the response was a success and credit the account accordingly.
Download the sample NVP application from the paypal, pay particular attention the the CallerService.php file. The hash_call
function is the one used to send a request & receive the response from PayPal.
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_download_sdks
精彩评论