Pass a reference to the order with Smart Payment Buttons

joshunwin
Contributor
Contributor

Don't know why I can't seem to find this in the docs.. I have two simple Smart Payment Buttons on a page for people to send donations and I want to pass in a reference of each button so both the user and more importantly the site owner know which button was used as they are for different donation types.

 

I was expecting step 4 of this page https://developer.paypal.com/docs/checkout/integrate/ to have an option to pass in a reference during the createOrder process, is something like that not possible?

Login to Me Too
1 ACCEPTED SOLUTION

Accepted Solutions
Solved

MTS-Aaron
PayPal Employee
PayPal Employee

Hi @joshunwin 

If you refer to the API Reference you can see that there is a purchase_units object. In this object you can pass a description, an invoice ID, a custom ID, or even an array of items that have names and descriptions.

 

In your case, it seems as though you would do best passing an item with a description, or just a Description in the purchase_units object that could look like:

 

"purchase_units": [
     { "description": "Donation Type 1" }
]

 

 This should be visible to both the user and the merchant when seeing the transaction in the account.

 

I hope this was helpful for you and happy testing!

-Aaron

View solution in original post

Login to Me Too
2 REPLIES 2
Solved

MTS-Aaron
PayPal Employee
PayPal Employee

Hi @joshunwin 

If you refer to the API Reference you can see that there is a purchase_units object. In this object you can pass a description, an invoice ID, a custom ID, or even an array of items that have names and descriptions.

 

In your case, it seems as though you would do best passing an item with a description, or just a Description in the purchase_units object that could look like:

 

"purchase_units": [
     { "description": "Donation Type 1" }
]

 

 This should be visible to both the user and the merchant when seeing the transaction in the account.

 

I hope this was helpful for you and happy testing!

-Aaron

Login to Me Too

joshunwin
Contributor
Contributor

Doh! Thanks Aaron, I didn't realise you could pass additional fields to that object. Perfect!

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.