<bdo id='dk9qb'></bdo><ul id='dk9qb'></ul>
  • <tfoot id='dk9qb'></tfoot>

      <i id='dk9qb'><tr id='dk9qb'><dt id='dk9qb'><q id='dk9qb'><span id='dk9qb'><b id='dk9qb'><form id='dk9qb'><ins id='dk9qb'></ins><ul id='dk9qb'></ul><sub id='dk9qb'></sub></form><legend id='dk9qb'></legend><bdo id='dk9qb'><pre id='dk9qb'><center id='dk9qb'></center></pre></bdo></b><th id='dk9qb'></th></span></q></dt></tr></i><div id='dk9qb'><tfoot id='dk9qb'></tfoot><dl id='dk9qb'><fieldset id='dk9qb'></fieldset></dl></div>
      <legend id='dk9qb'><style id='dk9qb'><dir id='dk9qb'><q id='dk9qb'></q></dir></style></legend>

      <small id='dk9qb'></small><noframes id='dk9qb'>

        Paypal 使用 php curl 获取带有支付键的交易详细信息

        Paypal get transaction details with pay key using php curl(Paypal 使用 php curl 获取带有支付键的交易详细信息)

      1. <i id='z7nGo'><tr id='z7nGo'><dt id='z7nGo'><q id='z7nGo'><span id='z7nGo'><b id='z7nGo'><form id='z7nGo'><ins id='z7nGo'></ins><ul id='z7nGo'></ul><sub id='z7nGo'></sub></form><legend id='z7nGo'></legend><bdo id='z7nGo'><pre id='z7nGo'><center id='z7nGo'></center></pre></bdo></b><th id='z7nGo'></th></span></q></dt></tr></i><div id='z7nGo'><tfoot id='z7nGo'></tfoot><dl id='z7nGo'><fieldset id='z7nGo'></fieldset></dl></div>

          <tbody id='z7nGo'></tbody>
      2. <small id='z7nGo'></small><noframes id='z7nGo'>

            <bdo id='z7nGo'></bdo><ul id='z7nGo'></ul>
              • <tfoot id='z7nGo'></tfoot>

                <legend id='z7nGo'><style id='z7nGo'><dir id='z7nGo'><q id='z7nGo'></q></dir></style></legend>
                  本文介绍了Paypal 使用 php curl 获取带有支付键的交易详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在成功通过 android paypal 付款后收到回复.回复如下.

                  I get response after successful android paypal payment. The response was below.

                  {
                      "response": {
                         "state": "approved",
                         "id": "PAY-6PU626847B294842SKPEWXHY",
                   "create_time": "2014-07-18T18:46:55Z",
                          "intent": "sale"
                       },
                     "client": {
                         "platform": "Android",
                         "paypal_sdk_version": "2.11.0",
                           "product_name": "PayPal-Android-SDK",
                          "environment": "mock"
                      },
                      "response_type": "payment"
                   }
                   {
                     "short_description": "Pay List Payment",
                     "amount": "100",
                      "intent": "sale",
                      "currency_code": "USD"
                   }
                  

                  然后我使用 PAY-6PU626847B294842SKPEWXHY 支付密钥,并使用 PHP curl GET 请求和以下代码获取交易详情.

                  then I use the PAY-6PU626847B294842SKPEWXHY pay key and get the transaction details using PHP curl GET request with the following code.

                  $accessToken='<Access Token>';
                  $curl = curl_init("https://api.sandbox.paypal.com/v1/payments/payment/PAY-6PU626847B294842SKPEWXHY");
                  curl_setopt($curl, CURLOPT_POST, false);
                  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
                  curl_setopt($curl, CURLOPT_HEADER, false);
                  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
                  curl_setopt($curl, CURLOPT_HTTPHEADER, array(
                      'Authorization: Bearer ' . $accessToken,
                      'Accept: application/json',
                      'Content-Type: application/json'
                  ));
                  $response = curl_exec($curl);
                  
                  print_r($response);
                  exit;
                  

                  点击此后,我得到以下响应,但未获取交易详细信息.

                  After hit this i get the following response not get the transaction detail.

                  {"name":"INVALID_RESOURCE_ID","message":"未找到请求的资源ID","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#INVALID_RESOURCE_ID","debug_id":"ddc1e3a55f10e"}

                  任何人有想法提前致谢.

                  anybody have idea thanks in advance.

                  推荐答案

                  以下对我有用.

                  1.制作 CURL POST 以获取访问令牌

                  $uri = 'https://api.sandbox.paypal.com/v1/oauth2/token';
                      //for live production use $uri = 'https://api.paypal.com/v1/oauth2/token';
                  
                  $clientId = '<YOUR-CLIENT-ID-HERE>';
                  $secret = '<YOUR-SECRET-HERE>';
                  
                  $ch = curl_init();
                  
                  curl_setopt($ch, CURLOPT_URL, $uri);
                  curl_setopt($ch, CURLOPT_HEADER, false);
                  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                  curl_setopt($ch, CURLOPT_SSLVERSION , 6); //NEW ADDITION
                  curl_setopt($ch, CURLOPT_POST, true);
                  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
                  curl_setopt($ch, CURLOPT_USERPWD, $clientId.":".$secret);
                  curl_setopt($ch, CURLOPT_POSTFIELDS, "grant_type=client_credentials");
                  
                  $result = curl_exec($ch);
                  $access_token = '';
                  if(empty($result))die("Error: No response.");
                  else
                  {
                      $json = json_decode($result);
                      $access_token = $json->access_token;
                  }
                  
                  curl_close($ch);
                  

                  2.制作 CURL POST 以获取交易详细信息,例如付款状态、金额、日期等.

                  $url = "https://api.sandbox.paypal.com/v2/payments/captures/<YOUR-PAYMENT-ID-HERE>";
                  $accessToken=$access_token;
                  $curl = curl_init($url);
                  curl_setopt($curl, CURLOPT_POST, false);
                  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
                  curl_setopt($curl, CURLOPT_HEADER, false);
                  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
                  curl_setopt($curl, CURLOPT_HTTPHEADER, array(
                      'Authorization: Bearer ' . $accessToken,
                      'Accept: application/json',
                      'Content-Type: application/json'
                  ));
                  $response = curl_exec($curl);
                  
                  print_r($response);
                  exit;
                  

                  3.MAKE CURL POST 以获取更多交易详细信息(这比第 2 步提供更详细的响应.因此您可以使用此而不是第 2 步

                  $url = "https://api.sandbox.paypal.com/v2/checkout/orders/<YOUR-order-ID-HERE>";
                  $accessToken=$access_token;
                  $curl = curl_init($url);
                  curl_setopt($curl, CURLOPT_POST, false);
                  curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
                  curl_setopt($curl, CURLOPT_HEADER, false);
                  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
                  curl_setopt($curl, CURLOPT_HTTPHEADER, array(
                      'Authorization: Bearer ' . $accessToken,
                      'Accept: application/json',
                      'Content-Type: application/json'
                  ));
                  $response = curl_exec($curl);
                  
                  print_r($response);
                  exit;
                  

                  这篇关于Paypal 使用 php curl 获取带有支付键的交易详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                    <tbody id='Fz1xV'></tbody>
                    <legend id='Fz1xV'><style id='Fz1xV'><dir id='Fz1xV'><q id='Fz1xV'></q></dir></style></legend>
                    <i id='Fz1xV'><tr id='Fz1xV'><dt id='Fz1xV'><q id='Fz1xV'><span id='Fz1xV'><b id='Fz1xV'><form id='Fz1xV'><ins id='Fz1xV'></ins><ul id='Fz1xV'></ul><sub id='Fz1xV'></sub></form><legend id='Fz1xV'></legend><bdo id='Fz1xV'><pre id='Fz1xV'><center id='Fz1xV'></center></pre></bdo></b><th id='Fz1xV'></th></span></q></dt></tr></i><div id='Fz1xV'><tfoot id='Fz1xV'></tfoot><dl id='Fz1xV'><fieldset id='Fz1xV'></fieldset></dl></div>
                  • <tfoot id='Fz1xV'></tfoot>

                            <bdo id='Fz1xV'></bdo><ul id='Fz1xV'></ul>

                            <small id='Fz1xV'></small><noframes id='Fz1xV'>