Search code examples
paypal-rest-sdk

PayPal Orders purchase_units: reference_id vs custom_id?


I am working to set up orders and am a bit confused by the documentation, specifically these two seperate id's given to the purchase_units.

The documentation lists:

reference_id string
The API caller-provided external ID for the purchase unit. Required for multiple purchase units when you must update the order through PATCH. If you omit this value and the order contains only one purchase unit, PayPal sets this value to default.

and

custom_id string
The API caller-provided external ID. Used to reconcile client transactions with PayPal transactions. Appears in transaction and settlement reports but is not visible to the payer.

Both of them having the same The API caller-provided external ID bit confuses the two for me. It seems like one of these is meant to be the id I want to pass through to keep track of the order on the other side, and custom_id sounds more like that, but what is the reference_id supposed to be? It sounds like mostly the same thing, just the id I'd like to give it so I can keep track of it later.

If all of my orders will only have a single purchase_item is there any reason to use the reference_id?


Solution

  • The purpose of reference_id is to distinguish between multiple purchase_units in a single order. Since all yours will have a single one, there is no reason to use it.

    Use custom_id for any reconciliation needs, as it will be stored as part of the PayPal transaction.