我的 HTML 页面上有一个表单,其中包含 paypal 按钮和 paypal 信用卡按钮。这是一个简单的 HTML、JS 网站,而不是网上商店。成功付款后如何以编程方式发布表格?我的onApprove部分在下面不起作用。*目前只设置了paypal沙盒账户。
paypal.Buttons({
style: {
layout: 'vertical',
color: 'black',
shape: 'rect',
label: 'paypal',
height: 45
},
createOrder: function (data, actions) {
// This function sets up the details of the transaction, including the amount and line item details.
return actions.order.create({
purchase_units: [{
amount: {
value: total
}
}]
});
},
onApprove: function (data, actions) {
// This function captures the funds from the transaction.
return actions.order.capture().then(function (details) {
// This function shows a transaction success message to your buyer.
$('#orderForm').submit();
});
}
//fundingSource: paypal.FUNDING.PAYPAL
}).render('#paypal-button-container');