Create a card token

North America—United States and Canada

A card token is a unique, single-use code that represents a customer’s credit card details. It securely processes payments without exposing the actual card information or directly handling sensitive card information.

Prerequisites

  1. Set up a sandbox developer account.
  2. Create an app in the sandbox. See also Ecommerce app permissions.

Steps

  1. Generate a PAKMS key.
  2. Send a POST request to the /v1/tokens endpoint. See Create a card token.
  3. Enter information in the required fields.
FieldDescriptionRequire/Optional
numberCard primary account number (PAN). To minimize your app's payment card industry (PCI) compliance burden, use encrypted_pan instead.Required
encrypted_panEncrypted card primary account number (PAN). Optional
exp_monthCard expiration month in 2-digit format.
Format: mm
Required
exp_yearCard expiration year in 2- or 4-digit format.
Format: yy or yyyy
Required
cvvCard verification value (CVV). A 3-digit value printed on a card.Required
last4Last 4 numbers of the primary account number.Optional
first6First 6 numbers of the primary account number.Optional
country2-character country code.Optional
brandCard brand.Optional
nameCardholder's full name on the card.Optional
address_line1First line of the address. Can include the street address, PO box, or company name.Optional
address_line2Second line of the address. Can include the apartment, suite, unit, or building number.Optional
address_cityCity of the customer address. Can include district, suburb, town, or village.Optional
address_stateState of the customer address. Can include county, province, or region.Optional
address_zipState of the customer address. Can include county, province, or region.Optional
address_countryBilling address country, if provided.Optional
apikeyUniversally unique identifier (ID) of the API.Required

A single-use card token returns. The token is alphanumeric and begins with clv_. Example: clv_1ABCDefgHI23jKL4m5nOPqR

  1. Use the card token for a single payment for create a charge or pay for an order endpoint.

Request example

curl --request POST \
     --url https://token-sandbox.dev.clover.com/v1/tokens \
     --header 'accept: application/json' \
     --header 'apikey: 7aacxxxx-xxxx-xxxx-xxxx-xxxxxxxxcae2' \
     --header 'content-type: application/json' \
     --data '
{
  "card": {
    "brand": "MC",
    "number": "5000-0000-0000-1236",
    "exp_month": "12",
    "exp_year": "2025",
    "cvv": "121"
  }
}
'

Response example

{
  "id": "clv_1ABCDefgHI23jKL4m5nOPqR",
  "object": "token",
  "card": {
    "exp_month": "12",
    "exp_year": "2025",
    "first6": "542418",
    "last4": "3333",
    "brand": "VISA"
  }
}