How do i pass a customer ID number in the transaction
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is my code:
<script src="https://www.paypal.com/sdk/js?client-id=AVzxhXXXXXXXXXXXXXXXXXXXXXgHtNyyjBawLvnvJLRrshVSrLjwhqWoPg3F..."></script>
<div id="paypal-button-container" style="position:relative;left:25%;width:50%;text-align:center;color:#FFFF00;"></div>
<script>
paypal.Buttons(
{createOrder: function(data, actions) {
return actions.order.create({
"purchase_units": [
{
"amount": {
"currency_code": "USD",
"value": "35.00",
},
},
],
})
},
onApprove:function(data,actions) {
return actions.order.capture().then(function(details){
alert('Transaction completed by ' + details.payer.name.given_name);
})
},
})
.render('#paypal-button-container')
</script>
The above script works GREAT!!
2 problems i am having..
1) i want to pass a customer id to the transaction so that i know who made the purchase. Where should i add it in my code...
2) i have made a lot of sandbox transactions but none are showing up in Sand Box business account--> Sandbox Notifications-->Emails
Yes i have already read all the Paypal documentation and that just made things more confusing..
I think these are simple questions
Thank you to anyone that can help
--Richard

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good day @MickeyMousePark,
Thank you for posting to the PayPal community.
To retrieve the customer ID value, you need to pass the custom_id parameter within the purchase_units array of objects. For further details and guidance, please refer to the following link: https://developer.paypal.com/docs/api/orders/v2/#orders_create!path=purchase_units/custom_id&t=reque....
To receive Webhook Events from all PayPal product services, please follow the below steps via your developer portal.
My apps & credentials >> Select the respective App name >> Go to the "SANDBOX WEBHOOKS" section >> click "Edit Webhook" hyperlink >> toggle "All events" to receive all event notifications >> Save.
Once the above settings are done, please process a test order and you shouldn't be facing this issue going forward.
Please refer to the below guide link for "Webhook" Event names :
https://developer.paypal.com/docs/api-basics/notifications/webhooks/event-names/
https://developer.paypal.com/docs/api-basics/notifications/webhooks/event-names/#orders
If you are still facing issues, please create an MTS ticket via - https://www.paypal-support.com/s/?language=en_US with the detailed information and error details.
Sincerely,
Vaishnavi
PayPal MTS
If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think i have solved almost all problems.. except 1..i figured out why in Sandbox-->Dashboard-->Testing Tools-->Sandbox Notifications i am not seeing the transactions..they are all "On Hold" in the sandbox business account..so i must have miss a setting?
==============================================================================
Here is all my code this is for simple ASP.NET integration it passes the variables to JS.
This worked for me:
IN THE HEAD SECTION OF ASPX CODE:
<script src="https://www.paypal.com/sdk/js?client-id=YOUR_PAYPAL_CLIENT_ID"></script>
<script type="text/javascript" src="PATH_TO_JS_FILE/paypal.js" ></script>
ASPX CODE: (place this where you want the buttons)
<%Dim ItemName=ITEM_DESCRIPTION%>
<%Dim QuoteMark= chr(34)%>
<%Dim PayPalCustomer=cstr(CUSTOMER_NUMBER)%>
<%Dim PayPalDescript= quotemark & ItemName & quotemark%>
<%Dim Amount=cstr(TOTAL_PURCHASE) & ".00"%>
<div id="paypal-button-container" style="position:relative;left:25%;width:50%;text-align:center;color:#FFFF00;"></div>
<script>
var Customer = <%=PayPalCustomer%>;
var Description = <%=PayPalDescript%>;
var Amount = <%=Amount%>;
Payment()
</script>
PAYPAL.JS:
function Payment(){
paypal.Buttons(
{createOrder: function(data, actions) {
return actions.order.create({
"purchase_units": [
{
"custom_id": Customer,
"description": Description,
"amount": {
"currency_code": "USD",
"value": Amount,
},
},
],
})
},
onApprove:function(data,actions) {
return actions.order.capture().then(function(details){
alert('Transaction completed by ' + details.payer.name.given_name);
})
},
})
.render('#paypal-button-container');
return "";
}
Change all UPPERCASE to variables or literals.
Everything compacted into 37 lines of code
NOTE: if anyone is wondering the quotemark requirement seems to be an odd issue with passing variables between ASP and JS
Hopefully this will some people get the basics done quickly and can work on the more advanced features afterward...
--Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
disregard above problem i going to assume the following is normal operation of sandbox:
Complete transaction
Business Account shows transactions "On Hold"
No message in Sandbox email notifications
24 hours later:
Business Account shows transactions completed
Messages in Sandbox email notifications show up..

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- [WooCommerce PayPal Payments] - Required phone country code, different than the cards country code. in PayPal Payments Standard
- Payments Refunded Automatically After Successful Transactions - PayPal Business Account Issue in REST APIs
- Shopify PayPal integration, customer authorized multiple times in PayPal Payments Standard
- How can I display the bill number and customize it in the transaction record in REST APIs
- Suspect orders yet payment accepted without AVS in PayPal Payments Standard