Handle buyer checkout errors


Last updated: Mar 2nd, 1:37am

Use onError callbacks and alternate checkout pages to handle buyer checkout errors.

Know before you code

Standard Checkout

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 standard Checkout integration and uses the following:

Standard CheckoutGet started

Explore PayPal APIs with Postman

You can use Postman to explore and test PayPal APIs. Learn more in our Postman guide.

Buyer checkout error

If an error prevents buyer checkout, alert the user that an error has occurred with the buttons using the onError callback.

    2 onError: function(err) {
    3 // For example, redirect to a specific error page
    4 window.location.href = "/your-error-page-here";
    5 }

    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 buttons
      3} else {
      4 // show a fallback experience