Errors
To receive information about errors that appear during the payment process:
- Add the handling of the
show_errors
event for displaying errors.
Example:
Copy
- typescript
headlessCheckout.form.onNextAction((nextAction) => {
switch (nextAction.type) {
case 'show_errors': {
this.errors = nextAction.data.errors;
}
}
});
- Add the error display to the HTML markup of the payment UI.
Example:
Copy
- html
@if (errors.length) {
Errors:
@for (error of errors) {
<div>{{error.message}}</div>
}
}
Was this article helpful?
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.Found a typo or other text error? Select the text and press Ctrl+Enter.