Credit Cards

Creditcards created via the API are immediately pushed to stripe and tokenized. Only the token is stored inside Commerce7.

The credit-card object

{
 "id": "e804d4b3-e4e6-4a98-b395-4721d2002c77",
 "cardBrand": "Visa",
 "maskedCardNumber": "************1111",
 "expiryMo": 4,
 "expiryYr": 2027,
 "cardHolderName": "Jason Andres",
 "tokenOnFile": "Xt5EWLLDS7FJjR1c",
 "customerId": "9d30102b-afdf-42ca-9919-1500c730cac8",
 "isDefault": true,
 "createdAt": "2018-05-22T18:35:03.998Z",
 "updatedAt": "2018-05-22T18:35:03.998Z"
}

Create a credit-card

POST: /customer/:customerId/credit-card

{
  "cardBrand": "MasterCard",
  "gateway": "No Gateway",
  "maskedCardNumber": "************5454",
  "tokenOnFile": "Xt5EWLLDS7FJjR1c",
  "expiryMo": 1,
  "expiryYr": 2021,
  "cardHolderName": "Andrew Kamphuis",
  "isDefault": true
}

RESPONSE: responds with a credit-card object.

Retrieve a credit-card

GET: /customer/:customerId/credit-card/:id

RESPONSE: responds with a credit-card object.

Update a credit-card

PUT: /customer/:customerId/credit-card/:id

{
  "cardBrand": "MasterCard",
  "gateway": "No Gateway",
  "maskedCardNumber": "************5454",
  "tokenOnFile": "Zt5AFGLDS7FMjY1b",
  "expiryMo": 1,
  "expiryYr": 2021,
  "cardHolderName": "Andrew Kamphuis",
  "isDefault": true
}

RESPONSE: responds with a credit-card object.

Delete a credit-card

DELETE: /customer/:customerId/credit-card/:id

RESPONSE: responds with a blank object and 204 status.

List all credit-cards for a customer

GET: /customer/:customerId/credit-card

OPTIONS: optional query parameters include: searchText.

RESPONSE: responds with an array of credit-card objects and a total count.

{
 "customerCreditCards": [{
  "id": "e804d4b3-e4e6-4a98-b395-4721d2002c77",
  "cardBrand": "Visa",
  "maskedCardNumber": "************1111",
  "expiryMo": 4,
  "expiryYr": 2027,
  "cardHolderName": "Jason Andres",
  "tokenOnFile": "Xt5EWLLDS7FJjR1c",
  "customerId": "9d30102b-afdf-42ca-9919-1500c730cac8",
  "isDefault": true,
  "createdAt": "2018-05-22T18:35:03.998Z",
  "updatedAt": "2018-05-22T18:35:03.998Z"
 }, {
  "id": "1c7eab39-8997-4da4-9f76-b8fb78d740bb",
  "cardBrand": "MasterCard",
  "maskedCardNumber": "************5454",
  "expiryMo": 10,
  "expiryYr": 2021,
  "cardHolderName": "Jason Andres",
  "tokenOnFile": "Zt5AFGLDS7FMjY1b",
  "customerId": "9d30102b-afdf-42ca-9919-1500c730cac8",
  "isDefault": false,
  "createdAt": "2018-05-22T17:51:31.177Z",
  "updatedAt": "2018-05-22T18:48:10.960Z"
 }],
 "total": 2
}