- This feature modifies an existing advanced checkout integration
- This integration uses the following:
- PayPal JavaScript SDK
- Orders REST API - Create order endpoint
Handle buyer errors
Last updated: Dec 3rd, 11:43pm
Handle payer errors to provide a unique payer experience.
Know before you code
Buyer checkout error
If an error prevents buyer checkout, alert the user that an error has occurred with the buttons using the onError
callback:
1paypal.Buttons({2 onError: function (err) {3 // For example, redirect to a specific error page4 window.location.href = "/your-error-page-here";5 }6 }).render('#paypal-button-container');
This error handler is a catch-all. Errors at this point are not expected to be handled beyond showing a generic error message or page.
Script not loading error
If null pointer errors prevent the script from loading, provide a different checkout experience:
1if (window.paypal && window.paypal.Buttons) {2 // render the buttons3 } else {4 // show a fallback experience5 }