错误
要接收支付过程中出现的错误信息:
- 添加
show_errors
事件处理,用于显示错误。
示例:
Copy
- typescript
1headlessCheckout.form.onNextAction((nextAction) => {
2 switch (nextAction.type) {
3 case 'show_errors': {
4 this.errors = nextAction.data.errors;
5 }
6 }
7});
- 在支付UI的HTML标记中添加错误显示。
示例:
Copy
- html
1@if (errors.length) {
2 Errors:
3 @for (error of errors) {
4 <div>{{error.message}}</div>
5 }
6}
本文对您的有帮助吗?
感谢您的反馈!
我们会查看您的留言并运用它改进用户体验。发现了错别字或其他内容错误? 请选择文本,然后按Ctrl+Enter。