shell php python java nodejs

Introduction

Welcome to FléxPay Developers! Here at FléxPay, we're thrilled to have you on board as part of our innovative community.

FléxPay offers a cutting-edge set of Application Programming Interfaces (APIs) designed to seamlessly integrate FléxPay functionality into your projects. Our APIs are top-of-the-line, boasting state-of-the-art security modules and structures meticulously crafted to meet the demands of the market.

We're eager to collaborate with you to pioneer the next generation of applications using FléxPay's proprietary APIs. Each step in this journey is crucial, from identifying a use case that aligns with your requirements to successfully launching your project to your valued customers.

To tap into the full potential of FléxPay's API endpoints for services such as Utility Payments, Wallet Cash-in, and Flexsend, all you need to do is reach out to our dedicated teams at frontdesk@flex.co.tz. Our Developer Zone is equipped with language bindings in PHP, Java, Python, and Shell. You'll find code examples conveniently located on the right side of the panel, and switching between programming languages is a breeze with our user-friendly tabs.

FléxPay offers comprehensive solutions spanning various domains, including booking, e-commerce, ERP, and payroll. With FléxPay, the possibilities are endless!

Let's embark on this exciting journey together and unlock the full potential of FléxPay APIs.

Authentication

To authorize, use this code:

require 'FléxPay'

api = FléxPay::APIClient.authorize!('flexclientkey')
import FléxPay

api = FléxPay.authorize('flexclientkey')
# With shell, you can just pass the correct header with each request
curl "api_endpoint_here" \
  -H "Authorization: flexclientkey"curl "api_endpoint_here"
  -H "Content-type: application/json"
  -H "Authorization: FléxPay flexclientkey"
  -H "Digest-Method: HS256"
  -H "Digest: tW32A+O1FcpRj2o2mbWgF2r+vmILqqKwHqDryj+7lvI="
  -H "Timestamp: 2019-02-26T09:30:46+03:00"
  -H "Signed-Fields: utilityref,vendor,pin,transid,amount,msisdn"
  -d  '{"vendor":"BANKX", "pin":"3333", "utilityref":"075XXXXXXX", "transid":"T001", "amount":"1234", "msisdn":"25568XXXXXXX"}'

const FléxPay = require('FléxPay');

let api = FléxPay.authorize('flexclientkey');
const FléxPay = require('FléxPay');

let api = FléxPay.authorize('flexclientkey');

Make sure to replace flexclientkey with your API key.

FléxPay employs a secure access mechanism using API keys and API secrets to grant access to our APIs. For detailed information on obtaining access credentials, please don't hesitate to contact our dedicated business team.

Furthermore, it's essential to include the following HTTP headers in all API requests to the FléxPay API Gateway, whether it's a GET or POST request:

Authorization: This header should contain the API key and API secret for authentication purposes. Content-Type: Indicates the media type of the resource being sent to the server. It's crucial to specify the appropriate content type for the request payload. Accept: Specifies the media types that are acceptable for the response. This helps the server understand the client's preferences regarding the format of the response data. Ensuring these headers are included in your API requests will facilitate smooth communication with the FléxPay API Gateway and help maintain security and compatibility across your interactions with our APIs.

For any further assistance or inquiries regarding API access and usage, feel free to reach out to our business team, who will be more than happy to assist you.

Authorization: flexclientkey

Purchase API

This functionality enables you to utilize FléxPay's payment gateway for a comprehensive ecommerce checkout process, supporting various payment methods such as Debit/Credit cards (Master, VISA, Amex), Mobile Money pull payments, etc.

Place New Order

require_once __DIR__ .'/vendor/autoload.php';

// use selcom  client module
use Selcom\ApigwClient\Client;

// initalize a new Client instace with values of the base url, api key and api secret

$apiKey = '202cb962ac59075b964b07152d234b70';
$apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
$baseUrl = "http://example.com";

$client = new Client($baseUrl, $apiKey, $apiSecret);

// data
$orderArray = array(
    "vendor"=>"VENDORTILL",
    "order_id"=>"85gh9p7l8",
    "buyer_email"=> "john@example.com",
    "buyer_name"=> "John Joh",
    "buyer_userid"=> "",
    "buyer_phone"=> "255xxxxxxxxx",
    "gateway_buyer_uuid"=> "",
    "amount"=>  8000,
    "currency"=>"TZS",
    "payment_methods"=>"ALL",
    "redirect_url"=>"aHR0cHM6Ly9leGFtcGxlLmNvbS8=",
    "cancel_url"=>"aHR0cHM6Ly9leGFtcGxlLmNvbS8=",
    "webhook"=>"aHR0cHM6Ly9leGFtcGxlLmNvbS8=",
    "billing.firstname" => "John",
    "billing.lastname" => "Doe",
    "billing.address_1" => "969 Market",
    "billing.address_2" => "",
    "billing.city" => "San Francisco",
    "billing.state_or_region" => "CA",
    "billing.postcode_or_pobox" => "94103",
    "billing.country" => "US",
    "billing.phone" => "255xxxxxxxxx",
    "shipping.firstname" => "John",
    "shipping.lastname" => "Doe",
    "shipping.address_1" => "969 Market",
    "shipping.address_2" => "",
    "shipping.city" => "San Francisco",
    "shipping.state_or_region" => "CA",
    "shipping.postcode_or_pobox" => "94103",
    "shipping.country" => "US",
    "shipping.phone" => "255xxxxxxxxx",
    "buyer_remarks"=>"None",
    "merchant_remarks"=>"None",
    "no_of_items"=>  3
    );

// path relatiive to base url
$orderPath = "/v1/checkout/create-order";

// create order
$response = $client->postFunc($orderPath,$orderArray)
#import package
from selcom_apigw_client import apigwClient

# initalize a new Client instace with values of the base url, api key and api secret
apiKey = '202cb962ac59075b964b07152d234b70'
apiSecret = '81dc9bdb52d04dc20036dbd8313ed055'
baseUrl = "http://example.com"

client = apigwClient.Client(baseUrl, apiKey, apiSecret)

#data
orderDict = {
"vendor":"VENDORTILL",
    "order_id":"85gh9p7l8",
    "buyer_email": "john@example.com",
    "buyer_name": "John Joh",
    "buyer_userid": "",
    "buyer_phone": "255xxxxxxxxx",
    "gateway_buyer_uuid": "",
    "amount":  8000,
    "currency":"TZS",
    "payment_methods":"ALL",
    "redirect_url":"aHR0cHM6Ly9leGFtcGxlLmNvbS8=",
    "cancel_url":"aHR0cHM6Ly9leGFtcGxlLmNvbS8=",
    "webhook":"aHR0cHM6Ly9leGFtcGxlLmNvbS8=",
    "billing.firstname" : "John",
    "billing.lastname" : "Doe",
    "billing.address_1" : "969 Market",
    "billing.address_2" : "",
    "billing.city" : "San Francisco",
    "billing.state_or_region" : "CA",
    "billing.postcode_or_pobox" : "94103",
    "billing.country" : "US",
    "billing.phone" : "255xxxxxxxxx",
    "shipping.firstname" : "John",
    "shipping.lastname" : "Doe",
    "shipping.address_1" : "969 Market",
    "shipping.address_2" : "",
    "shipping.city" : "San Francisco",
    "shipping.state_or_region" : "CA",
    "shipping.postcode_or_pobox" : "94103",
    "shipping.country" : "US",
    "shipping.phone" : "255xxxxxxxxx",
    "buyer_remarks":"None",
    "merchant_remarks":"None",
    "no_of_items":  3
}
#path relatiive to base url
orderPath = "/v1/checkout/create-order"

