如何将自定义参数发送到新的Paypal Express结帐。我需要发送booking_id
并在成功全额付款后获得相同的结果。
我已经通过paypal官方document,但无法找到我们如何发送?
请参阅下面的我的文件代码:
<!DOCTYPE html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
</head>
<body>
<div id="paypal-button-container"></div>
<script>
paypal.Button.render({
env: 'sandbox', // sandbox | production
client: {
sandbox: 'AYbCnvobq09Ptmsd1TRp3019CMrSTyaAmrHNv6ox0jl86H9OZFmGCPqHqqfPtqpTYTiIuy_e5UGnclMw',
//production: '<insert production client id>'
},
commit: true,
payment: function(data, actions) {
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: '0.01', currency: 'USD' }
}
]
}
});
},
onAuthorize: function(data, actions) {
return actions.payment.execute().then(function() {
window.alert('Payment Complete!');
});
}
}, '#paypal-button-container');
</script>
</body>
答案 0 :(得分:7)
我已经解决了问题,我们可以在付款方式中传递参数。如下面的代码:
payment: function(data, actions) {
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: '10', currency: 'USD' },
custom: '1452'
}
]
}
});
},
希望这对开发者有所帮助。
答案 1 :(得分:0)
要使用发票号码:
payment: {
transactions: [
{
amount: {
total: '200',
currency: 'BRL'
},
invoice_number: 100
}
]
}