Payin API Documentation
Written by KalletPay Support Team
Last updated
Receiving money on your website is now easy with simple integration. This document will introduce you to all the basic information you need to better understand our technologies. To start receiving payment on your website, or you need to do is copy the html form code below to your website page
Get Your Merchant Key (Token)
To generate your Token (Merchant Key), navigate to the "Add New Website" option located at the top right corner of the integration page, fill out the form with the required details, and click on "Create Merchant". Finally, copy your Merchant Key provided for further use in your integration process.
Using HTML Form
<form method="POST" action="https://paywith.kalletpay.com/api/payment/merchant/create" >
<input type="hidden" name="token" value="MERCHANT_KEY" />
<input type="hidden" name="public_key" value="PUBLIC_KEY" />
<input type="hidden" name="callback_url" value="https://example.com/success" />
<input type="hidden" name="reference_code" value="REF_000001" />
<input type="hidden" name="amount" value="10000" />
<input type="hidden" name="email" value="[email protected]" />
<input type="hidden" name="first_name" value="John" />
<input type="hidden" name="last_name" value="Doe" />
<input type="hidden" name="title" value="Payment For Products" />
<input type="hidden" name="description" value="The description of entire payments" />
<input type="hidden" name="quantity" value="10" />
<input type="hidden" name="currency" value="NGN" />
<input type="submit" value="submit" />
</form>
Using Postman
Create Payment Request
USING --CURL--
curl --location --request POST https://paywith.kalletpay.com'/api/payment/create' \
--form 'token="MERCHANT_KEY"' \
--form 'public_key="PUBLIC_KEY"' \
--form 'callback_url="yourodmain.com/redirect"' \
--form 'reference_code="ref_1"' \
--form 'amount="10"' \
--form 'email="[email protected]"' \
--form 'first_name="jhone "' \
--form 'last_name="doe"' \
--form 'title="test payment"' \
--form 'description="payment description"' \
--form 'quantity="1"' \
--form 'currency="USD"'
USING --PHP--
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => https://paywith.kalletpay.com'/api/payment/create',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array(
'token' => 'MERCHANT_KEY',
'public_key' => 'PUBLIC_KEY',
'callback_url' => 'yourodmain.com/redirect',
'reference_code' => 'ref_1',
'amount' => '10',
'email' => '[email protected]',
'first_name' => 'jhone ',
'last_name' => 'doe',
'title' => 'test payment',
'description' => 'payment description',
'quantity' => '1',
'currency' => 'USD'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
USING --NodeJs - Request--
var request = require('request');
var options = {
'method': 'POST',
'url': https://paywith.kalletpay.com'/api/payment/create',
'headers': {
},
formData: {
'token': 'MERCHANT_KEY',
'public_key': 'PUBLIC_KEY',
'callback_url': 'https://yourdomain.com/success',
'reference_code': 'ref_1',
'amount': '10',
'email': '[email protected]',
'first_name': 'jhone ',
'last_name': 'doe',
'title': 'test payment',
'description': 'payment description',
'quantity': '1',
'currency': 'USD'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
USING --PYTHON--
import requests
url = https://paywith.kalletpay.com"/api/payment/create"
payload={'token': 'MERCHANT_KEY',
'public_key': 'PUBLIC_KEY',
'callback_url': 'https://yourdomain.com/success',
'reference_code': 'ref_1',
'amount': '10',
'email': '[email protected]',
'first_name': 'jhone ',
'last_name': 'doe',
'title': 'test payment',
'description': 'payment description',
'quantity': '1',
'currency': 'USD'}
files=[
]
headers = {}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
Successful Json Callback
{
"message": "Order Created Successfully",
"status": "success",
"redirect": "https://example.com/merchant/1/0fc073ef-73e9-42f1-9ebe-ca3383d1b37a",
"data": {
"user_id": 3,
"website_id": 1,
"currency_id": 4,
"reference_code": "REF_000002",
"amount": "1000",
"quantity": "5",
"meta": {
"title": "Payment for product purchasing",
"first_name": "John",
"last_name": "Deo",
"description": "The description of entire payments",
"callback_url": "https://example.com/success",
"ip_address": "127.0.0.1",
"user-agent": "PostmanRuntime/7.29.2"
},
"uuid": "0fc073ef-73e9-42f1-9ebe-ca3383d1b37a",
"updated_at": "2022-08-22T05:47:04.000000Z",
"created_at": "2022-08-22T05:47:04.000000Z",
"id": 1
}
}
Verifying Payment
Since relying solely on your callback URL is not fully secure, please ensure you verify the payment with our API before proceeding.
Please note: Payment verification is not available when using KalletPay in test mode.
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'https://paywith.kalletpay.com/api/payment/merchant/verify/{REFERENCE_KEY}/{SECRET_KEY}');
$result = curl_exec($ch);
curl_close($ch);
$obj=json_decode($result, true);
//Verify Payment
if (array_key_exists("data", $obj) && ($obj["status"] == "success")) {
echo 'success';
}
Successful Json Callback
{
"message": "The payment status is paid",
"status": "success",
"data": {
"id": 1,
"uuid": "e020c9cb-b35e-4ec7-97bb-5020bc5b5066",
"user_id": 2,
"website_id": 1,
"currency_id": 1,
"gateway_id": 3,
"trx": "tr_CAK8r7eY5z",
"reference_code": "REF-000001",
"amount": 100,
"charge": -28,
"rate": 1,
"quantity": 5,
"meta": {
"ip": "127.0.0.1",
"title": "Payment For Products",
"last_name": "Adhikary",
"first_name": "Bishwajit",
"user-agent": "PostmanRuntime/7.29.2",
"description": "test description",
"callback_url": "http://example.com/callback"
},
"paid_at": "2022-08-07 19:26:25",
"payment_status": 1,
"created_at": "2022-08-07T13:23:52.000000Z",
"updated_at": "2022-08-07T13:26:25.000000Z",
"website": {
"id": 1,
"user_id": 2,
"merchant_name": "Julie Little",
"token": "2YY3YQfcZbCOOnb8V5GvCAVR77AujpVf",
"email": "[email protected]",
"mode": 1,
"message": "Asperiores vel volup",
"created_at": "2022-08-07T13:08:56.000000Z",
"updated_at": "2022-08-07T13:21:25.000000Z"
}
}
}
Requirements
S/N VALUE TYPE REQUIRED DESCRIPTION
1. token string Yes Used to authorize a transaction
2. callback_url url Yes This is a callback endpoint you provide
3. reference_code string Yes This is the merchant reference tied to a transaction
5. amount int [Above 0.50 cents] Yes Cost of Item Purchased
6. email string Yes Email of Client making payment
7. first_name string, max:100 Yes First name of Client making payment
8. last_name string, max:100 Yes last name of Client making payment
9. title string, max:255 Yes Title of transaction
10. description string, max:1000 Yes Description of what transaction is for
11. currency string Yes This is the currency the transaction list should come in NGN
12. quantity int Yes Quantity of Item being paid for
Join KalletPay Today!
Thank you for taking the time to explore our Payin API Documentation. We hope you found it comprehensive and easy to understand. KalletPay is dedicated to providing seamless and secure payment solutions for your business needs.
By integrating KalletPay's API, you can:
Simplify your payment processes
Enhance security with robust features
Offer a seamless experience to your customers
Expand your business with multiple payment solutions
Ready to take the next step? Sign up with KalletPay today and start leveraging our innovative platform to streamline your transactions and grow your business.
Sign Up Now
Should you have any questions or need further assistance, our support team is here to help you every step of the way.
Welcome to a new era of payments with KalletPay!
Best regards,
The KalletPay Team