问题
How I can send a custom parameter to new Paypal Express checkout. I need to send the booking_id
and get the same after success full payment.
I have gone through the paypal official document, but can't found how we can send?
Please see below is my file code:
<!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>
回答1:
I have solved issues, we can pass the parameters in the payment method. like the below code:
payment: function(data, actions) {
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: '10', currency: 'USD' },
custom: '1452'
}
]
}
});
},
Hope this will help for developers.
回答2:
To invoice number use:
payment: {
transactions: [
{
amount: {
total: '200',
currency: 'BRL'
},
invoice_number: 100
}
]
}
来源:https://stackoverflow.com/questions/44923951/paypal-express-checkout-js-send-custom-parameters