I'm having some problems understanding the proper way to go about linking an account to someone's user account for my website, for my website I'm using a subscription based system that uses recurring payments. What I'm having a problem understanding is how to properly figure out which account that payment is relative to.
At first I though about using the payer_email
to link an account and a paypal account together, however after somet thinking I realized that if the user was to change their e-mail then we'd run into some payment problems. (They would still pay, but their account would never be updated).
Then I thought, hmm, what about payer_id
however some research brought up this statement:
As others have said, payer_id can be used to identify a Paypal account. HOWEVER! -- a single Paypal account can have several payer_ids associated with it, one for each credit card or funding source used by that account. Because of this, a given Paypal account does NOT map one-to-one to a single payer_id.
Then I thought about a transaction id; However this changes with each payment, so now I'm sitting here completely clueless as to the best way to map a paypal subscription to my account database.
What I need to do:
Check the IPN of PAYPAL (Instant Payment Notification)
you can set the notification URL to return back some data.
FORM Eg:
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="return" value="test.com/paypal.php?action=upgrade_plan_success">
<input type="hidden" name="cancel_return" value="test.com/paypal.php?action=cancel">
<input type="hidden" name="notify_url" value="test.com/notify_paypal.php">
<input type="hidden" name="custom" value="$user_id"> //any unique thing about customer
when ever the payment is done it will notify you in url notify_paypal.php mention above. It will return some array, in that we have our custom value which we can use to manipulate database..
so imp is
<input type="hidden" name="custom" value="$user_id"> //any unique thing about customer
hope this will help you
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.