贝宝快速付款验证
Posted
技术标签:
【中文标题】贝宝快速付款验证【英文标题】:PayPal Express Payment Verification 【发布时间】:2018-11-24 22:55:53 【问题描述】:我正在开发一个我接受 PayPal Express Checkout 的 WordPress 插件。我能够成功获取 PaymentID 和 PayerID。但我不知道如何验证付款。 另外,我可以从 payerID 或 PaymentID 获取付款人详细信息吗?
下面是我用来创建支付按钮的脚本。
<script>
paypal.Button.render(
env: 'sandbox',
// PayPal Client IDs - replace with your own
// Create a PayPal app: https://developer.paypal.com/developer/applications/create
client:
sandbox: 'AfI6d9wTxV519v5OI08omQE7HX9XI6-h3AopzKAiP5Yk2nO6brKaTJH8DyeAwpRpLI0CjGtQVSS737eS',
production: 'AfI6d9wTxV519v5OI08omQE7HX9XI6-h3AopzKAiP5Yk2nO6brKaTJH8DyeAwpRpLI0CjGtQVSS737eS'
,
// 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: <?php echo $_SESSION['trip-cost'];?>, currency: 'USD' ,
custom: '1452'
]
);
,
validate: function(actions)
// var fields = jQuery(".wp-travel-engine-billing-details-wrapper").find("select, input").serializeArray();
// console.log(fields);
// jQuery.each(fields, function(i, field)
// if (!field.value)
// alert(field.name + ' is required');
// );
,
// onAuthorize() is called when the buyer approves the payment
onAuthorize: function(data, actions)
// Make a call to the REST api to execute the payment
return actions.payment.execute().then(function()
window.location = '<?php echo $wp_travel_engine_confirmation_page; ?>?paymentid='+data.paymentID+"&payerID="+data.payerID+"&token="+data.paymentToken+"&pid=1";
);
, '#paypal-button-container');
</script>
谢谢。
【问题讨论】:
【参考方案1】:我可以通过使用 ipnlistener 来做到这一点。
【讨论】:
以上是关于贝宝快速付款验证的主要内容,如果未能解决你的问题,请参考以下文章