【发布时间】:2017-11-22 09:36:47
【问题描述】:
当我们使用 checkout.js 作为 Express Checkout 按钮时,我不确定 CREATE_PAYMENT_URL 应该是什么?
这应该是我们的 sandbox.paypal.com 网站吗?
我点击了我网站上的快速结帐按钮,但我不断收到 404 错误,说我作为 CREATE_PAYMENT_URL 放置的任何 URL(我知道,而不是当前存在的 '')都无法作为资源找到。
var CREATE_PAYMENT_URL = '';
var EXECUTE_PAYMENT_URL = '';
paypal.Button.render({
env: 'sandbox', // Or 'sandbox',
commit: true, // Show a 'Pay Now' button
payment: function(resolve, reject) {
return paypal.request.post(CREATE_PAYMENT_URL).then(function (data) {
resolve(data.paymentID);
})
.catch(function (err) {
reject(err);
});
},
onAuthorize: function(data, actions) {
return paypal.request.post(EXECUTE_PAYMENT_URL, {
paymentID: data.paymentID,
payerID: data.payerID
}).then(function () {
// The payment is complete!
// You can now show a confirmation message to the customer
});
}
}, '#paypal-button');
【问题讨论】:
标签: javascript paypal