【发布时间】:2021-01-06 21:04:55
【问题描述】:
我在使用 PayPal 智能按钮界面时遇到问题。文档非常适得其反。
沙盒中的电子邮件样本不会显示项目描述/详细信息。它只显示总数。在他们网站上的一份文档中,items 块位于 purchase_units 块内。失败不会有真正的错误信息。
paypal.Buttons({
createOrder: function (data, actions) {
// Busy indicator.
var spinner = document.getElementById("spinner");
var cart = document.getElementById("vysshopcart");
spinner.style.display = "block";
cart.style.display = "none";
// This function sets up the details of the transaction, including the amount and line item details.
return actions.order.create({
purchase_units: [{
amount: {
value: "10",
"currency-code": "USD",
details: {
subtotal: "10",
shipping: "0",
tax: "0.00"
},
total: "10"
}
}],
links: [{
href: "http://192.168.249.20:81/virtual-yard-sale?invoice=2020092011397C1E",
rel: "approve"
}],
"items": [
{
"sku": "2",
"name": "Harry & David Snack Disk",
"price": "5.00",
"quantity": "1",
"category": "PHYSICAL_GOODS",
"currency": "USD"
}
, {
"sku": "10",
"name": "Raya Insulated Lunch Tote",
"price": "5.00",
"quantity": "1",
"category": "PHYSICAL_GOODS",
"currency": "USD"
}
]
});
},
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.
window.location.replace("http://192.168.249.20:81/virtual-yard-sale?invoice=2020092011397C1E");
});
}
}).render('#paypal-button-container');
【问题讨论】:
-
知道了。现在弄清楚 OnApprove 流程。
-
其实这篇文章很有帮助。 stackoverflow.com/questions/56414640/…
标签: javascript paypal paypal-ipn