我正在使用.Net,试图实现多个按钮。
我从PayPal(付款ID,付款人ID等)获得答案,但一切都是客户端的。如何检查服务器端的付款?
我是否需要为每个按钮实现所有这些代码?
<script>
paypal.Button.render({
env: 'production', // Optional: specify 'sandbox' environment
client: {
sandbox: 'xxxxxxxxx',
production: 'xxxxxxxxx'
},
payment: function() {
var env = this.props.env;
var client = this.props.client;
return paypal.rest.payment.create(env, client, {
transactions: [
{
amount: { total: '1.00', currency: 'USD' }
}
]
});
},
commit: true, // Optional: show a 'Pay Now' button in the checkout flow
onAuthorize: function(data, actions) {
// Optional: display a confirmation page here
return actions.payment.execute().then(function() {
// Show a success page to the buyer
});
}
}, '#paypal-button');
</script>
答案 0 :(得分:0)
data.paymentID
传递到服务器端并使用它来对PayPal进行REST调用:https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/advanced-payments-api/show-payment-details/
paypal.Button.render()
,但如果需要,可以在for循环中执行此操作。