#crate new order
response = client.postFunc(orderPath, orderDict)
# With shell, you can just pass the correct header with each request
curl -X POST 'http://example.com/v1/checkout/create-order' \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Authorization: SELCOM {authorization-token}" \
  -H "Digest-Method: {digest-token}" \
  -H "Digest: {digest}" \
  -H "Timestamp: {timestamp in yyyy-dd-mm H:i:s format}" \
  -H "Signed-Fields: vendor,order_id,buyer_email,buyer_name,buyer_user_id,buyer_phone,buyer_gateway_token,amount,currency,payment_methods,redirect_url,cancel_url,webhook,billing.firstname,billing.lastname,billing.address_1,billing.address_2,billing.city,billing.state_or_region,billing.postcode_or_pobox,billing.country,billing.email, billing.phone,shipping.firstname,shipping.lastname,shipping.address_1, shipping.address_2,shipping.city,shipping.state_or_region,shipping.country,shipping.email,shipping.phone,payer_remarks,merchant_remarks,no_of_items_items" \
  -d '{
  "vendor":"12323232",
  "order_id":"121212",
  "buyer_email": "",
  "buyer_name": "",
  "buyer_user_id": "",
  "buyer_phone": "",
  "gateway_buyer_uuid": "",
  "amount":  8000,
  "currency":"TZS",
  "payment_methods":"ALL",
  "redirect_url":"URL",
  "cancel_url":"URL",
  "webhook":"URL",
  "billing":   {
    "firstname" : "John",
    "lastname" : "Doe",
    "address_1" : "969 Market",
    "address_2" : "",
    "city" : "San Francisco",
    "state_or_region" : "CA",
    "postcode_or_pobox" : "94103",
    "country" : "US",
    "phone" : "255082852526"
  },
  "shipping":   {
    "firstname" : "John",
    "lastname" : "Doe",
    "address_1" : "969 Market",
    "address_2" : "",
    "city" : "San Francisco",
    "state_or_region" : "CA",
    "postcode_or_pobox" : "94103",
    "country" : "US",
    "phone" : "255082852526"
  },
  "buyer_remarks":"None",
  "merchant_remarks":"None",
  "no_of_items":  3

}'

import io.github.selcompaytechltd.ApigwClient;
import java.util.Map;
import com.google.gson.*;

String apiKey = '202cb962ac59075b964b07152d234b70';
String apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
String baseUrl = "http://example.com";



// initalize a new Client instace with values of the base url, api key and api secret
Client client = new ApigwClient(baseUrl,apiKey,apiSecret);

// path relatiive to base url
String orderPath = "/v1/checkout/create-order";

// data
JsonObject orderDict = new JsonObject();
orderDict.addProperty("vendor","VENDORTILL");
orderDict.addProperty("order_id","1218d00Y");
orderDict.addProperty("buyer_email", "john@example.com");
orderDict.addProperty("buyer_name", "John Joh");
orderDict.addProperty("buyer_userid", "");
orderDict.addProperty("buyer_phone", "255xxxxxxxxxx");
orderDict.addProperty("gateway_buyer_uuid", "");
orderDict.addProperty("amount",  8000);
orderDict.addProperty("currency","TZS");
orderDict.addProperty("payment_methods","ALL");
orderDict.addProperty("redirect_url","aHR0cHM6Ly9leGFtcGxlLmNvbS8=");
orderDict.addProperty("cancel_url","aHR0cHM6Ly9leGFtcGxlLmNvbS8=");
orderDict.addProperty("webhook","aHR0cHM6Ly9leGFtcGxlLmNvbS8=");
orderDict.addProperty("billing.firstname" , "John");
orderDict.addProperty("billing.lastname" , "Doe");
orderDict.addProperty("billing.address_1" , "969 Market");
orderDict.addProperty("billing.address_2" , "");
orderDict.addProperty("billing.city" , "San Francisco");
orderDict.addProperty("billing.state_or_region" , "CA");
orderDict.addProperty("billing.postcode_or_pobox" , "94103");
orderDict.addProperty("billing.country" , "US");
orderDict.addProperty("billing.phone" , "255xxxxxxxxx");
orderDict.addProperty("shipping.firstname" , "John");
orderDict.addProperty("shipping.lastname" , "Doe");
orderDict.addProperty("shipping.address_1" , "969 Market");
orderDict.addProperty("shipping.address_2" , "");
orderDict.addProperty("shipping.city" , "San Francisco");
orderDict.addProperty("shipping.state_or_region" , "CA");
orderDict.addProperty("shipping.postcode_or_pobox" , "94103");
orderDict.addProperty("shipping.country" , "US");
orderDict.addProperty("shipping.phone" , "255xxxxxxxxx");
orderDict.addProperty("buyer_remarks","None");
orderDict.addProperty("merchant_remarks","None");
orderDict.addProperty("no_of_items",  3);


//post data
JsonObject response = client.postFunc(orderPath ,orderDict);
//import package
const {apigwClient } = require("selcom-apigw-client");

// initalize a new Client instace with values of the base url, api key and api secret
const apiKey = '202cb962ac59075b964b07152d234b70';
const apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
const baseUrl = "http://example.com"

const client = new apigwClient(baseUrl, apiKey, apiSecret);

//data
var orderJson = {
    "vendor":"VENDORTILL",
    "order_id":"85gh9p7l8",
    "buyer_email": "john@example.com",
    "buyer_name": "John Joh",
    "buyer_userid": "",
    "buyer_phone": "255xxxxxxxxx",
    "gateway_buyer_uuid": "",
    "amount":  8000,
    "currency":"TZS",
    "payment_methods":"ALL",
    "redirect_url":"aHR0cHM6Ly9leGFtcGxlLmNvbS8=",
    "cancel_url":"aHR0cHM6Ly9leGFtcGxlLmNvbS8=",
    "webhook":"aHR0cHM6Ly9leGFtcGxlLmNvbS8=",
    "billing.firstname" : "John",
    "billing.lastname" : "Doe",
    "billing.address_1" : "969 Market",
    "billing.address_2" : "",
    "billing.city" : "San Francisco",
    "billing.state_or_region" : "CA",
    "billing.postcode_or_pobox" : "94103",
    "billing.country" : "US",
    "billing.phone" : "255xxxxxxxxx",
    "shipping.firstname" : "John",
    "shipping.lastname" : "Doe",
    "shipping.address_1" : "969 Market",
    "shipping.address_2" : "",
    "shipping.city" : "San Francisco",
    "shipping.state_or_region" : "CA",
    "shipping.postcode_or_pobox" : "94103",
    "shipping.country" : "US",
    "shipping.phone" : "255xxxxxxxxx",
    "buyer_remarks":"None",
    "merchant_remarks":"None",
    "no_of_items":  3
  }
