2016-05-26 5 views
1

Was meinen Code ist Thema in: Vault api gespeichert in paypal Kreditkartendaten verwenden, aber wenn ich gespeichert Karte dann Fehlerwenn gespeicherte Karte in Paypal Vault verwenden es INTERNE SERVICE Fehler zurück

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 erhalten hier

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

Antwort