Payments testing
Create a token that represents a card's details that you can later use to request a test payment, without you having to process or store any sensitive information.
Step 1: Request a token
Exchange card details for a reference token that can be used later to request a card payment. Tokens are single use and expire after 15 minutes. To create a token, you'll need to authenticate using your public API key.
The request
Endpoint
https://api.sandbox.checkout.com/tokens
Header parameters
Header | Value |
---|---|
required |
|
required |
|
Body parameters
You can use any of our test cards' details in the body of your request.
Field name | Description |
---|---|
required string | Set this to |
required string | The card number. |
required integer | The expiry month of the card. |
required integer | The expiry year of the card. |
optional string | The cardholder's name. |
optional string | The card verification value/code. 3 digits, except for Amex (4 digits). |
optional object | The payment source owner's billing address. |
optional object | The payment source owner's phone number. |
Request example
{"type": "card","number": "4543474002249996","expiry_month": 6,"expiry_year": 2025,"name": "Bruce Wayne","cvv": "956","billing_address": {"address_line1": "Checkout.com","address_line2": "90 Tottenham Court Road","city": "London","state": "London","zip": "W1T 4TJ","country": "GB"},"phone": {"country_code": "+1","number": "415 555 2671"}}
The response
If your request was successful, you'll receive a 201 response containing a card token prefixed by tok_
. You then have 15 minutes to request a payment using this token.
Response example
{"type": "card","token": "tok_ubfj2q76miwundwlk72vxt2i7q","expires_on": "2020-08-27T11:37:30Z","expiry_month": 6,"expiry_year": 2025,"scheme": "VISA","last4": "9996","bin": "454347","card_type": "Credit","card_category": "Consumer","issuer": "GOTHAM STATE BANK","issuer_country": "US","product_id": "F","product_type": "CLASSIC","billing_address": {"address_line1": "Checkout.com","address_line2": "90 Tottenham Court Road","city": "London","state": "London","zip": "W1T 4TJ","country": "GB"},"phone": {"country_code": "+1","number": "415 555 2671"},"name": "Bruce Wayne"}
Step 2: Request a payment using the token
Create a payment request using the token you just received.