// path relatiive to base url
var orderPath = "/v1/checkout/create-order"

//crate new order
var = orderRespose = client.postFunc(orderPath, orderJson)

Create a new order post checkout from your ecommerce website. Any card payments submitted without billing information will be rejected.All URLs in the request and response must be encoded using Base64.

HTTP Request

POST http://example.com/v1/checkout/create-order

JSON Payload Parameters

Parameter Type Example Description
vendor Mandatory SHOP203 Vendor/Merchant ID allocated by FléxPay
order_id Mandatory 123 Order id that uniquely identifies the order
buyer_email Mandatory customer@example.com Buyer email
buyer_name Mandatory Joe John Buyer's full name
buyer_userid Optional joejohn20 Buyer's unique user-id in the third-party ecommerce website. Should be empty for guest check
buyer_phone Mandatory 255781234XXX Buyer's msisdn
gateway_buyer_uuid Optional A1233232 Used to display stored card in the payment process. The field is returned first time the user creates an order
amount Mandatory 5000 Order amount
currency Mandatory TZS International currency code TZS, USD
payment_methods Mandatory ALL Has to be comma separated list of ALL, MASTERPASS, CARD, MOBILEMONEYPULL
redirect_url Optional aHR0cDovL3VybC5jb20= Base64 encoded third-party ecommerce page URL that the customer should be redirected after payment process is complete
cancel_url Optional aHR0cDovL3VybC5jb20= Base64 encoded third-party ecommerce page URL that the customer should be redirected when payment process canceled by the buyer
webhook Optional aHR0cDovL3VybC5jb20= Base64 encoded webhook callback URL to receive API callback of the payment status
billing.firstname Mandatory Joe First name - Payment Billing info
billing.lastname Mandatory John Last name - Payment Billing info
billing.address_1 Mandatory 23, street X Address 1 - Payment Billing info
billing.address_2 Optional Upanga Area Address 2 - Payment Billing info
billing.city Mandatory Dar es salaam City - Payment Billing info
billing.state_or_region Mandatory Dar es Salaam Region - Payment Billing info
billing.postcode_or_pobox Mandatory 43434 PO Box- Payment Billing info
billing.country Mandatory TZ International Country code - Payment Billing info
billing.phone Mandatory 25578123XXXX Phone - Payment Billing info
shipping.firstname Optional Joe First name - Payment Billing info
shipping.lastname Optional John Last name - Payment Billing info
shipping.address_1 Optional 23, street X Address 1 - Payment Billing info
shipping.address_2 Optional Upanga Area Address 2 - Payment Billing info
shipping.city Optional Dar es salaam City - Payment Billing info
shipping.state_or_region Optional Dar es Salaam Region - Payment Billing info
shipping.postcode_or_pobox Optional 43434 PO Box- Payment Billing info
shipping.country Optional TZ International Country code - Payment Billing info
shipping.phone Optional 25578123XXXX Phone - Payment Billing info
buyer_remarks Optional 255781234567 Payer remark/description for the order
merchant_remarks Optional 255781234567 Buyer remark/description for the order
no_of_items Mandatory 255781234567 Number of items in the order
header_colour Optional #FF0012 Payment gateway page header colour
link_colour Optional #FF0012 Payment gateway page link text colour
button_colour Optional #FF0012 Payment gateway page button colour
expiry Optional 60 Expiry in minutes

Create Order (Minimal)

require_once __DIR__ .'/vendor/autoload.php';

// use FléxPay client module
use FléxPay\ApigwClient\Client;

// initalize a new Client instace with values of the base url, api key and api secret

$apiKey = '202cb962ac59075b964b07152d234b70';
$apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
$baseUrl = "http://example.com";

$client = new Client($baseUrl, $apiKey, $apiSecret);

// data
$orderMinArray = array(
    "vendor"=>"VENDORTILL",
    "order_id"=>"85gh9p7l8",
    "buyer_email"=> "john@example.com",
    "buyer_name"=> "John Joh",
    "buyer_phone"=> "255xxxxxxxxx",
    "amount"=>  8000,
    "currency"=>"TZS",
    "redirect_url"=>"aHR0cHM6Ly9leGFtcGxlLmNvbS8=",
    "cancel_url"=>"aHR0cHM6Ly9leGFtcGxlLmNvbS8=",
    "webhook"=>"aHR0cHM6Ly9leGFtcGxlLmNvbS8=",
    "buyer_remarks"=>"None",
    "merchant_remarks"=>"None",
    "no_of_items"=>  3
    );

// path relatiive to base url
$orderMinPath = "/v1/checkout/create-order-minimal";

// create order minimal
$response = $client->postFunc($orderMinPath,$orderMinArray);')
#import package
from FléxPay_apigw_client import apigwClient

# initalize a new Client instace with values of the base url, api key and api secret
apiKey = '202cb962ac59075b964b07152d234b70'
apiSecret = '81dc9bdb52d04dc20036dbd8313ed055'
baseUrl = "http://example.com"

client = apigwClient.Client(baseUrl, apiKey, apiSecret)

#data
orderDict = {
"vendor":"VENDORTILL",
"order_id":"1218d5Qb",
"buyer_email": "john@example.com",
"buyer_name": "John Joh",
"buyer_phone": "255082555555",
"amount":  8000,
"currency":"TZS",
"buyer_remarks":"None",
"merchant_remarks":"None",
"no_of_items":  1
}
#path relatiive to base url
orderPath = "/v1/checkout/create-order-minimal"

#crate new order
response = client.postFunc(orderPath, orderDict)
# With shell, you can just pass the correct header with each request
curl -X POST 'http://example.com/v1/checkout/create-order-minimal' \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Authorization: FléxPay {authorization-token}" \
  -H "Digest-Method: {digest-token}" \
  -H "Digest: {digest}" \
  -H "Timestamp: {timestamp in yyyy-dd-mm H:i:s format}" \
  -H "Signed-Fields: vendor,order_id,buyer_email,buyer_name,buyer_user_id,buyer_phone,amount,currency,payment_methods,webhook,payer_remarks,merchant_remarks,order_items" \
  -d '{
  "vendor":"12323232",
  "order_id":"121212",
  "buyer_email": "john@example.com",
  "buyer_name": "John Joh",
  "buyer_phone": "255682XXXXXX",
  "amount":  8000,
  "currency":"TZS",
  "webhook":"https://merchantdomain.com/process-order/121212",
  "buyer_remarks":"None",
  "merchant_remarks":"None",
  "no_of_items":  1

}'

