# Handle buyer checkout errors (/v5/checkout/handle-errors)



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

## Know before you code [#know-before-you-code]

> **Info:** ### PayPal Checkout [#paypal-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 PayPal Checkout integration and uses the following:
>
> * [JavaScript SDK:](/sdk/js/) Adds PayPal-supported payment methods.
> * [Orders REST API:](/docs/api/orders/v2/) Create, update, retrieve, authorize, and capture orders.
>
> [PayPal Checkout](/platforms/checkout/standard/)
>
> [Get started](/platforms/get-started/)

> **Info:** ### Explore PayPal APIs with Postman [#explore-paypal-apis-with-postman]
>
> You can use Postman to explore and test PayPal APIs. Learn more in our [Postman guide](/api/rest/postman).

## Buyer checkout error [#buyer-checkout-error]

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

```text lineNumbers
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.

## Script not loading error [#script-not-loading-error]

If null pointer errors prevent the script from loading, provide a different checkout experience.

```text lineNumbers
if (window.paypal && window.paypal.Buttons) {
    // render the buttons
} else {
    // show a fallback experience
}
```
