【发布时间】:2017-07-04 12:30:01
【问题描述】:
我已经实施了新的贝宝快速结账。我想将我的 success_ipn.php URL 和 cancelled.php URL 传递给 checkout.js。
我做了很多谷歌和官方文档Paypal DOC。
下面是我的文件代码:
<!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>
var EXECUTE_PAYMENT_URL = 'http://example.com/success_ipn.php';
paypal.Button.render({
env: 'sandbox', // sandbox | production
// PayPal Client IDs - replace with your own
// Create a PayPal app: https://developer.paypal.com/developer/applications/create
client: {
sandbox: 'My Sandbox Client ID here.',
//production: '<insert production client id>'
},
// Show the buyer a 'Pay Now' button in the checkout flow
commit: true,
// payment() is called when the button is clicked
payment: function(data, actions) {
// Make a call to the REST api to create the payment
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: '0.01', currency: 'USD' }
}
]
}
});
},
// onAuthorize() is called when the buyer approves the payment
onAuthorize: function(data, actions) {
return paypal.request.post(EXECUTE_PAYMENT_URL, {
paymentID: data.paymentID,
payerID: data.payerID
}).then(function() {
window.alert('Payment Complete!');
});
}
}, '#paypal-button-container');
</script>
</body>
</html>
它工作正常,但是我如何传递我的 IPN 文件 URL 和取消 URL。
在对此做更多的谷歌之后,我只能得到以下变量而不是交易 ID 等:
paymentID: data.paymentID,
payerID: data.payerID
请帮帮我。
【问题讨论】:
标签: php paypal-sandbox paypal-ipn paypal