Create Checkout Testing Token - Testing in Sandbox
Creates a CKO testing token for testing cards in Sandbox.
The /create_test_cko_token endpoint
generates a CKO testing token to test the CKO and Sila debit card integration. Exchange card details for a reference token that can be used later to request a card payment. Testing tokens are single use and expire after 15 minutes.
Testing
A debit card whose transactions will always be approved
Card number: 4659105569051157
A debit card whose transactions will always be declined
Card number: 4095254802642505
For both cards, expiry_month and expiry_year can vary.
Requests
The cko_public_key
key is required. This is your public key
from the Checkout.com dashboard, found under Developers->Keys.
The card_number
key is optional. If card_number is excluded, the request will default to 4659105569051157 (the card which will always be approved).
The expiry_month
key is optional, defaults to 12.
The expiry_year
key is required, defaults to next year.
Authorization / Authentication
Apps using Access Token Authorization
Use a valid access token in an Authorization: Bearer <token>
request header.
See Authenticating with an Access Token for more details.
Apps using ECDSA Authentication
Both authsignature
and usersignature
headers are required for this request. The usersignature header should be generated with a keypair registered to the user (either registered from the /register endpoint or the /register_wallet endpoint).
See the section on ECDSA Authentication for more detail about ECDSA signature generation.
POST /0.2/create_cko_testing_token HTTP/1.1
sandbox.silamoney.com
Content-Type: application/json
// if using OAuth2
Authorization: Bearer [GENERATED JWT TOKEN HERE]
// if using ECDSA
authsignature: [GENERATED AUTHSIGNATURE HEX STRING HERE]
usersignature: [GENERATED USERSIGNATURE HEX STRING HERE]
{
"header": {
"created": 1234567890,
"app_handle": "handle.silamoney.eth",
"user_handle":"user.silamoney.eth",
"reference": "<your unique id>"
},
"cko_public_key": "pk_sbox_nohsrdpc9cllxks34qukafb7xpk",
"card_number": 4659105569051157,
"expiry_month": 12,
"expiry_year": "2027
}
***
HTTP/1.1 200 OK
{
"success": true,
"status": "SUCCESS",
"token": "tok_3pule2bgszzujoiidpwupm52ve",
"message": "A testing token for card 4659105569051157 has been created.",
"reference": "51b9ca53-5eb8-4e98-bfe2-b9dd36a2c7d2",
"response_time_ms": "1709"
}
var payload: {
"header": {
"app_handle": "{{cko_app_handle}}"
},
"card_number": "4095254802642505",
"expiry_month": 12,
"expiry_year": 2027,
"cvv": 956,
"cko_public_key": "pk_sbox_i2uzy5w5nsllogfsc4xdscorcii"
},
const createTokenResponse = await sila.createCkoTestingToken(test.handle,test.payload);
// Success Response Object
{
"success": true,
"status": "SUCCESS",
"token": "tok_fmkalqnxkkquzpajtt7iz5hzou",
"message": "A testing token for card 4095254802642505 has been created.",
"reference": "aff92928-86bd-485b-8674-edbdfed54ec9",
"response_time_ms": "667"
}
payload = {
"user_handle": "user.silamoney.eth",
"card_name": "Your Card"
}
response = User.delete_card(silaApp, payload, eth_private_key)
### Success Response Object
{
'success': True,
'message': 'Card visa has been successfully deleted.',
'status': 'SUCCESS',
'status_code': 200
}
### Failure Response Object
{
status: 'FAILURE'
}
CreateCkoTestingTokenMessage message= CreateCkoTestingTokenMessage.builder()
.userHandle("user_handle")
.userPrivateKey("user_private_key")
.cardNumber("4659105569051157") // Optional
.expiryMonth(12) // Optional
.expiryYear(2027) // Optional
.ckoPublicKey("cko_public_key")
.build();
ApiResponse response = api.createCkoTestingToken(message);
// Success response
System.out.println(response.getStatusCode()); // 200
CreateCkoTestingTokenResponse parsedResponse = (CreateCkoTestingTokenResponse) response.getData();
System.out.println(parsedResponse.getSuccess());
System.out.println(parsedResponse.getReference()); // Random reference number
System.out.println(parsedResponse.getStatus()); // SUCCESS
System.out.println(parsedResponse.getToken()); // Token number
$userHandle = 'user.silamoney.eth';
$userPrivateKey = 'user private key';
$cardName = 'visa';
$response = self::$config->api->deleteCard($userHandle, $userPrivateKey, $cardName);
echo $response->getStatusCode();
echo $response->getData()->getStatus();
echo $response->getData()->getSuccess();
echo $response->getData()->getMessage();
ApiResponse<object> response = api.DeleteCard(userHandle, userPrivateKey, cardName);
// Success Response Object
Console.WriteLine(response.StatusCode); // 200
Console.WriteLine(((DeleteCardResult)response.Data).Reference); // Random reference number
Console.WriteLine(((DeleteCardResult)response.Data).Success); // true
Console.WriteLine(((DeleteCardResult)response.Data).Status); // SUCCESS
Console.WriteLine(((DeleteCardResult)response.Data).Message); // Card successfully deleted.
Key | Type | Description |
---|---|---|
header | JSON object | Required. Requires these keys in JSON format: created, auth_handle, user_handle. See the /check_handle endpoint for the complete list of fields in this object. |
cko_public_key | String | Required. This is your public key from the Checkout.com dashboard, found under Developers->Keys. |
card_number | Integer | Optional. If not card_number is not included, card_number will default to 4659105569051157 |
expiry_month | Integer | Optional. Two digits, defaults to 12. |
expiry_year | Integer | Optional. Four digits, defaults to next year. |
Responses
Status Code | success Attribute | Description |
---|---|---|
200 | true | 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. |
Updated 12 months ago