Skip to main content

Merchant Help

 

Affirm Merchant Help

Retrieve VirtualCard Details

Card details request format

POST /api/v2/card/

This returns the virtual gift card details associated with the card_token that was passed in the request body. Once the card details are returned, the gift card can be authorized through your usual gift card gateway.

Gift card details request

 

curl https://sandbox.affirm.com/api/v2/card/
     -X POST
     -u "(public_api_key):(private_api_key)"
     -H "Content-Type: application/json"
     -d '{"card_token": "ARZBLCL7NAMBTZ2D"}'
Data
card_token
required string. The card token that was returned from the checkout success callback event data.

Card details response object

{
   billing_address: Object,
   callback_id:"0cd3bcb1-8592-4ebf-a8cd-08816fbe266a",
   cardholder_name:"John James Doe",
   card_token:"1L7Y0UV4IR8LIA9G",
   created:"2016-04-04T14:24:06.386576Z",
   expiration:"0719",
   id:"1L7Y0UV4IR8LIA9G",
   number:"41111111111111111"
}
billing address
object. This object can be ignored, as you will always be using the customer's billing (if provided) or shipping address.
callback_id
string. Can be ignored, for Affirm internal use.
cardholder_name
string. Can be ignored, since you will always be using the customer's name.
card_token
string.  The card token that these gift card details correspond to.
created
string. Timestamp of when the gift card was generated.
expiration
string. A four-digit expiration date in MMYY format.
id
string. Can be ignored, the transaction ID for this API event.
number
string. The gift card number. This can be set to your gift card gateway's test gift card number when using Affirm's sandbox environment.

Example card details request

curl https://sandbox.affirm.com/api/v2/card/
     -X POST
     -u "(public_api_key):(private_api_key)"
     -H "Content-Type: application/json"
     -d '{"card_token": "ARZBLCL7NAMBTZ2D"}'

Example card details response

{
   billing_address: Object,
   callback_id:"0cd3bcb1-8592-4ebf-a8cd-08816fbe266a",
   cardholder_name:"John James Doe",
   card_token:"1L7Y0UV4IR8LIA9G",
   created:"2016-04-04T14:24:06.386576Z",
   expiration:"0719",
   id:"1L7Y0UV4IR8LIA9G",
   number:"41111111111111111"
}