我只想让你在感谢页面显示我的客户的贝宝交易金额。 请用HTML JavaScript给我答案。 这是高度赞赏的。 谢谢。
paypal.Button.render({
env: 'production', // Optional: specify 'sandbox' environment
client: {
sandbox: 'xxxxxxxxx',
production: 'xxxxxxxxx'
},
commit: true, // Optional: show a 'Pay Now' button in the checkout flow
payment: function (data, actions) {
return actions.payment.create({
payment: {
transactions: [
{
amount: {
total: '1.00',
currency: 'USD'
}
}
]
}
});
},
onAuthorize: function (data, actions) {
// Get the payment details
return actions.payment.get()
.then(function (paymentDetails) {
// Show a confirmation using the details from paymentDetails
// Then listen for a click on your confirm button
document.querySelector('#confirm-button')
.addEventListener('click', function () {
// Execute the payment
return actions.payment.execute()
.then(function () {
// Show a success page to the buyer
});
});
});
}
}, '#paypal-button');
这是Javascript的实现,最终将生成HTML。
这里有一个可供参考的链接:https://developer.paypal.com/docs/archive/checkout/how-to/customize-flow/#show-a-confirmation-page