🔑 Getting an API Key
Navigate to Settings > Developer Setting
Complete your developer profile
🎉 Make your first request
Generate your first token
POST
https://api.krezypay.com/v1/sandbox/token
Body
The public key issued by the system
The secret key issued by the system
Response
{
"token_type": "Bearer",
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vYXBpLmtyZXp5cGF5LmNvbSIsImlhdCI6MTcyOTAyMTI2NCwiZXhwIjoxNzI5MTA3NjY0LCJ1c2VyX2lkIjoiRGZZOW82VDlSM2x5Z21qTjNwQXBWMXVXMjB4MTloSzEwd0NRNjJ4UzhNbmRsN2RJYnlpa1hmdmF6d1VjOHJCaWU0cU9FdHQ4Wm5nNmVjcTI3Rkc1YXI0anNoc3ZMbWI3ejRIMzUwUG9KazV1In0.Fg92V5ZK-eKqTPXP-kPehvechFGZOBcHlTvOwj9nYAI",
"expires_in": 86400
}
{
"error": "Invalid request"
}
See Examples Below
const url = 'https://api.krezypay.com/v1/sandbox/token';
const data = {
public_key: "pk_G85mdzusjlK...",
secret_key: "sk_7d03871lQ5..."
};
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => console.log(result))
.catch(error => console.error('Error:', error));
<?php
$url = 'https://api.krezypay.com/v1/sandbox/token';
$data = [
'public_key' => 'pk_G85mdzusjlKyUhA97oc4ter4Spk2I6aOF382cqznyZYmxtHpWJ0f6P3Mj5L0Rr7gXbuk15gfvEwoxi3970badlDn1CwqThVB264i8se9vN1Q',
'secret_key' => 'sk_7d03871lQ5LfE9ewcHdjr6b2oPtTZAbV8k0Mnu0p54Si21G6ONi9xxIhXzDmaqy465Fe9o4lt3YafwuBvyzKmchCgsqn7sWr1j83vJR2Upgk'
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
if ($response === false) {
echo 'Erreur cURL: ' . curl_error($ch);
} else {
echo 'Réponse: ' . $response;
}
curl_close($ch);
import requests
import json
url = 'https://api.krezypay.com/v1/sandbox/token'
data = {
"public_key": "pk_G85mdzusjlKyUhA97oc4ter4Spk2I6aOF382cqznyZYmxtHpWJ0f6P3Mj5L0Rr7gXbuk15gfvEwoxi3970badlDn1CwqThVB264i8se9vN1Q",
"secret_key": "sk_7d03871lQ5LfE9ewcHdjr6b2oPtTZAbV8k0Mnu0p54Si21G6ONi9xxIhXzDmaqy465Fe9o4lt3YafwuBvyzKmchCgsqn7sWr1j83vJR2Upgk"
}
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers, data=json.dumps(data))
if response.status_code == 200:
print('Réponse:', response.json())
else:
print(f'Erreur {response.status_code}: {response.text}')
Congrats, you've authenticated and made your first request!
Last updated