For Developers

Kepaid Payment API version 1.0

Implementing Kepaid Payment API is simple. The below documentation will give you full understanding on how to implement the Payment API on your platform.


To be eligible to use Kepaid Payment API you must have completed the above requirement. After you done registering for a Business Account and an API, you should have a KEPAID_NUMBER, TOKEN and an ACCESS_KEY Create a config.php file in your root directory and add the below code

// Config File
header("Cache-Control: no-cache, must-revalidate"); 
header("Pragma: no-cache"); //HTTP 1.0
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); 

$kepaid_number = "";  //YOUR KEPAID NUMBER
$website = $_SERVER['HTTP_HOST'];
$token = "";      //YOUR KEPAID TOKEN
$access_key = "";     //ACCESS KEY

$description = "$_POST[description]";    //PRODUCT NAME;
$amount = "$_POST[cost]";    //TOTAL COST OF PRODUCT
$currency = "$_POST[currency]";    //CURRENCY OF PRODUCT IN CAP

$data->access_key = $access_key;
$data->token = $token;
$data->description = $description;
$data->amount = $amount;
$data->currency = $currency;
$data->website = $website;
$dataout = json_encode($data);
echo $dataout;

Add the following javascript to your website either in global scope or in the checkout page.

        var cost = $(this).data("cost");
        var description = $(this).data("description");
        var currency = $(this).data("currency");
    url: "", //Link to your config file
    type: "post",
    data: {cost:cost, description:description, currency:currency},
    success: function(data){
            var response = JSON.parse(data);

$("iframe").attr("src", ""+response.token+
    display: "block",
    border: "none",
    height: "100vh",
    width: "100vw"

if (window.addEventListener) {
	window.addEventListener("message", handleMessage);
} else {
	window.attachEvent("onmessage", handleMessage);

function handleMessage(event) {
	console.log("Received a message from " + event.origin + ".");

	// When one window sends a message, or data, to another window via
	// `parent.postMessage()`, the message (the first argument) in the
	// `parent.postMessage()` call is accessible via `` here.
	var messageFromSender =;
	// Do something with the response.
	//If the payment was successfully 
           If(messageFromSender .message==”success”){
     //Hide iframe
	    display: "none"
	//Do something example: product reciept
   }else if(messageFromSender .message==”insufficient fund”){
	    display: "none"
	// Do something on payment error
// Do something.

Make sure to include the following attributes and their required values on your payment button:

data-cost="value should be cost of  product",  data-description="names of products being purchase",  data-currency="currency of product being purchase"

Add this class to your payment button


Add this iframe in your checkout page, make sure to remove at the beginning and closing of iframe. It will be used to display KePaid Payment interface

< iframe style='display: none'>< /iframe>

For assistance on implementing Kepaid API email us at