【发布时间】:2021-05-31 00:47:24
【问题描述】:
我正在尝试将其设置为拒绝除英国以外的所有送货地址。我的代码如下;
onShippingChange: function(data, actions){
if(data.shipping_address.country_code!=="GB"){
return actions.reject();
}
return actions.resolve();
},
但它不起作用。我没有收到任何错误。
我也尝试将其更改为以下也不起作用;
return actions.reject(new Error("We do not support your country."));
我可以让它稍微工作的唯一方法是如果我使用警报并抛出一个新错误而不是使用reject(),例如;
onShippingChange: function(data, actions){
if(data.shipping_address.country_code!=="GB"){
alert("We do not support your country.");
throw new Error();
}
},
但这样做并不会关闭 PayPal 弹出窗口/模式。
【问题讨论】:
标签: javascript jquery paypal paypal-sandbox paypal-rest-sdk