简体   繁体   English

使用信用卡令牌剩余API Paypal

[英]Use credit card token rest api paypal

I'm trying to use payment Vault from paypal payment. 我正在尝试从Paypal付款中使用付款保险柜。 I'm following this https://developer.paypal.com/docs/integration/direct/vault/#store-credit-card 我正在关注这个https://developer.paypal.com/docs/integration/direct/vault/#store-credit-card

I call: https://api.sandbox.paypal.com/v1/payments/payment 我打电话给: 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"
}

First check CardID validity. 首先检查CardID的有效性。 Is that card id expired or still valid. 该卡ID是否已过期或仍然有效。

If valid then You have Card ID like this "CARD-1E9132746P400060DLCNN6WY" 如果有效,则您具有这样的卡ID: “ CARD-1E9132746P400060DLCNN6WY”

And pass that Card ID to Credit card token. 并将该卡ID传递给信用卡令牌。

$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)); $ payer-> setFundingInstruments(阵列($ FI));

From Merchant Technical Support: 来自商家技术支持:

Would you please use the card from this url instead getcreditcardnumbers.com ? 您可以使用此网址中的卡代替getcreditcardnumbers.com吗? Get the card sample and store on the vault. 获取卡样本并存储在库中。 Afterwards, try to make the payment API from the stored card. 然后,尝试使用存储的卡制作付款API。 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! 我用另一个卡号做了另一个金库,它起作用了!

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

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