//import FléxPay client package
import io.github.FléxPaypaytechltd.ApigwClient;
import java.util.Map;
import com.google.gson.*;

String apiKey = '202cb962ac59075b964b07152d234b70';
String apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
String baseUrl = "http://example.com";



// initalize a new Client instace with values of the base url, api key and api secret
Client client = new ApigwClient(baseUrl,apiKey,apiSecret);

// path relatiive to base url
String orderPath = "/v1/checkout/create-order-minimal";

// data
JsonObject orderDict = new JsonObject();
orderDict.addProperty("vendor","VENDORTILL");
orderDict.addProperty("order_id","1218d00Y");
orderDict.addProperty("buyer_email", "john@example.com");
orderDict.addProperty("buyer_name", "John Joh");
orderDict.addProperty("buyer_phone", "255082555555");
orderDict.addProperty("amount",  8000);
orderDict.addProperty("currency","TZS");
orderDict.addProperty("buyer_remarks","None");
orderDict.addProperty("merchant_remarks","None");
orderDict.addProperty("no_of_items", 1 );

//post data
JsonObject response = client.postFunc(orderPath ,orderDict);

//import package
const {apigwClient } = require("FléxPay-apigw-client");

// initalize a new Client instace with values of the base url, api key and api secret
const apiKey = '202cb962ac59075b964b07152d234b70';
const apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
const baseUrl = "http://example.com"

const client = new apigwClient(baseUrl, apiKey, apiSecret);

//data
var orderJson = {
"vendor":"VENDORTILL",
"order_id":"1218d5Qb",
"buyer_email": "john@example.com",
"buyer_name": "John Joh",
"buyer_phone": "255082555555",
"amount":  8000,
"currency":"TZS",
"buyer_remarks":"None",
"merchant_remarks":"None",
"no_of_items":  1
}
// path relatiive to base url
var orderPath = "/v1/checkout/create-order-minimal"

//crate new order
var = orderRespose = client.postFunc(orderPath, orderJson);

Create a new order post checkout from your ecommerce website for non-card payments. This api cannot be used for card payments. Card payment option wont be displayed on the payment gateway page after redirection. Ideal for mobile wallet push payments and manual payments when merchant is capable of presenting the payment token or qr code to the customer. Note: All urls in the request and response are base64 encoded.

HTTP Request

POST http://example.com/v1/checkout/create-order-minimal

JSON Payload Parameters

Parameter Type Example Description
vendor Mandatory SHOP203 Vendor/Merchant ID allocated by FléxPay
order_id Mandatory 123 Unique identifier for the order
buyer_email Mandatory customer@example.com Email address of the buyer
buyer_name Mandatory Joe John Full name of the buyer
buyer_phone Mandatory 255781234XXX Phone number of the buyer
amount Mandatory 5000 Total amount of the order
currency Mandatory TZS Currency code (e.g., TZS, USD)
redirect_url Optional aHR0cDovL3VybC5jb20= Base64 encoded URL for redirection after payment process is complete
cancel_url Optional aHR0cDovL3VybC5jb20= Base64 encoded URL for redirection when payment process is canceled by the buyer
webhook Optional aHR0cDovL3VybC5jb20= Base64 encoded URL for webhook callback to receive API callback of the payment status
buyer_remarks Optional 255781234567 Remarks/description provided by the payer for the order
merchant_remarks Optional 255781234567 Remarks/description provided by the buyer for the order
no_of_items Mandatory 255781234567 Number of items in the order
header_colour Optional #FF0012 Color code for the payment gateway page header
link_colour Optional #FF0012 Color code for the payment gateway page link text
button_colour Optional #FF0012 Color code for the payment gateway page button
expiry Optional 60 Expiry time in minutes for the order

Cancel Order

require_once __DIR__ .'/vendor/autoload.php';

// use FléxPay client module
use FléxPay\ApigwClient\Client;

// initalize a new Client instace with values of the base url, api key and api secret

$apiKey = '202cb962ac59075b964b07152d234b70';
$apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
$baseUrl = "http://example.com";

$client = new Client($baseUrl, $apiKey, $apiSecret);

// data
$orderCancelArray = array("order_id"=>"85gh9p7l8");

// path relatiive to base url
$orderCancelPath = "/v1/checkout/cancel-order";

// cancel order
$response = $client->deleteFunc($orderCancelPath,$orderCancelArray);

#import package
from FléxPay_apigw_client import apigwClient

# initalize a new Client instace with values of the base url, api key and api secret
apiKey = '202cb962ac59075b964b07152d234b70'
apiSecret = '81dc9bdb52d04dc20036dbd8313ed055'
baseUrl = "http://example.com"

client = apigwClient.Client(baseUrl, apiKey, apiSecret)

#data
orderCancelDict = {
"order_id":"1218d00Y"
}
#path relatiive to base url
orderCancelPath = "/v1/checkout/cancel-order"

#crate new orderCancel
response = client.deleteFunc(orderCancelPath, orderCancelDict)
curl -X DELETE 'http://example.com/v1/checkout/cancel-order?order_id={order_id}' \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Authorization: FléxPay {authorization-token}" \
  -H "Digest-Method: {digest-token}" \
  -H "Digest: {digest}" \
  -H "Timestamp: {timestamp in yyyy-dd-mm H:i:s format}" \
  -H "Signed-Fields: order_id"


//import FléxPay client package
import io.github.FléxPaypaytechltd.ApigwClient;
import java.util.Map;
import com.google.gson.*;

String apiKey = '202cb962ac59075b964b07152d234b70';
String apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
String baseUrl = "http://example.com";



// initalize a new Client instace with values of the base url, api key and api secret
Client client = new ApigwClient(baseUrl,apiKey,apiSecret);

// path relatiive to base url
String orderCancelPath = "/v1/checkout/cancel-order";

// data
JsonObject orderCancelDict = new JsonObject();
orderCancelDict.addProperty("order_id","1218d00Y");


//post data
JsonObject response = client.deleteFunc(orderCancelPath ,orderCancelDict);
//import package
const {apigwClient } = require("FléxPay-apigw-client");

// initalize a new Client instace with values of the base url, api key and api secret
const apiKey = '202cb962ac59075b964b07152d234b70';
const apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
const baseUrl = "http://example.com"

const client = new apigwClient(baseUrl, apiKey, apiSecret);

//data
var orderCancelJson = {
"order_id":"1218d00Y"
}
// path relatiive to base url
var orderCancelPath = "/v1/checkout/cancel-order"

//crate new orderCancel
var = orderCancelRespose = client.deleteFunc(orderCancelPath, orderCancelJson)

Cancel an order before customer completes the payment. An expired or completed order cannot be cancelled.

