INSTRUMENT_DECLINED error? ! P- x2 Y- w# e5 K2 _7 f0 E1 B- j
解决方案: 如果您直接从服务器调用订单 API,则需要重新启动付款。如果您使用action.order.capture(),脚本会自动重新启动结帐流程并提示付款人选择其他资金来源。在onApprove
9 X" W- J( H* m9 t7 u& ~函数中重新启动付款,如下所示: * p. K1 e+ o7 A( \; F3 `# O) L
Paypal.Buttons({ onApprove: function (data, actions) { return fetch('/my-server/capture-paypal-transaction', { headers: { 'content-type': 'application/json' }, body: JSON.stringify({ orderID: data.orderID }) }).then(function(res) { return res.json(); }).then(function(captureData) { if (captureData.error === 'INSTRUMENT_DECLINED'); // Your server response structure and key names are what you choose return actions.restart(); } }); } }).render('#paypal-button-container'); & s: M6 I$ Z- U' k2 z1 }8 A
|