php
  • curl
  • paypal
  • paypal-sandbox
  • vault
  • 2016-05-26 56 views 1 likes 
    1

    有什麼問題在我的代碼:使用保存的貝寶信用卡信息庫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這裏

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

    回答

    1

    ,因爲我沒有得到任何人的任何解決方案,所以我挖成我的代碼一步一步地,發現solution.there是在我的代碼只能刷卡,不,不錯誤和負面測試issue.i遵循以下發布在stackoverflow並獲得成功

    PayPal Sandbox API endpoint returning 503 "Internal Service Error" error

    PayPal Sandbox returning Internal Service Error

    相關問題