Introduction
Welcome to the GoSmartVoucher API. Use these endpoints to redeem vouchers, check balances, and manage payments securely.
Authentication
All requests require a Bearer token in the Authorization
header:
Authorization: Bearer YOUR_API_KEY
💡 You can generate API keys from your GoSmartVoucher dashboard.
Voucher APIs
Retrieve Voucher
GET
Get details of a voucher using its code.
PHP cURL Example
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.gosmartvoucher.com/v1/vouchers/12345");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer YOUR_API_KEY"
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
Response
{
"status": true,
"code": "200",
"message": "Voucher retrieved successfully",
"data": {
"voucher_code": "12345",
"amount": 5000,
"currency": "NGN",
"status": "unused"
}
}
Redeem Voucher
POST
Redeem a voucher for payment or balance credit.
PHP cURL Example
<?php
$ch = curl_init();
$data = [
"voucher_code" => "12345"
];
curl_setopt($ch, CURLOPT_URL, "https://api.gosmartvoucher.com/v1/vouchers/redeem");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer YOUR_API_KEY",
"Content-Type: application/json"
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
Response
{
"status": true,
"code": "201",
"message": "Voucher redeemed successfully",
"data": {
"voucher_code": "12345",
"amount": 5000,
"currency": "NGN",
"status": "redeemed"
}
}
Error Codes
❌ 401 Unauthorized: Missing or invalid API key.
❌ 404 Not Found: Voucher code does not exist.
❌ 409 Conflict: Voucher already redeemed.