[英]Disable shipping in paypal checkout button integration
我想从 PayPal 结帐集成中隐藏送货地址。 我正在使用以下链接中的“checkout with checkout.js”选项: https : //developer.paypal.com/docs/archive/checkout/integrate/我当前的代码如下所示:
paypal.Button.render({ env: 'production', commit: false, style: { color: 'gold', size: 'responsive', label: 'pay', shape: 'rect' }, client: { sandbox: 'yurtyfcnvmghjlgfjgsdfbvbxcvbsdffjdfcbngfetrrurteytrwgfsdgs', production: 'werutpoeirutoputpoyuowieupoweutpwoeiuiouwrepotiwuperoldkfs' }, payment: function(data, actions) { return actions.payment.create({ payment: { transactions: [ { amount: { total: pmt, currency: 'USD' } } ] } }); }, onAuthorize: function(data, actions) { return actions.payment.execute().then(function(payment) { window.location = 'some url'; }); }, onCancel: function(data, actions) { window.location = 'some url'; }, onError: function(err) { /* do something */ } }, '#pwpl_m');
checkout.js 是旧的/存档的解决方案,因此我建议您改用最新的 PayPal checkout; 这是一个演示模式: https : //developer.paypal.com/demo/checkout/#/pattern/client
语法与 v2/orders 相同,它有一个application_context
对象: https : //developer.paypal.com/docs/api/orders/v2/#definition-order_application_context
基本上在它的purchase_units
数组之后你需要添加:
application_context: {
shipping_preference: 'NO_SHIPPING'
}
我在这里有一个例子: https : //stackoverflow.com/a/59384563/2069605
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.