PAYPAL REST API:您如何使用拱形信用卡收费

时间:2013-08-27 19:34:11

标签: api rest paypal

使用PAYPAL REST API,我能够成功(1)存储信用卡和(2)查找存储的信用卡信息。

查找Vaulted信用卡并收到Paypal的回复后;但是,您是否会重新使用该响应数据来创建未来的交易?

#How to Look up the Vaulted Credit Card
curl -v [link removed]/CARD-8TT93830P06829326KIOO3XI -H "Content-Type:application/json" -H "Authorization:Bearer O912TKmsB8WRsgdNrNrJAmlCqF5kLdEl.re3z4Kmp8M"

#Paypal's Response to the Lookup Request
{"id":"CARD-8TT93830P06829326KIOO3XI","valid_until":"2016-08-26T00:00:00Z","state":"ok","payer_id":"user12345","type":"visa","number":"xxxxxxxxxxxx0331","expire_month":"11","expire_year":"2018","first_name":"Joe","last_name":"Shopper","links":[{"href":"[link removed]/CARD-8TT93830P06829326KIOO3XI","rel":"self","method":"GET"},{"href":"[link removed]/CARD-8TT93830P06829326KIOO3XI","rel":"delete","method":"DELETE"}]}

我正在寻找一个卷曲命令,允许我使用Vaulted信用卡每月收费。

1 个答案:

答案 0 :(得分:0)

您可以使用相同的/payment来电,但会切换credit_card_id的卡数据。

例如;

{
  "intent": "sale",
  "payer": {
    "payment_method": "credit_card",
    "funding_instruments": [
      {
        "credit_card_token": {
          "credit_card_id": "CARD-XXXXXXXXXXXXXX"
        }
      }
    ]
  },
  "transactions": [
    {
      "amount": {
        "total": "7.47",
        "currency": "USD"
      },
      "description": "This is the payment transaction description."
    }
  ]
}

或者在cURL中:

curl -v https://api.sandbox.paypal.com/v1/payments/payment -X POST -H "Content-Type:application/json" -H "Authorization:Bearer xxxxxxxxx" -d '{"intent":"sale","payer":{"payment_method":"credit_card","funding_instruments":[{"credit_card_token":{"credit_card_id":"CARD-9ND477057R590115SKIOT7OY"}}]},"transactions":[{"amount":{"total":"7.47","currency":"USD"},"description":"This is the payment transaction description."}]}'

the docs中还有更多相关信息。