27

Instant Payment Notification script receives among other parameters the following one:

payer_id = LPLWNMTBWMFAY

What is the meaning of that string?

Anthony
  • 12,407
  • 12
  • 64
  • 88
  • 1
    How can i get payer id without any payment , I only login with paypal and find the payerId is this possible?? – Ilesh P Oct 24 '16 at 09:12

4 Answers4

34

It's an external unique identifier of a particular PayPal account. Since email addresses change over time. A PayerID is static.

Robert
  • 19,326
  • 3
  • 58
  • 59
  • Robert, can you please provide a link to PayPal docs where we can find more details, please? – Anthony Aug 20 '11 at 06:45
  • 2
    I can't find any docs, but you can see it in https://www.x.com/thread/24080 as well (Secure merchant account ID = PayerID = Referral ID. Name varies depending on the scenario you use it in, but it's all the same thing.) – Robert Aug 21 '11 at 18:03
  • 1
    https://developer.paypal.com/webapps/developer/docs/classic/express-checkout/ht_ec-singleItemPayment-curl-etc/ - "..to obtain the PayerID (which uniquely identifies the customer).." – Robert Aug 06 '13 at 19:52
  • So I guess we should use payer_id to identify the buyer of a transaction in our system? Rather than using the payer_email? – datasn.io Oct 20 '14 at 11:46
  • It's sad that we have to rely on a text in parentheses, on the docs page of a deprecated API, for something so important. – zerefel Mar 31 '18 at 18:47
28

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.

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_ids 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

Dr Marble
  • 445
  • 4
  • 6
  • 2
    So what should be stored and later used to identify the user / buyer in 'customers' table? – datasn.io Oct 20 '14 at 11:48
  • 1
    It's a tough call. Probably email. Paypal enforces unique emails, at any one point in time. But: users can change their email addresses, and I don't know how long Paypal reserves an email as "unique" after a person stops using it. So that creates two potential problems: in the former case, an existing user is mis-identified as a new user, because they've changed their Paypal email. In the latter case, a new user is mis-identified as an existing user, because they grabbed somebody else's old Paypal email. – Dr Marble Jan 22 '15 at 00:25
  • 1
    Also, I just had a look at Paypal's current REST API documentation, wherein they say that `payer_id` is being deprecated in favor of a property called `external_customer_id`. Their language is a bit opaque, as usual, about what these id strings actually mean – but they do introduce the term **funding instrument**, which AFAIK is a general term for a credit card or bank account that is linked with a Paypal account, and used to fund payments. Have a look here: https://developer.paypal.com/webapps/developer/docs/api/ – Dr Marble Jan 25 '15 at 21:49
  • 8
    As someone who works for PayPal and very closely with our engineers, I have to say -- this is incorrect. Each PayPal account gets just one `payer_id`, and each `payer_id` only represents one PayPal account. Now, what *can* happen is that if a buyer checks out as a guest -- e.g., without creating a PayPal account -- we create a special shadow account for that guest. If the same buyer checks out using multiple different cards, then it's possible that we created multiple shadow accounts (one for each card) -- but we never create multiple `payer_id`s for the same PayPal account. – Matt Cole May 19 '16 at 13:41
  • @MattCole - I appreciate the insight into Paypal's inner workings. However, consider how things look for developers, on the outside of this "black box". Say Joe Bob places two orders with me, one from his Paypal account, one directly with a credit card without logging in to Paypal. Upon receiving his 2nd order, I check my customer db's `payer_id` field, to see if he is an existing customer. Because there is no match found, I create a new customer account for him. Now there are two accounts on my system for Joe Bob, because `payer_id` does not map one-to-one for for a given individual. – Dr Marble May 23 '16 at 18:53
  • 1
    That's a fair point, but from our end, we don't draw a link between Joe Bob checking out with just his credit card to Joe Bob's PayPal account (unless he uses a credit card that's already tied to his account, in which case we make him log into his PayPal account instead). What if it's a completely separate person whose name also happens to be Joe Bob? What if Joe Bob uses his PayPal account for business purposes, and the checkout he did with his credit card was for a personal purchase (or vice-versa)? In our system, they're two separate PayPal accounts with separate identities. – Matt Cole May 25 '16 at 14:34
  • @MattCole For the 2 scenarios you list (completely separate people with the same name; running 1 order as a business purchase and another order as a personal one), yes, it would make sense to treat those as separate identities. However, the Paypal docs only explain that `payer_id` is a "Unique customer ID", implying a one-to-one mapping between IDs and individual customers. Yet even if their names, billing addresses, and email addresses all match, Paypal still does not treat two purchasers as the same "customer". Perhaps some further explanation of these nuances should be in the docs. – Dr Marble May 27 '16 at 15:36
  • 2
    Please note that **this answer is not correct**, as my colleague @MattCole has already pointed out: there is a one-to-one relationship between a PayPal Account and its `payer_id`; and each PayPal Account has exactly one `payer_id`. It is true that the `payer_id` does not uniquely identify a customer, as they may use multiple PayPal Accounts and/or check out as a guest. The `payer_id` therefore shouldn't be called a "Unique customer ID", I agree – but I believe the PayPal documentation has been updated in the meantime. Please ping me if you still see this in PayPal's docs, thanks. – Julian D. May 09 '17 at 15:43
  • 1
    So the first part of the tirade is where you say one thing and in the "EDIT" section you completely change your way into saying exactly opposite. I say at least delete the first paragraph where you say "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" – Danila Vershinin Aug 23 '20 at 20:50
  • 1
    @DanilaVershinin nah, then I'd have to rewrite a whole bunch of it to make it make sense. This way others can see the process of discovery, and how a lack of transparent and accurate documentation from Paypal (calling payer_id a "Unique customer ID") lead to the confusion in the first place. Plus: if you'd like to persuade another reader of your position, I'd advise you not to label their attempt to share valuable information as a "tirade". That did not endear me to your point of view. – Dr Marble Aug 24 '20 at 21:41
  • 1
    @DrMarble no need to be overreacting for the "tirade" word. In my opinion, most people are looking for precise answers and very few would be interested in the "discovery process" of some kind. Most would just read first few lines, and in the concrete example of your own answer, make wrong conclusions due to not reading the entire thing. Editing the answer is a better thing, and that's what the function is there for. – Danila Vershinin Aug 25 '20 at 11:58
3

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.

Sebastien
  • 6,640
  • 14
  • 57
  • 105
0

Payer_id is just paypal id of who pay the payment. Email id is dynamic and always change, but payer_id is static.

Giovanni Toraldo
  • 206
  • 1
  • 13