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
Create an ecommerce app integration in the Global Developer Dashboard. See Get started with the Global Developer Dashboard.
Steps
- Generate a PAKMS key.
- Send a POST request to the /v1/tokens endpoint.
- Enter information in the required fields.
Field | Description | Require/Optional |
---|---|---|
number | Card primary account number (PAN). To minimize your app's payment card industry (PCI) compliance burden, use encrypted_pan instead. | Required |
encrypted_pan | Encrypted card primary account number (PAN). | Optional |
exp_month | Card expiration month in 2-digit format. Format: mm | Required |
exp_year | Card expiration year in 2- or 4-digit format. Format: yy or yyyy | Required |
cvv | Card verification value (CVV). A 3-digit value printed on a card. | Required |
last4 | Last 4 numbers of the primary account number. | Optional |
first6 | First 6 numbers of the primary account number. | Optional |
country | 2-character country code. | Optional |
brand | Card brand. | Optional |
name | Cardholder's full name on the card. | Optional |
address_line1 | First line of the address. Can include the street address, PO box, or company name. | Optional |
address_line2 | Second line of the address. Can include the apartment, suite, unit, or building number. | Optional |
address_city | City of the customer address. Can include district, suburb, town, or village. | Optional |
address_state | State of the customer address. Can include county, province, or region. | Optional |
address_zip | State of the customer address. Can include county, province, or region. | Optional |
address_country | Billing address country, if provided. | Optional |
apikey | Universally unique identifier (ID) of the API. | Required |
A single-use card token returns. The token is alphanumeric and begins with clv_. Example: clv_1ABCDefgHI23jKL4m5nOPqR
- 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"
}
}
Updated 28 days ago