Instant Payment Notification script receives among other parameters the following one:
payer_id = LPLWNMTBWMFAY
What is the meaning of that string开发者_如何学运维?
It's an external unique identifier of a particular PayPal account. Since email addresses change over time. A PayerID is static.
As others have said, payer_id
can be used to identify a Paypal account. HOWEVER! -- a single Paypal account can have several payer_id
s 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
.
For example, if Bob buys from my website (through Paypal) using his Visa card, the transaction will include one payer_id
. If Bob later buys using his Mastercard, the transaction will include a different payer_id
.
I confirmed this in a phone call with Paypal Merchant Technical Solutions, in May of 2013, after running into problems with my order processing (due to an incorrect assumption I had made about payer_id
being a reliable way to see if a customer already existed within my customer database).
NB: One ramification of this fact is that, when writing a Paypal IPN-processing script, payer_id
should properly be stored only in the "orders" database table, and not stored in the "customers" table.
See also this answer: Is the paypal payer_id unique per credit card?
EDIT:
Apparently, each PayPal account does get just one payer_id
. (That is not what I gleaned from my aforementioned phone call with Paypal Merchant Technical Solutions, but I can't find my notes on that call, so perhaps there was some confusion there.) Regardless, the payer_id
does NOT uniquely identify a customer – as in a single, unique individual somewhere out there in the world. A customer could use multiple Paypal accounts, or could make some purchases as a "guest" using a different funding source than their primary Paypal account, and merchants would get different payer_id
s for each one – even if the person's name, address, and all other identifying information were exact matches.
For these reasons, it is misleading for Paypal to call the payer_id
variable a "Unique customer ID". Unfortunately, that description still persists in their documentation (scroll to the bottom of the "Buyer information variables" section):
https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/#id091EB01I0Y4
It's just the id of the user who paid. You have to log it, to be able to give it to Paypal in case of conflict.
Payer_id is just paypal id of who pay the payment. Email id is dynamic and always change, but payer_id is static.
精彩评论