Add a Card to a Profile

POST /customervault/v1/profiles/profile_id/cards

The Customer Vault API allows you to store multiple credit cards against your customer's profile. For billing purposes, each credit card can be associated with a different address, or all credit cards can be associated with the same billing address, depending on your business needs.

To add a credit card to a profile and associate it with the address you just created, you must use the profile ID (716adb4f-6b85-4089-ba9c-d9c0eb649cd7 in the previous example) and make a POST request to the cards endpoint of the relevant profile. The POST body contains the card information and a billingAddressId parameter containing the address ID you want to associate the card with (81ffcddf-ad82-40d2-aaa0-c4f9c376ad65 in the previous example).

Before trying the example, you should replace the API key (after the -u) with the API key you have received and the profile ID and billingAddressId values with the ID values returned when you created an example profile and address respectively.

Request Example
curl -X POST https://api.test.paysafe.com/customervault/v1/profiles/716adb4f-6b85-4089-ba9c-d9c0eb649cd7/cards \
-u devcentre322:B-qa2-0-53625f86-302c021476f52bdc9deab7aea876bb28762e62f92fc6712d0214736abf501e9675e55940e83ef77f5c304edc7968 \
-H 'Content-Type: application/json' \
-d ' {
  "nickName":"Personal Visa",
  "holderName" : "John Smith",
  "cardNum" : "4530910000012345",
  "cardExpiry" : {
    "month" : 12,
    "year" : 2019
  },
  "billingAddressId" : "81ffcddf-ad82-40d2-aaa0-c4f9c376ad65"
 }'
Value Required? Type Description
billingAddressId string The id returned when the address was created, to be associated with the card.
cardExpiry Yes complex The card expiry date.
cardNum Yes string The card number.
defaultCardIndicator boolean Flag marking this card as the default for the profile.
holderName string The card holder's name.
merchantRefNum string The merchant's own card identification.
nickName string An alias for this address defined by the customer (for example, "home address").
Response Example
{
  "id" : "178ae2b8-85a5-4761-b1dd-4f14ac73571b",
  "status" : "ACTIVE",
  "holderName" : "John Smith",
  "cardBin" : "453091",
  "lastDigits" : "2345",
  "cardExpiry" : {
    "month" : 12,
    "year" : 2019
  },
  "cardType" : "VI",
  "paymentToken" : "CaBP0abDKgROjYU",
  "billingAddressId" : "81ffcddf-ad82-40d2-aaa0-c4f9c376ad65",
  "defaultCardIndicator" : false
}

The response returns an idfield containing the unique card ID, a card type (cardTypefield), and a status. The payment token associated with the card is returned in a paymentTokenfield.

See our API Reference section for the full list of card operations.

Did you find this page useful?