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
1headlessCheckout.form.onNextAction((nextAction) => {
2 switch (nextAction.type) {
3 case 'show_errors': {
4 this.errors = nextAction.data.errors;
5 }
6 }
7});
- Add the error display to the HTML markup of the payment UI.
Example:
Copy
- html
1@if (errors.length) {
2 Errors:
3 @for (error of errors) {
4 <div>{{error.message}}</div>
5 }
6}
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.