- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In my checkout flow, I am redirecting to a confirmation page where I would like to show the buyer name and address. Is there any way to get that information and insert it via javascript? I just need to know how to get the info in my PayPal checkout function in javascript. Thanks
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually, I got most of this figured out by studying the docs. As for the buyer address, I got that (and the full name as well) by going into this:
details.purchase_units[0].shipping
Then, as I am using vanilla Javascript, I created this:
var buyerInfo = [details.purchase_units[0].shipping.name.full_name, details.purchase_units[0].shipping.address.address_line_1, details.purchase_units[0].shipping.address.admin_area_2, details.purchase_units[0].shipping.address.admin_area_1, details.purchase_units[0].shipping.address.postal_code, details.id];
And then I added it to sessionStorage and went from there. This way I was able to get the full name with one line and it was the only place I could find an address. Thanks so much for your help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Buyer name gets returned in onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
The buyer first name and last name are in the details function
So using JQuery to get them
$('#transmsg').html('<b>' + 'AUTHORIZED...' + '</b>');
$('#transmsg').append('<br>'+'Transaction completed by: ' + details.payer.name.given_name +' '+ details.payer.name.surname + '<br>' + "Order Id: " + details.id + '<br>' + 'Status: PAID & APPROVED' + '<br>'+ 'Thank You For Your Order'+ '<br>');
Now the address is a bit tricky as you to get that from an IPN call. Personally, IPN were a PAIN in the **bleep** so I deccided NOT to use them/it.
But if you REALLY need the address go for it.
D
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually, I got most of this figured out by studying the docs. As for the buyer address, I got that (and the full name as well) by going into this:
details.purchase_units[0].shipping
Then, as I am using vanilla Javascript, I created this:
var buyerInfo = [details.purchase_units[0].shipping.name.full_name, details.purchase_units[0].shipping.address.address_line_1, details.purchase_units[0].shipping.address.admin_area_2, details.purchase_units[0].shipping.address.admin_area_1, details.purchase_units[0].shipping.address.postal_code, details.id];
And then I added it to sessionStorage and went from there. This way I was able to get the full name with one line and it was the only place I could find an address. Thanks so much for your help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- How do I handle INSTRUMENT_DECLINED error? in REST APIs
- How do I offer PayPal Pay Later button on my website? in PayPal Payments Standard
- Android WebViews issue when doing seller onboarding in REST APIs
- How to get the merchant-id or how do i get the id that connects my user to get paid via Paypal in REST APIs
- Payment done, money received, but un error 'catched' after 'onApprouve' method in REST APIs