All requests to the KalletPay API are sent via the HTTP POST method to one of our API endpoint URLs.
Register as a merchant in our system. In your merchant dashboard you will find the option for API access key.
Example access key : 51a4bd18-5bc1-4eaa-97b0-c09323398883
The following example code enables you to initiate a payment,depending on how you structure it. The perameter details are also below.
Param Name | Param Type | Description |
---|---|---|
custom | string | Identification of your end Required |
currency_code | string | Enter currency code eg. USD, NGN, MYR Required |
amount | decimal | The amount you want to transaction Required |
details | string | Purchase details Required |
web_hook | string | Instant payment notification url Required |
cancel_url | string | Payment cancel return url Required |
success_url | string | Payment success return url Required |
customer_email | string | Customer email address Required |
access_key | string | Send access_key as bearer token with header Required |
<?php
$parameters = [
'custom' => 'DFU80XZIKS',
'currency_code' => 'USD',
'amount' => 280.00,
'details' => 'Digital Product',
'web_hook' => 'http://yoursite.com/web_hook.php',
'cancel_url' => 'http://yoursite.com/cancel_url.php',
'success_url' => 'http://yoursite.com/success_url.php',
'customer_email' => '[email protected]',
];
$url = 'http://yourwallet.com/payment/process';
$headers = [
"Accept: application/json",
"Authorization: Bearer access_key",
"checksum: hash_hmac('sha512', json_encode($parameters), access_key)
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($parameters));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
?>
//Success Response.
{
"code": 200,
"status": "ok",
"payment_id": "AIYmQIOAz0GlmsjfhgiOeu304",
"message": "Your payment has been processed. Please follow the URL to complete the payment.",
"url":"https://kallets.com/process-checkout?payment_id=AIYmQIOAz0GlmsjfhgiOeu304"
}
//Error Response.
{
"code": 401,
"status": "error",
"message": "Invalid API credentials."
}
//Success Response.
{
"code": 200,
"status": "ok",
"payment_id": "AIYmQIOAz0GlmsjfhgiOeu304",
"transaction": "AIYmQIOAz0G",
"amount": 100.00,
"charge": 5.00,
"currency": "USD",
"custom": "BVSUZ545XCS",
"date" : "22-05-2022"
}
You can verify the payment whether it is valid or not. After successful payment transaction you will have the response where you find the Payment ID. With this payment id and your access key you need make a request to our server for verify the payment. Example code is below.
Payment verify end point : https://kallets.com/payment/check-validity
<?php
$parameters = [
'payment_id' => 'AIYmQIOAz0GlmsjfhgiOeu304',
]
$url = 'https://kallets.com/payment/check-validity';
$headers = [
"Accept: application/json",
"Authorization: Bearer access_key",
"checksum: hash_hmac('sha512', json_encode($parameters), access_key)
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
?>
//Success Response.
{
"code": 200,
"status": "ok",
"message": "Transaction is valid",
}
//Error Response.
{
"code": 401,
"status": "error",
"message": "Invalid API credentials."
}
//or
{
"code": 404,
"status": "error",
"message": "Transaction not found"
}
Following currencies are currently supported in our system. It may update furthur.
Currency Name | Currency Symbol | Currency Code |
---|---|---|
United State Dollar | $ | USD |
Nigerian naira | ₦ | NGN |