简体   繁体   English

PayPal API Response how to get the response javascript function changed to PHP variables?

[英]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&currency=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.

相关问题 如何从Javascript到PHP文件获得Payeezy API响应? - How to get Payeezy API response from Javascript to PHP file? 如何使用 fetch 函数 javascript 获取 API 响应数据? - how to get API response data with fetch function javascript? 贝宝结帐按钮获取javascript中的json响应 - paypal checkout button get json response in javascript 如何使用 PHP 或 JavaScript 获取客户端响应标头? - How to get client response headers with PHP or JavaScript? 如何将输入的 html 数据作为其变量传递给 javascript 函数并获得响应 - How to pass input html data to a javascript function as its variables and get a response 如何从 API 获取响应数据并从数据中编码函数以使用 node js JavaScript 获取结果 - How to get the response data from API and code the function from data to get the result using node js JavaScript 如何在2个变量中获取Jquery响应? - How to get Jquery response in 2 variables? RESOURCE_NOT_FOUND 在 JavaScript 中的 PayPal 中创建订阅 Api 响应时 - RESOURCE_NOT_FOUND while creating Subscription Api response in PayPal in JavaScript 如何使用 paypal 的 javascript sdk 从创建订单 api 的响应链接批准订单? - How to approve order from response links of create order api using paypal's javascript sdk? 获取JavaScript函数中另一个JavaScript函数的响应 - Get Response of another javascript function in a javascript function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM