【发布时间】:2020-07-17 02:41:42
【问题描述】:
我的 Angular 网页上有一个 PayPal 智能按钮,如下所示:
paypal.Buttons({
createOrder: (data, actions) => {
return actions.order.create({
purchase_units: [
{
description: this.product.description,
amount: {
currency_code: 'USD',
value: this.product.price,
}
},
],
application_context: {
shipping_preference: 'NO_SHIPPING'
}
});
},
onApprove: async (data, actions) => {
this.dataService.reserveReservation();
const order = actions.order.capture();
alert('Transaction Completed!');
}
}).render(this.paypalElement.nativeElement);
95% 的时间完成了购买,但偶尔会在没有付款的情况下调用 dataService.reserveReservation。如果付款失败,actions.order.capture() 是否会返回一些错误时间,或者为什么在付款未通过且未显示在我的 PayPal 主页活动选项卡中的任何位置时调用 onApprove 回调?如何确保每次都进行付款?
【问题讨论】: