Cashfree Vault

This document guides you how to integrate Cashfree’s card vault API to avail the saved card feature

Save Card

Refer to the seamless pro docs here to save the card.

<form>
....
<input name="paymentOption" value="card"/>
<input name="card_number" value="4444333322221111"/>
<input name="card_holder" value="John Doe"/>
<input name="card_expiryMonth" value="09"/>
<input name="card_expiryYear" value="2020"/>
<input name="card_cvv" value="123"/>
<input name="card_save" value="1"/>
</form>

Add additional parameter ‘card_save’ and set it to 1 to save the card in seamless pro flow. Cards are only saved once the transaction is successful.

Please note that the card gets saved against the phone number provided in the above request. To fetch the card token you'll have to call the getCards API (see below).

Use Saved Card

Please use the below form to submit a saved card.

<form>
....
<input name="paymentOption" value="savedCard"/>
<input name="card_id" value="A83091283HDKASHKJDH2132"/>
<input name="card_cvv" value="123"/>
</form>

Please use the below endpoints to get Saved Cards

Endpoints

URL Environment
https://test.cashfree.com/ TEST
https://api.cashfree.com/ PRODUCTION

Cashfree uses API keys to allow access to the API. Once you have signed up at our merchant site, you will be able to retrieve your AppId and SecretKey (API keys)

CashFree expects API key to be included in all API requests to the server. Use the endpoint /api/v1/credentials/verify to verify your credentials first (check Rest API docs).

Get all Cards associated with a customer.

URL - POST /api/v1/vault/cards/getCards

Request Parameters

Parameter Required Description
appId Yes Your app id
secretKey Yes Your Secret Key
phone Yes String Phone number used to identify user

Response Parameters

Parameter Required Description  
cardId Yes Your Card Id  
maskedCard Yes Masked Card Number  
cardScheme Yes Card scheme eg .Visa, Mastercard  

Example Request

curl -X POST \
https://test.cashfree.com/api/v1/vault/cards/getCards \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'appId=XXXX&secretKey=XXXX&phone=9895XXX649'

Response

[
{
"cardId":"63E6E4B4208A11E8B6EFB84A4B991DC5",
"maskedCard":"411111XXXXXX1132",
"cardScheme":"visa"
},
{
"cardId":"AC94D8B80D9011E8B6EFB84A4B991DC5",
"maskedCard":"411111XXXXXX1133",
"cardScheme":"visa"
}
]

Delete Card associated with a customer.

URL - POST /api/v1/vault/cards/deleteCard

Request Parameters

Parameter Required Description
appId Yes Your app id
secretKey Yes Your Secret Key
phone Yes String Phone number used to identify user
cardId Yes Your Card Id

Response Parameters

Parameter Required Description
status Yes API call status, values - OK and ERROR

Example Request

curl -X POST \
https://test.cashfree.com/api/v1/vault/cards/deleteCard \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d
'appId=XXXX&secretKey=XXX&phone=9895XXX649&cardId=B3BF498612E611E8A15B0AC95
3478514'

Response

{
“status”:”OK”
“message”: “Deleted Successfully”
}