0
votes

I'm trying to use payment Vault from paypal payment. I'm following this https://developer.paypal.com/docs/integration/direct/vault/#store-credit-card

I call: https://api.sandbox.paypal.com/v1/payments/payment

{
  "id":"CPPAY-13U4fds67758H032001PKPIFQZI",
  "intent":"sale",
  "payer":{
  "payment_method": "credit_card",
  "funding_instruments":[
      {
        "credit_card_token":{
        "credit_card_id":"CARD-3S3021595U985430TLCM4HLA"
        }
     }
]
},
"transactions": [
    {
      "amount":
      {
        "total": "1.00",
        "currency": "USD"
      },
      "description": "Testando pagamento cartao Vault."
    }]
}

But I'm getting this message:

{
  "name": "UNKNOWN_ERROR",
  "message": "An unknown error occurred.",
  "information_link": "https://developer.paypal.com/webapps/developer/docs/api/#UNKNOWN_ERROR",
  "debug_id": "64f99d6ec2b1f"
}
2
Can you show your code please ???Tejas Mehta
I'm using postman from chrome, just a POST thereMidori Fukami
Okay that means you sending directly with URL so you are doing something wrong with API,username password and signatureTejas Mehta
No, the credentials were all right. I did another vault with another card number and it workedMidori Fukami

2 Answers

0
votes

First check CardID validity. Is that card id expired or still valid.

If valid then You have Card ID like this "CARD-1E9132746P400060DLCNN6WY"

And pass that Card ID to Credit card token.

$creditCardToken = new CreditCardToken();
$creditCardToken->setCreditCardId($credit_card_id);
$fi = new FundingInstrument();
$fi->setCreditCardToken($creditCardToken);
$payer = new Payer(); 
$payer->setPaymentMethod("credit_card");
$payer->setFundingInstruments(array($fi));

I think your error is due to last line of my above code Please cast funding instrument object with array and you will get your error solved. Change your code as below

$payer->setFundingInstruments(array($fi));

0
votes

From Merchant Technical Support:

Would you please use the card from this url instead getcreditcardnumbers.com ? Get the card sample and store on the vault. Afterwards, try to make the payment API from the stored card. Besides, please ensure that your sandbox account must be either a US, UK, or Canada account. This is because direct credit payment only currently available for these three countries. I hope this resolves the issue. Please be sure to let me know if the issue persists or you have additional inquiries.

I did another vault with another card number and it worked!