HTTP Request

DELETE http://example.com/v1/checkout/cancel-order?order_id={order_id}

Get Order Status

CHECKING
require_once __DIR__ .'/vendor/autoload.php';

// use FléxPay client module
use FléxPay\ApigwClient\Client;

// initalize a new Client instace with values of the base url, api key and api secret

$apiKey = '202cb962ac59075b964b07152d234b70';
$apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
$baseUrl = "http://example.com";


$client = new Client($baseUrl, $apiKey, $apiSecret);


// data
$orderStatusArray = array("order_id"=>"85gh9p7l8");

// path relatiive to base url
$orderStatusPath = "/v1/checkout/order-status";

// get order status
$response = $client->getFunc($orderStatusPath,$orderStatusArray)
#import package
from FléxPay_apigw_client import apigwClient

# initalize a new Client instace with values of the base url, api key and api secret
apiKey = '202cb962ac59075b964b07152d234b70'
apiSecret = '81dc9bdb52d04dc20036dbd8313ed055'
baseUrl = "http://example.com"

client = apigwClient.Client(baseUrl, apiKey, apiSecret)

#data
orderStatusDict = {"order_id":"85gh9p7l8"}
#path relatiive to base url
orderStatusPath = "/v1/checkout/order-status"

#crate new orderStatus
response = client.getFunc(orderStatusPath, orderStatusDict)
# With shell, you can just pass the correct header with each request
curl "api_endpoint_here" \
  -H "Authorization: flexclientkey"curl "api_endpoint_here"
  -H "Content-type: application/json"
  -H "Authorization: FléxPay flexclientkey"
  -H "Digest-Method: HS256"
  -H "Digest: tW32A+O1FcpRj2o2mbWgF2r+vmILqqKwHqDryj+7lvI="
  -H "Timestamp: 2019-02-26T09:30:46+03:00"
  -H "Signed-Fields: utilityref,vendor,pin,transid,amount,msisdn"
  -d  '{"vendor":"BANKX", "pin":"3333", "utilityref":"075XXXXXXX", "transid":"T001", "amount":"1234", "msisdn":"25568XXXXXXX"}'

//import FléxPay client package
import io.github.FléxPaypaytechltd.ApigwClient;
import java.util.Map;
import com.google.gson.*;

String apiKey = '202cb962ac59075b964b07152d234b70';
String apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
String baseUrl = "http://example.com";

// initalize a new Client instace with values of the base url, api key and api secret
Client client = new ApigwClient(baseUrl,apiKey,apiSecret);

// path relatiive to base url
String orderStatusPath = "/v1/checkout/order-status";

// data
JsonObject orderStatusDict = new JsonObject();
orderStatusDict.addProperty("order_id","85gh9p7l8");


//get order status
JsonObject response = client.getFunc(orderStatusPath ,orderStatusDict);
//import package
const {apigwClient } = require("FléxPay-apigw-client");

// initalize a new Client instace with values of the base url, api key and api secret
const apiKey = '202cb962ac59075b964b07152d234b70';
const apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
const baseUrl = "http://example.com"

const client = new apigwClient(baseUrl, apiKey, apiSecret);

//data
var orderStatusJson = {"order_id":"85gh9p7l8",}
// path relatiive to base url
var orderStatusPath = "/v1/checkout/order-status"

//crate new orderStatus
var = orderStatusRespose = client.getFunc(orderStatusPath, orderStatusJson)

Get status of an order.

HTTP Request

GET http://example.com/v1/checkout/order-status?order_id={order_id}

JSON Response Data Field

Parameter Description
payment_status Payment Status (PENDING, COMPLETED, CANCELLED, USERCANCELLED, REJECTED, INPROGRESS)
order_id Order ID
creation_date Order creation date
amount Order amount
transid Unique transaction identifier from the payment channel. Available on COMPLETED payments only
channel Channel name (e.g., AIRTELMONEY). Available on COMPLETED payments only
reference PG unique payment identifier. Available on COMPLETED payments only
msisdn Mobile number involved in the payment in case of a wallet/mastercard QR payment. Available on COMPLETED payments only

View All Orders

require_once __DIR__ .'/vendor/autoload.php';

// use selcom client module
use Selcom\ApigwClient\Client;

// initalize a new Client instace with values of the base url, api key and api secret

$apiKey = '202cb962ac59075b964b07152d234b70';
$apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
$baseUrl = "http://example.com";

$client = new Client($baseUrl, $apiKey, $apiSecret);

// data
$listOrdersArray = array(
    "fromdate"=>"2023-02-10",
    "todate"=>"2023-02-16");

// path relatiive to base url
$listOrdersPath = "/v1/checkout/list-orders";

// list orders between selected dates
$response = $client->getFunc($listOrdersPath,$listOrdersArray)
#import package
from selcom_apigw_client import apigwClient

# initalize a new Client instace with values of the base url, api key and api secret
apiKey = '202cb962ac59075b964b07152d234b70'
apiSecret = '81dc9bdb52d04dc20036dbd8313ed055'
baseUrl = "http://example.com"

client = apigwClient.Client(baseUrl, apiKey, apiSecret)

#data
listOrdersDict = {
    "fromdate":"2023-02-10",
    "todate":"2023-02-16"
}
#path relatiive to base url
listOrdersPath = "/v1/checkout/list-orders"

#crate new listOrders
response = client.getFunc(listOrdersPath, listOrdersDict)
# With shell, you can just pass the correct header with each request
curl -X GET 'http://example.com/v1/checkout/list-orders?fromdate={YYYY-MM-DD}&todate={YYYY-MM-DD}' \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Authorization: SELCOM {authorization-token}" \
  -H "Digest-Method: {digest-token}" \
  -H "Digest: {digest}" \
  -H "Timestamp: {timestamp in yyyy-dd-mm H:i:s format}" \
  -H "Signed-Fields: fromdate, todate" 

//import selcom client package
import io.github.selcompaytechltd.ApigwClient;
import java.util.Map;
import com.google.gson.*;

String apiKey = '202cb962ac59075b964b07152d234b70';
String apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
String baseUrl = "http://example.com";



// initalize a new Client instace with values of the base url, api key and api secret
Client client = new ApigwClient(baseUrl,apiKey,apiSecret);

// path relatiive to base url
String listOrdersPath = "/v1/checkout/list-orders";

// data
JsonObject listOrdersDict = new JsonObject();
listOrdersDict.addProperty("fromdate"=>"2023-02-10");
listOrdersDict.addProperty("todate"=>"2023-02-16");


//get orders
JsonObject response = client.getFunc(listOrdersPath ,listOrdersDict);
//import package
const {apigwClient } = require("selcom-apigw-client");

// initalize a new Client instace with values of the base url, api key and api secret
const apiKey = '202cb962ac59075b964b07152d234b70';
const apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
const baseUrl = "http://example.com"

