简体   繁体   English

在 Paypal Vault 中使用存储卡时,它返回内部服务错误

[英]when using stored card in Paypal Vault it return INTERNAL SERVICE ERROR

What is issue in my code:Using Vault api in paypal credit card information saved but when i using saved card then get error我的代码有什么问题:在保存的 paypal 信用卡信息中使用 Vault api 但是当我使用保存的卡时出现错误

function paypalPaymentViaStoredCreditCard_post()
{
    $access_token = "XXXXXXXX";
    $ch = curl_init();
    $data = '{
        "intent": "sale",
        "payer": {
          "payment_method": "credit_card",
          "funding_instruments":[
            {
              "credit_card_token": {
                "credit_card_id": "CARD-6F0009583J819301DK5DO5JA",
                "payer_id": "BAAAA"
              }
            }
          ]
        },
        "transactions":[
          {
            "amount":{
            "total":"100.00",
            "currency":"USD"
            },
            "description": "This is the payment transaction description."
          }
        ]
      }';


     curl_setopt($ch, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/payments/payment");
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
     curl_setopt($ch, CURLOPT_HTTPHEADER, array(
     "Content-Type:application/json",
     "Authorization: Bearer " . $access_token,
     "Content-length: " . strlen($data))
     );


    curl_setopt($ch, CURLOPT_USERAGENT, "User-Agent: Some-Agent/1.0");
    $result = curl_exec($ch);
    print_r($result);die;
    if (empty($result)) die("Error: No response.");
    else {
          $json = json_decode($result);
          print_r($json);
          die;
          return $json;
    }
    curl_close($ch);
} 

OUTPUT Here在这里输出

{"name":"INTERNAL_SERVICE_ERROR","information_link":"https://api.sandbox.paypal.com/docs/api/#INTERNAL_SERVICE_ERROR","debug_id":"b33db4a496dfc"}

As I didn't get any solution from anybody so I dug into my code step by step and found solution.there is no bug in my code only credit card no and negative testing issue.i follow following post on stackoverflow and get get success由于我没有从任何人那里得到任何解决方案,所以我一步一步地研究了我的代码并找到了解决方案。我的代码中没有错误,只有信用卡没有和负面测试问题。我按照 stackoverflow 上的以下帖子进行操作并获得成功

PayPal Sandbox API endpoint returning 503 "Internal Service Error" error PayPal Sandbox API 端点返回 503“内部服务错误”错误

PayPal Sandbox returning Internal Service Error 贝宝沙箱返回内部服务错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM