开发者

Paypal return a post variable (or equivalent?)

开发者 https://www.devze.com 2023-02-04 05:23 出处:网络
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)

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

  1. Buyer clicks 'add credit' on my site and is redirected to Paypal (this part is easy)
  2. Buyer fills in credit card details and payment approved.
  3. A variable is posted back to my site (or the equivalent of this) to confirm payment success
  4. 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

0

精彩评论

暂无评论...
验证码 换一张
取 消