Using Paypal Button and getting different data returned when on sandbox to live
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using paypal.Buttons on a ecommerce site for the checkout and I have a problem with the data returned from PayPal on the "actions.order.capture()." function below:
onApprove: function (data, actions) { actions.order.capture().then(function (details) { // This function shows a transaction success message to your buyer. //console.log(details); return fetch('/complete.aspx?id=' + data.orderID, { method: 'POST', // or 'PUT' headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(details) }).then(function (res) { etc...
When using the sandbox mode I get a json string which contains the customers telephone number as shown below:
{"create_time":"xxxxxxxxx","update_time":"xxxxxxxxx","id":"xxxxxxxxx","intent":"CAPTURE","status":"COMPLETED","payer":{"email_address":"xxxxxxxxx","payer_id":"xxxxxxxxx","address":{"address_line_1":"xxxxxxxxx,","admin_area_2":"xxxxxxxxx","admin_area_1":"xxxxxxxxx","postal_code":"xxxxxxxxx","country_code":"GB"},"name":{"given_name":"xxxxxxxxx","surname":"xxxxxxxxx"},"phone":{"phone_number":{"national_number":"12345678910"}}},"purchase_units":[{"reference_id":"default","amount":{"value":"10.00","currency_code":"GBP"},"payee":{"email_address":"xxxxxxxxx","merchant_id":"xxxxxxxxx"},"shipping":{"name":{"full_name":"xxxxxxxxx"},"address":{"address_line_1":"xxxxxxxxx,","admin_area_2":"xxxxxxxxx","admin_area_1":"xxxxxxxxx","postal_code":"xxxxxxxxx","country_code":"GB"}},"payments":{"captures":[{"status":"PENDING","id":"xxxxxxxxx","final_capture":true,"create_time":"xxxxxxxxx","update_time":"xxxxxxxxx","amount":{"value":"10.00","currency_code":"GBP"},"seller_protection":{"status":"ELIGIBLE","dispute_categories":["ITEM_NOT_RECEIVED","UNAUTHORIZED_TRANSACTION"]},"status_details":{"reason":"RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION"},"links":[{"href":"https://api.sandbox.paypal.com/v2/payments/captures/xxxxxxxxx","rel":"self","method":"GET","title":"..."}]}
When using the Live server to make a transaction this different json string is returned which has a different structure and does not have the telephone number:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Continued: The returned data from live is
{"create_time":"xxxxxxxxx","update_time":"xxxxxxxxx","id":"xxxxxxxxx","intent":"CAPTURE","status":"COMPLETED","payer":{"email_address":"xxxxxxxxx","payer_id":"xxxxxxxxx","address":{"country_code":"GB"},"name":{"given_name":"xxxxxxxxx","surname":"xxxxxxxxx"}},"purchase_units":[{"reference_id":"default","soft_descriptor":"xxxxxxxxx","amount":{"value":"10.00","currency_code":"GBP"},"payee":{"email_address":"xxxxxxxxx","merchant_id":"xxxxxxxxx"},"shipping":{"name":{"full_name":"xxxxxxxxx"},"address":{"address_line_1":"xxxxxxxxx","address_line_2":"xxxxxxxxx","admin_area_2":"xxxxxxxxx","admin_area_1":"xxxxxxxxx","postal_code":"xxxxxxxxx","country_code":"GB"}},"payments":{"captures":[{"status":"COMPLETED","id":"xxxxxxxxx","final_capture":true,"create_time":"xxxxxxxxx","update_time":"xxxxxxxxx","amount":{"value":"10.00","currency_code":"GBP"},"seller_protection":
Remaining data wont paste for some reason into this site!
Does anyone know how to get the same data back when live as i get in sandbox ?
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Platform Marketplace integration approval in Sandbox Environment
- Cart dropps items, fails to return customer to previous window in PayPal Payments Standard
- why can't I have auto return on standard buttons in PayPal Payments Standard
- PAYER_ACTION_REQUIRED returned for Capture intent when calling v2 checkout orders in Sandbox Environment
- API TRANSACTION_REFUSED in Sandbox when Capturing Payment in REST APIs