Payments testing
Last updated: April 29, 2022
Create a test token that you can use in future test payment requests, without having to process or store any sensitive information.
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.
post
https://api.sandbox.checkout.com/tokens
Header | Value |
---|---|
required |
This will be prefixed by pktest. |
required |
|
Information
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 American Express (4 digits). |
optional object | The payment source owner's billing address. |
optional object | The payment source owner's phone number. |
1{2"type": "card",3"number": "4543474002249996",4"expiry_month": 6,5"expiry_year": 2025,6"name": "John Smith",7"cvv": "956",8"billing_address": {9"address_line1": "123 High St.",10"address_line2": "Flat 456",11"city": "London",12"zip": "SW1A 1AA",13"country": "GB"14},15"phone": {16"country_code": "+44",17"number": "1234 567890"18}19}
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.
1{2"type": "card",3"token": "tok_ubfj2q76miwundwlk72vxt2i7q",4"expires_on": "2020-08-27T11:37:30Z",5"expiry_month": 6,6"expiry_year": 2025,7"scheme": "VISA",8"last4": "9996",9"bin": "454347",10"card_type": "CREDIT",11"card_category": "CONSUMER",12"issuer": "Test Bank",13"issuer_country": "US",14"product_id": "F",15"product_type": "CLASSIC",16"billing_address": {17"address_line1": "123 High St.",18"address_line2": "Flat 456",19"city": "London",20"zip": "SW1A 1AA",21"country": "GB"22},23"phone": {24"country_code": "+44",25"number": "1234 567890"26},27"name": "John Smith"28}
Create a payment request using the token you just received.