Custom error page for checkout

In case there's a Server Side error on a checkout page, you can redirect users to a custom error page related to the checkout.

The default API calls contain a parameter (third method parameter) ownErrorHandler: 1 which enables you to use a custom error callback (sixth method parameter) which can do whatever you want to, including using app.getRouter().push(<route>). For example:

app.getApi().request(
     'POST',
     'Awesomeshop.WirecardBundle.processPayment',
     {
    status: status,
    ownErrorHandler: 1,
     },
     payment,
     (cart) => {
    Checkout.addCheckoutEvent('payment', null, cart) // Credit Card
    app.getLoader('cart').checkout({})
     },
     (error) => {
    app.getLoader('context').notifyUser(error.message, 'error')
    app.getStore().dispatch({
         type: 'CartApi.Cart.update.error',
         error: error,
    })
     }
)

Did this page help you?