[英]PayPal API Response how to get the response javascript function changed to PHP variables?
hope you can help!希望你能帮忙!
Just testing the PayPal API in sandbox at the moment, i'm creating and authorising the payment ok and this returns an alert to the page with info from the payer, this is in javascript, what i want to do is remove the alert message showing the details and instead, use the payer details to show a message and update my database using PHP.目前只是在沙箱中测试 PayPal API,我正在创建并授权付款,这会向页面返回一条警报,其中包含来自付款人的信息,这是在 javascript 中显示的警报消息,详细信息,而是使用付款人详细信息显示消息并使用 PHP 更新我的数据库。
How can i get the details showing in the javascript alert below back into usable PHP variables i can send to my database to update it and show the approved message?如何将下面 javascript 警报中显示的详细信息返回到可用的 PHP 变量中,我可以发送到我的数据库以更新它并显示批准的消息?
At the moment: details.payer.email_address
shows the email address correctly but i want to get this into a php veriable like $email = details.payer.email_address;
目前:
details.payer.email_address
正确显示了 email 地址,但我想将其放入 php 中,如$email = details.payer.email_address;
<script
src="https://www.paypal.com/sdk/js?client-id=Af_V3NNV2RUksS5sfObGCirO3gTXSFuetygoYta5-zU-ROGToia5dceU9cT5DBL821zc-ihtNQydiqsf¤cy=GBP&intent=capture&disable-funding=card,bancontact,sepa,ideal,sofort" data-order-id="2VW94544JM6797511">
</script>
<div id="paypal-button-container"></div>
<script>
paypal.Buttons({
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '25.20'
}
}]
});
},
onApprove: function(data, actions) {
// Capture the funds from the transaction
return actions.order.capture().then(function(details) {
// Show a success message to your buyer
alert('Transaction completed by ' + details.payer.name.given_name + ' ' + details.payer.name.surname + ' ' + details.payer.email_address + ' ' + details.purchase_units[0].amount.currency_code + details.purchase_units[0].amount.value + ' ' + details.purchase_units[0].shipping.address.address_line_1);
});
}
}).render('#paypal-button-container');
</script>
I've come up with a solution!我想出了一个解决办法! all goone now thanks!
现在一切都过去了,谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.