const client = new apigwClient(baseUrl, apiKey, apiSecret);

//data
var listOrdersJson = {
    "fromdate":"2023-02-10",
    "todate":"2023-02-16"
}
// path relatiive to base url
var listOrdersPath = "/v1/checkout/list-orders"

//crate new listOrders
var = listOrdersRespose = client.getFunc(listOrdersPath, listOrdersJson)

HTTP Request

GET http://example.com/v1/checkout/list-orders?fromdate={YYYY-MM-DD}&todate={YYYY-MM-DD}

JSON Response Data Field

Parameter Description
result Result of the order submitted (FAIL, SUCCESS, PENDING)
payment_status Payment Status (PENDING, COMPLETED, CANCELLED, USERCANCELLED, REJECTED, INPROGRESS)
order_id Order ID
creation_date Order creation date

Retrieve Stored Card Tokens

require_once __DIR__ .'/vendor/autoload.php';

// use selcom client module
use Selcom\ApigwClient\Client;

// initalize a new Client instace with values of the base url, api key and api secret

$apiKey = '202cb962ac59075b964b07152d234b70';
$apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
$baseUrl = "http://example.com";

$client = new Client($baseUrl, $apiKey, $apiSecret);

// data
$fetchStoredTokensArray = array(
    "buyer_userid"=>"0000001",
    "gateway_buyer_uuid"=>"00000001");

// path relatiive to base url
$fetchStoredTokensPath = "/v1/checkout/stored-cards";

// fetch stored card tokens
#import package
from selcom_apigw_client import apigwClient

# initalize a new Client instace with values of the base url, api key and api secret
apiKey = '202cb962ac59075b964b07152d234b70'
apiSecret = '81dc9bdb52d04dc20036dbd8313ed055'
baseUrl = "http://example.com"

client = apigwClient.Client(baseUrl, apiKey, apiSecret)

#data
fetchCardTokensDict = {
    "buyer_userid":"0000001",
    "gateway_buyer_uuid":"00000001"
}
#path relatiive to base url
fetchCardTokensPath = "/v1/checkout/stored-cards"

#crate new fetchCardTokens
response = client.getFunc(fetchCardTokensPath, fetchCardTokensDict)
# With shell, you can just pass the correct header with each request
curl -X GET 'http://example.com/v1/checkout/stored-cards?gateway_buyer_uuid={gateway_buyer_uuid}&buyer_userid={buyer_userid}' \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Authorization: SELCOM {authorization-token}" \
  -H "Digest-Method: {digest-token}" \
  -H "Digest: {digest}" \
  -H "Timestamp: {timestamp in yyyy-dd-mm H:i:s format}" \
  -H "Signed-Fields: gateway_buyer_uuid, buyer_userid"
//import selcom client package
import io.github.selcompaytechltd.ApigwClient;
import java.util.Map;
import com.google.gson.*;

String apiKey = '202cb962ac59075b964b07152d234b70';
String apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
String baseUrl = "http://example.com";

// initalize a new Client instace with values of the base url, api key and api secret
Client client = new ApigwClient(baseUrl,apiKey,apiSecret);

// path relatiive to base url
String fetchCardTokensPath = "/v1/checkout/stored-cards";

// data
JsonObject fetchCardTokensDict = new JsonObject();
fetchCardTokensDict.addProperty("buyer_userid"=>"0000001");
fetchCardTokensDict.addProperty("gateway_buyer_uuid"=>"00000001");

//post data
JsonObject response = client.getFunc(fetchCardTokensPath ,fetchCardTokensDict)
//import package
const {apigwClient } = require("selcom-apigw-client");

// initalize a new Client instace with values of the base url, api key and api secret
const apiKey = '202cb962ac59075b964b07152d234b70';
const apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
const baseUrl = "http://example.com"

const client = new apigwClient(baseUrl, apiKey, apiSecret);

//data
var fetchCardTokensJson = {
"buyer_userid":"0000001",
    "gateway_buyer_uuid":"00000001"
}
// path relatiive to base url
var fetchCardTokensPath = "/v1/checkout/stored-cards"

//crate new fetchCardTokens
var = fetchCardTokensRespose = client.getFunc(fetchCardTokensPath, fetchCardTokensJson)

This API allows the eccomerce website to fetch stored cards for specific user passing the gateway_buyer_uuid that was generated for each user on there first order creatio

HTTP Request

GET http://example.com/v1/checkout/stored-cards?gateway_buyer_uuid={gateway_buyer_uuid}&buyer_userid={buyer_userid}

JSON Payload Parameters

Parameter Type Example Description
buyer_userid Mandatory 23 Buyer's unique user ID in the third-party ecommerce website. Same as create order request.
gateway_buyer_uuid Mandatory 124343434 Gateway Buyer UUID returned during order creation, the first time a buyer created an order.

JSON Response Data Field

Parameter Description
masked_card Masked card number
creation_date Card token creation date
name Full name of the card holder
card_type Card type (001 - Visa, 002 - Mastercard)
card_token Card token
id Unique Resource ID

Remove Stored Card

require_once __DIR__ .'/vendor/autoload.php';

// use selcom client module
use Selcom\ApigwClient\Client;

// initalize a new Client instace with values of the base url, api key and api secret

$apiKey = '202cb962ac59075b964b07152d234b70';
$apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
$baseUrl = "http://example.com";

$client = new Client($baseUrl, $apiKey, $apiSecret);

// data
$deleteCardArray = array(
    "id"=>"0000001",
    "gateway_buyer_uuid"=>"00000001");

// path relatiive to base url
$deleteCardPath = "/v1/checkout/delete-card";

// delete stored card
$response = $client->deleteFunc($deleteCardPath,$deleteCardArray);)
#import package
from selcom_apigw_client import apigwClient

# initalize a new Client instace with values of the base url, api key and api secret
apiKey = '202cb962ac59075b964b07152d234b70'
apiSecret = '81dc9bdb52d04dc20036dbd8313ed055'
baseUrl = "http://example.com"

client = apigwClient.Client(baseUrl, apiKey, apiSecret)

#data
deleteCardDict = {
    "id":"0000001",
    "gateway_buyer_uuid":"00000001"
}
#path relatiive to base url
deleteCardPath = "/v1/checkout/delete-card"

#crate new deleteCard
response = client.deleteFunc(deleteCardPath, deleteCardDict)
# With shell, you can just pass the correct header with each request
curl -X DELETE 'http://example.com/v1/checkout/delete-card?id={card-resource-id}&gateway_buyer_uuid=   {gateway_buyer_uuid}' \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Authorization: SELCOM {authorization-token}" \
  -H "Digest-Method: {digest-token}" \
  -H "Digest: {digest}" \
  -H "Timestamp: {timestamp in yyyy-dd-mm H:i:s format}" \
  -H "Signed-Fields: id,gateway_buyer_uuid "

//import selcom client package
import io.github.selcompaytechltd.ApigwClient;
import java.util.Map;
import com.google.gson.*;

