title: PayPal REST API returning 500 Server error for credit Card Token
body: <p>I am trying to have the PayPal REST api create a payment with a credit card stored in the vault. But, whenever I try and make a payment with the card in the vault PayPal's API will hang for around half a minute, and then give me the following 500 error:</p>
  
  <pre><code>Exception: Got Http response code 500 when accessing https://api.sandbox.paypal.com/v1/payments/payment.
  {"name":"INTERNAL_SERVICE_ERROR","message":"An internal service error has occurred","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#INTERNAL_SERVICE_ERROR","debug_id":"e3c779ea99f73"}
  </code></pre>
  
  <p>This is the code I am using (I apologize if there is too much information here, I didn't know what information was pertinent to my problem)</p>
  
  <pre><code>&lt;?php
  include("bootstrap.php"); //Sample bootstrap file configured with my clientId and Secret, creates $apiContext
  use PayPal\Api\CreditCard;
  use PayPal\Api\Payer;
  use PayPal\Api\FundingInstrument;
  use PayPal\Api\Details;
  use PayPal\Api\Amount;
  use PayPal\Api\Transaction;
  use PayPal\Api\Payment;
  use PayPal\Api\Address;
  use PayPal\Api\CreditCardToken;
  
  $useVault = true;
  
  $addr = new Address();
  $addr-&gt;setLine1('52 N Main ST');
  $addr-&gt;setCity('Johnstown');
  $addr-&gt;setCountry_code('US');
  $addr-&gt;setPostal_code('43210');
  $addr-&gt;setState('OH');
  
  
  $card = new CreditCard();
  //Also used PayPal Sandbox account number here
  $card-&gt;setNumber('4111111111111111');
  $card-&gt;setExpire_month('03');
  $card-&gt;setExpire_year('2019');
  $card-&gt;setCvv2('123');
  $card-&gt;setFirst_name('Joe');
  $card-&gt;setLast_name('Shopper');
  $card-&gt;setType('visa');
  $card-&gt;setBilling_address($addr);
  $fi = new FundingInstrument();
  
  //Setting $useVault to false here
  // will attempt to make the payment without storing the CC in the vault
  // Which works. having it use the vault will return a 500 error
  if($useVault){
      //use Store the CC in the vault
      $response = $card-&gt;create($apiContext);
      $ccToken = new CreditCartToken();
      $ccToken-&gt;setCredit_card_id($response-&gt;id);
      $fi-&gt;setCredit_card_token($creditCardToken);
  }else{
      $fi-&gt;setCredit_card($card);
  }
  
  
  $payer = new Payer();
  $payer-&gt;setPayment_method('credit_card');
  $payer-&gt;setFunding_instruments(array($fi));
  $amountDetails = new Details();
  $amountDetails-&gt;setSubtotal('7.41');
  $amountDetails-&gt;setTax('0.03');
  $amountDetails-&gt;setShipping('0.03');
  
  
  $amount = new Amount();
  $amount-&gt;setCurrency('USD');
  $amount-&gt;setTotal('7.47');
  $amount-&gt;setDetails($amountDetails);
  $transaction = new Transaction();
  $transaction-&gt;setAmount($amount);
  $transaction-&gt;setDescription('This is the payment transaction description.');
  
  $payment = new Payment();
  $payment-&gt;setIntent('sale');
  $payment-&gt;setPayer($payer);
  $payment-&gt;setTransactions(array($transaction));
  try {
      var_dump($payment-&gt;create($apiContext));
  } catch (PayPal\Exception\PPConnectionException $ex) {
      echo "Exception: " . $ex-&gt;getMessage() . PHP_EOL;
      var_dump($ex-&gt;getData());
      exit(1);
  }
  </code></pre>
  
  <p>If I change <code>$useVault</code> to <code>false</code> then the payment will be made and the transaction will show up in the developer sandbox. 
  I used <a href="https://devtools-paypal.com/guide/pay_savedcard/php?interactive=ON&amp;env=sandbox" rel="noreferrer">this guide at dev-tools.paypal.com</a> and it seems to be having the same problem as me ( I get to step 3 of 4, and it prints that an internal service error has occured</p>