Saving Cards on File

Once a customer has been created you can easily store a card account on file for a specific customer making that card available for later charging.

Vaulted card accounts on file can be used for one-off payments, invoices, and recurring charges.

Vaulting Credit Card

To save a card on file the type, card number and expiration date are required.

Other fields that are available but optional are:

  • Name on card
  • Primary - setting it as primary easily identifies the customers preferred card if they have multiple on file.
  • Billing address
  • Alias - a custom name you set for the card.

Request

🚧

Vaulted Card Limit

You can only vault up to 10 cards on a customer in MX Merchant.

POST https://api.mxmerchant.com/checkout/v3/customercardaccount?id={{customerId}}

{
    "code":"card",
    "isDefault":true,
    "number":"4111111111111111",
    "expiryMonth":"04",
    "expiryYear":"23",
    "avsZip":"30004",
    "cvv":"928",
    "alias":"CustomerPrimeCard"
}

Response

{
    "isDefault": true,
    "id": 10000000000001,
    "created": "2020-07-14T17:29:22.983Z",
    "alias": "CustomerPrimeCard",
    "cardType": "Visa",
    "last4": "1111",
    "cardId": "XXXXXXXXXXXXXXXXXXXXXXXXXA1If",
    "token": "XXXXXXXXXXXXXXXXXXXXXXXXXXXX9UJI",
    "expiryMonth": "04",
    "expiryYear": "2023",
    "avsZip": "30004",
    "hasContract": false
}

The card token that you receive in the response from vaulting the card can be used to make transactions.


Did this page help you?