[英]PAYPAL REST API: How do you bill with a vaulted credit card
Using the PAYPAL REST API, I was able to successfully (1) Vault a credit card and (2) Lookup the vaulted credit card information. 使用PAYPAL REST API,我能够成功(1)保管信用卡和(2)查找保管的信用卡信息。
After you lookup the Vaulted Credit Card and receive Paypal's response; 查找保管库信用卡并收到Paypal的回复后; however, do you re-use that response data to create a transaction in the future? 但是,您将来会重用该响应数据来创建事务吗?
#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"}]}
I am looking for a curl command that would allow me to use the Vaulted Credit Card to bill monthly. 我正在寻找一个curl命令,该命令将允许我使用Vaulted信用卡每月付费。
You would use the same /payment
call, but switch out the card data for the credit_card_id
. 您将使用相同的/payment
credit_card_id
呼叫,但切换出credit_card_id
的卡数据。
For example; 例如;
{
"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."
}
]
}
Or in cURL: 或在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."}]}'
There is some more information about this in the docs as well. 在文档中也有关于此的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.