我正在寻找 PayPal 交互式集成演示 link .
在用户完成支付流程后的某个时刻,客户端到达代码:
// 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.alert('Payment Complete!');
});
}
在实际场景中,我可能想向服务器发送一条指令以发送产品或更新用户计划,而不是警报。它可能会通过 HTTP POST 请求完成。
服务器如何知道确实进行了付款,而不是黑客手动发送 http post 请求的结果?
最佳答案
在 actions.payment.execute()
之后,您可以调用您的服务器并让它进行 GET
调用以验证付款是否已完成:https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/advanced-payments-api/show-payment-details/
关于paypal - 服务器如何知道付款确实是通过 PayPal 客户端 REST API 进行的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46025678/