# Payments testing Create a test token for test payment requests. This means you do not have to process or store any sensitive information. > **Note** > > Tokens are single use and expire after 15 minutes. --- ## How it works 1. Request a token. 2. [Create a payment request](https://www.checkout.com/docs/payments/accept-payments/accept-a-payment-using-the-payments-api.md#Request_a_payment_with_a_token) using the token ID from the Request a token response. 3. Optionally, raise a sanctions request for the payment to test responding to sanctions requests. See [Manage sanctions requests](https://www.checkout.com/docs/business-operations/compliance-requests/manage-sanctions-requests.md) for details. --- ## Request a token Call the [Request a token](https://api-reference.checkout.com/tag/Tokens/#operation/requestAToken) endpoint and authenticate using your public API key prefixed with pk*test*.. In the request body, provide the following details for any [test card](https://www.checkout.com/docs/testing/test-cards.md): - `type` – Set to `card`. - `number` – The card number - `expiry_month` - `expiry_year` Optionally, provide - `name` – The cardholder's name - `cvv` – The card verification value - `pin` – The first two digits of the card personal identification number (PIN) **Sandbox** `POST` `https://{prefix}.api.sandbox.checkout.com/tokens` ### Request example **Payload** ```json { "type": "card", "number": "4543474002249996", "expiry_month": 6, "expiry_year": 2025, "name": "John Smith", "cvv": "956", "billing_address": { "address_line1": "123 High St.", "address_line2": "Flat 456", "city": "London", "zip": "SW1A 1AA", "country": "GB" }, "phone": { "country_code": "+44", "number": "1234 567890" } } ``` **Node.js (Beta)** ```javascript import { Checkout } from 'checkout-node-sdk'; const cko = new Checkout('sk_XXXX', { pk: 'pk_YYYY' }); try { const token = await cko.tokens.request({ // infered type: "applepay" token_data: { version: 'EC_v1', data: 't7GeajLB9skXB6QSWfEpPA4WPhDqB7ekdd+F7588arLzve...', signature: 'MIAGCSqGbGUg...', header: { ephemeralPublicKey: 'MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgA...', transactionId: '3cee89679130a4b...', }, }, }); } catch (err) { console.log(err.name); } ``` ### Response example ```javascript { "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": "Test Bank", "issuer_country": "US", "product_id": "F", "product_type": "CLASSIC", "billing_address": { "address_line1": "123 High St.", "address_line2": "Flat 456", "city": "London", "zip": "SW1A 1AA", "country": "GB" }, "phone": { "country_code": "+44", "number": "1234 567890" }, "name": "John Smith" } ``` If successful, you receive a `201` response containing a card token prefixed with `tok_`. --- ## Respond to sanctions requests Create a card payout, bank payout, or ACH payment with the following details in the request body: - `amount` set to `3823` in minor currency - `recipient.first_name` set to `Jane` - `recipient.last_name` set to `Compliance` This automatically raises a sanctions request with a number of fields ready for review. Respond to the request with test data. In the sandbox environment, sanctions requests are not monitored. To test the flow with a released or blocked payment, reply with the case-insensitive value of `pass` or `fail` respectively in the `comments` field. **Sandbox** `POST` `https://{prefix}.api.sandbox.checkout.com/compliance-requests/{payment_id}` ### Request example ```json { "fields":{ "sender":[ { "name":"date_of_birth", "value":"2000-01-01", "not_available":false } ], "recipient":[ { "name":"country_of_origin", "not_available": true } ] }, "comments":"pass" } ```