On this page
No Headings
Last updated: July 8, 2026
Use onError callbacks and alternate checkout pages to handle buyer checkout errors..
Complete the steps in Get started to get your sandbox account login information and access token from the Developer Dashboard.
This feature modifies an existing PayPal Checkout integration and uses the following:
You can use Postman to explore and test PayPal APIs. Learn more in our Postman guide.
If an error prevents buyer checkout, alert the user that an error has occurred with the buttons using the onError callback.
paypal.Buttons({
onError: function(err) {
// For example, redirect to a specific error page
window.location.href = "/your-error-page-here";
}
}).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.
If null pointer errors prevent the script from loading, provide a different checkout experience.
if (window.paypal && window.paypal.Buttons) {
// render the buttons
} else {
// show a fallback experience
}