String apiKey = '202cb962ac59075b964b07152d234b70';
String apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
String baseUrl = "http://example.com";



// initalize a new Client instace with values of the base url, api key and api secret
Client client = new ApigwClient(baseUrl,apiKey,apiSecret);

// path relatiive to base url
String deleteCardPath = "/v1/checkout/delete-card";

// data
JsonObject deleteCardDict = new JsonObject();
deleteCardDict.addProperty("id","0000001");
deleteCardDict.addProperty("gateway_buyer_uuid","00000001");


//delete card
JsonObject response = client.deleteFunc(deleteCardPath ,deleteCardDict);
//import package
const {apigwClient } = require("selcom-apigw-client");

// initalize a new Client instace with values of the base url, api key and api secret
const apiKey = '202cb962ac59075b964b07152d234b70';
const apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
const baseUrl = "http://example.com"

const client = new apigwClient(baseUrl, apiKey, apiSecret);

//data
var deleteCardJson = {
    "id":"0000001",
    "gateway_buyer_uuid":"00000001"
}
// path relatiive to base url
var deleteCardPath = "/v1/checkout/delete-card"

//crate new deleteCard
var = deleteCardRespose = client.deleteFunc(deleteCardPath, deleteCardJson)

This API allows the eccomerce website to delete stored cards for specific user passing the gateway_buyer_uuid that was generated for each user on there first order creation

HTTP Request

DELETE http://example.com/v1/checkout/delete-card?id={card-resource-id}&gateway_buyer_uuid={gateway_buyer_uuid}

JSON Payload Parameters

Parameter Type Example Description
id Mandatory 23 Stored card resource ID
gateway_buyer_uuid Mandatory 124343434 Gateway Buyer UUID returned during order creation for a buyer

Process Order - Card Payment

require_once __DIR__ .'/vendor/autoload.php';

// use selcom client module
use Selcom\ApigwClient\Client;

// initalize a new Client instace with values of the base url, api key and api secret

$apiKey = '202cb962ac59075b964b07152d234b70';
$apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
$baseUrl = "http://example.com";

$client = new Client($baseUrl, $apiKey, $apiSecret);

// data
$cardPaymentArray = array(
    "transid"=> "A1234",
    "vendor"=>"VENDORTILL",
    "order_id"=>"85gh9p7l8",
    "card_token"=> "ABC123423232",
    "buyer_userid"=> "255xxxxxxxxx",
    "gateway_buyer_uuid"=>"12434343",
    );

// path relatiive to base url
$cardPaymentPath = "/v1/checkout/card-payment";

//  card payment
$response = $client->postFunc($cardPaymentPath,$cardPaymentArray);

#import package
from selcom_apigw_client import apigwClient

# initalize a new Client instace with values of the base url, api key and api secret
apiKey = '202cb962ac59075b964b07152d234b70'
apiSecret = '81dc9bdb52d04dc20036dbd8313ed055'
baseUrl = "http://example.com"

client = apigwClient.Client(baseUrl, apiKey, apiSecret)

#data
cardPaymentDict = {
"transid": "A1234",
  "vendor":"VENDORTILL",
  "order_id":"85gh9p7l8",
  "card_token": "ABC123423232",
  "buyer_userid": "255xxxxxxxxx",
  "gateway_buyer_uuid":"12434343",
}
#path relatiive to base url
cardPaymentPath = "/v1/checkout/card-payment"

#crate new cardPayment
response = client.postFunc(cardPaymentPath, cardPaymentDict)
# With shell, you can just pass the correct header with each request
curl -X POST 'http://example.com/v1/checkout/card-payment' \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Authorization: SELCOM {authorization-token}" \
  -H "Digest-Method: {digest-token}" \
  -H "Digest: {digest}" \
  -H "Timestamp: {timestamp in yyyy-dd-mm H:i:s format}" \
  -H "Signed-Fields: transid,vendor,order_id,card_token,buyer_userid,gateway_buyer_uuid" \
  -d '{"transid":"T123442","vendor":"VENDORTILL", "order_id":"123", "card_token":"ABC123423232", "buyer_userid":"adfm311",gateway_buyer_uuid":"12344321"}

//import selcom client package
import io.github.selcompaytechltd.ApigwClient;
import java.util.Map;
import com.google.gson.*;

String apiKey = '202cb962ac59075b964b07152d234b70';
String apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
String baseUrl = "http://example.com";



// initalize a new Client instace with values of the base url, api key and api secret
Client client = new ApigwClient(baseUrl,apiKey,apiSecret);

// path relatiive to base url
String cardPaymentPath = "/v1/checkout/card-payment";

// data
JsonObject cardPaymentDict = new JsonObject();
cardPaymentDict.addProperty("transid", "A1234");
cardPaymentDict.addProperty("vendor","VENDORTILL");
cardPaymentDict.addProperty("order_id","85gh9p7l8");
cardPaymentDict.addProperty("card_token", "ABC123423232");
cardPaymentDict.addProperty("buyer_userid", "255xxxxxxxxx");
cardPaymentDict.addProperty("gateway_buyer_uuid","12434343");

//post data
JsonObject response = client.postFunc(cardPaymentPath ,cardPaymentDict);
<!-- Process Order - Card Payment Sample -->

//import package
const {apigwClient } = require("selcom-apigw-client");

// initalize a new Client instace with values of the base url, api key and api secret
const apiKey = '202cb962ac59075b964b07152d234b70';
const apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
const baseUrl = "http://example.com"

const client = new apigwClient(baseUrl, apiKey, apiSecret);

//data
var cardPaymentJson = {
  "transid": "A1234",
  "vendor":"VENDORTILL",
  "order_id":"85gh9p7l8",
  "card_token": "ABC123423232",
  "buyer_userid": "255xxxxxxxxx",
  "gateway_buyer_uuid":"12434343",
};
// path relatiive to base url
var cardPaymentPath = "/v1/checkout/card-payment";

//crate new cardPayment
var = cardPaymentRespose = client.postFunc(cardPaymentPath, cardPaymentJson);

Process Order api allows the ecommerce website to process an order using stored cards directly without redirecting the user to payment gateway page. Can be used for in-app payments where users can select stored cards or for ondemand subscription type recurring payments.

HTTP Request

POST http://example.com/v1/checkout/card-payment

JSON Payload Parameters

Parameter Type Example Description
transaction_id Mandatory A1234 Unique transaction ID
vendor Mandatory SHOW01 Vendor/Merchant ID allocated by Selcom
order_id Mandatory 123 Order ID
card_token Mandatory ABC123423232 Card token fetched using Fetch Stored Tokenised Cards for Specific User API
buyer_userid Mandatory joejohn20 Buyers unique user-id in the third-party e-commerce website. Should be empty for guest check
gateway_buyer_uuid Mandatory 124343434 Gateway Buyer UUID returned during order creation first time a buyer created an order

Complete Order - Wallet Pull Payment

require_once __DIR__ .'/vendor/autoload.php';

// use selcom client module
use Selcom\ApigwClient\Client;

// initalize a new Client instace with values of the base url, api key and api secret

$apiKey = '202cb962ac59075b964b07152d234b70';
$apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
$baseUrl = "http://example.com";

$client = new Client($baseUrl, $apiKey, $apiSecret);

// data
$walletPaymentArray = array(
    "transid"=> "A1234",
    "order_id"=>"85gh9p7l8",
    "msisdn"=> "255xxxxxxxxx",
    );

// path relatiive to base url
$walletPaymentPath = "/v1/checkout/wallet-payment";

// wallet payment
$response = $client->postFunc($walletPaymentPath,$walletPaymentArray);
#import package
from selcom_apigw_client import apigwClient

# initalize a new Client instace with values of the base url, api key and api secret
apiKey = '202cb962ac59075b964b07152d234b70'
apiSecret = '81dc9bdb52d04dc20036dbd8313ed055'
baseUrl = "http://example.com"

client = apigwClient.Client(baseUrl, apiKey, apiSecret)

#data
walletPaymentDict = {
  "transid": "A1234",
    "order_id":"85gh9p7l8",
    "msisdn": "255xxxxxxxxx",
}
#path relatiive to base url
walletPaymentPath = "/v1/checkout/wallet-payment"

#crate new walletPayment
response = client.postFunc(walletPaymentPath, walletPaymentDict)
# With shell, you can just pass the correct header with each request
curl -X POST "http://example.com/v1/checkout/wallet-payment" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Authorization: SELCOM {authorization-token}" \
  -H "Digest-Method: {digest-token}" \
  -H "Digest: {digest}" \
  -H "Timestamp: {timestamp in yyyy-dd-mm H:i:s format}" \
  -H "Signed-Fields: transid,order_id,msisdn"  \
  -d '{"transid":"T123442", "order_id":"123", "msisdn":"2556828XXXXX"} 
//import selcom client package
import io.github.selcompaytechltd.ApigwClient;
import java.util.Map;
import com.google.gson.*;

String apiKey = '202cb962ac59075b964b07152d234b70';
String apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
String baseUrl = "http://example.com";

// initalize a new Client instace with values of the base url, api key and api secret
Client client = new ApigwClient(baseUrl,apiKey,apiSecret);

// path relatiive to base url
String walletPaymentPath = "/v1/checkout/wallet-payment";

// data
JsonObject walletPaymentDict = new JsonObject();
walletPaymentDict.addProperty("transid", "R1234");
walletPaymentDict.addProperty("order_id","85gh9p7l8");
walletPaymentDict.addProperty("msisdn", "255xxxxxxxxx");


//post wallet payment 
JsonObject response = client.postFunc(walletPaymentPath ,walletPaymentDict);

//import package
const {apigwClient } = require("selcom-apigw-client");

// initalize a new Client instace with values of the base url, api key and api secret
const apiKey = '202cb962ac59075b964b07152d234b70';
const apiSecret = '81dc9bdb52d04dc20036dbd8313ed055';
const baseUrl = "http://example.com"

const client = new apigwClient(baseUrl, apiKey, apiSecret);

//data
var walletPaymentJson = {
  "transid": "A1234",
    "order_id":"85gh9p7l8",
    "msisdn": "255xxxxxxxxx",
}
// path relatiive to base url
var walletPaymentPath = "/v1/checkout/wallet-payment"

//crate new walletPayment
var = walletPaymentRespose = client.postFunc(walletPaymentPath, walletPaymentJson)

Complete Order api allows the ecommerce website to process an order using mobile wallets directly without redirecting the user to payment gateway page. Can be used for in-app payments where users can select linked mobile numbers, tigger this api call to reiceve a PUSH ussd from the mobile wallet to complete the transaction.

HTTP Request

POST http://example.com/v1/checkout/wallet-payment

Additional JSON Payload Parameters

Parameter Type Example Description
transid Mandatory A1234 Unique transaction ID
order_id Mandatory 123 Order ID
msisdn Mandatory 2556828XXXXX Billing wallet mobile from which the merchant wants to pull funds from using Push USSD authorization

Webhook Notifications


{
  "result": "SUCCESS",
  "resultcode": "000",
  "order_id": "602021152",
  "transid": "7945454515",
  "reference": "856266164161",
  "channel": "TIGOPESATZ",
  "amount": "10000",
  "phone": "255000000001",
  "payment_status": "COMPLETED"
}


{
  "result": "SUCCESS",
  "resultcode": "000",
  "order_id": "602021152",
  "transid": "7945454515",
  "reference": "856266164161",
  "channel": "TIGOPESATZ",
  "amount": "10000",
  "phone": "255000000001",
  "payment_status": "COMPLETED"
}

# With shell, you can just pass the correct header with each request
curl "{thirdparty_site_webhook url}"\
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "Authorization: SELCOM {authorization-token}" \
  -H "Digest-Method: {digest-token}" \
  -H "Digest: {digest}" \
  -H "Timestamp: {timestamp in yyyy-dd-mm H:i:s format}" \
  -H "Signed-Fields: transid,order_id,reference,result,resultcode,payment_status" \
  -d '{"transid":"T123442", "reference":"028912121", "order_id":"123", "reference":"0281121212", "result":"SUCCESS", "resulcode":"000","payment_status":"COMPLETED"}


{
  "result": "SUCCESS",
  "resultcode": "000",
  "order_id": "602021152",
  "transid": "7945454515",
  "reference": "856266164161",
  "channel": "TIGOPESATZ",
  "amount": "10000",
  "phone": "255000000001",
  "payment_status": "COMPLETED"
}


{
  "result": "SUCCESS",
  "resultcode": "000",
  "order_id": "602021152",
  "transid": "7945454515",
  "reference": "856266164161",
  "channel": "TIGOPESATZ",
  "amount": "10000",
  "phone": "255000000001",
  "payment_status": "COMPLETED"
}

Payment status callback api from payment gateway to ecommerce website. **Note : Webhook only on successful transcations

HTTP Request Parameters

Parameter Type Example Description
transid Mandatory A1234 Third-party transaction ID same as payment request
order_id Mandatory 123 Order ID
reference Mandatory 0289124234 Selcom Gateway transaction reference
result Mandatory SUCCESS Status of the transaction (SUCCESS, FAIL)
resultcode Mandatory 000 Error code
payment_status Mandatory COMPLETE Status of the payment (COMPLETED, CANCELLED, PENDING, USERCANCELED)

Errors

The Kittn API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The kitten requested is hidden for administrators only.
404 Not Found -- The specified kitten could not be found.
405 Method Not Allowed -- You tried to access a kitten with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The kitten requested has been removed from our servers.
418 I'm a teapot.
429 Too Many Requests -- You're requesting too many kittens! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.