简体   繁体   中英

Passing Variables to and from PayPal

I need to pass a variable to PayPal when someone checks out and have it pass it back when the payment is completed. Basically I need to direct the user to PayPal to pay, then, after they pay have PayPal tell me in the return url who paid so I can update their subscription in the database.

Right now, after someone registers they are directed to https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EF3UGS6GMWP56 and then after they pay, they are directed to https://culturehog.com/success

I need something more like: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EF3UGS6GMWP56?USER=467

and: https://culturehog.com/success?USER=467

Then I can have the PHP update user 467 in the database to "paid."

Does anyone have any experience with this? :/

You can pass a "custom" variable to Paypal using Payment Transaction Variables:

https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/#payment-transaction-variables

And then you can specify a "return" url and an return method "rm" to get your above "custom" variable back using Checkout Page Variables:

https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/#paypal-checkout-page-variables

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM