Custom error page for checkout

Question:

If there has been a Server Side error on the checkout page, we want to redirect the users to a custom error page related to the checkout, how can we do that?

Answer:

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 it to, including using app.getRouter().push(<route>):

app.getApi().request(
     'POST',
     'Apollo.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,
	})
     }
)

‹Back

FAQs

Still need help? Contact Us Contact Us