Payment API Gateway (template version) (5.7.3)

Download OpenAPI specification:

This API enables integration with the Payment Gateway to initiate transactions, monitor their statuses, and interact with various payment providers.

Intro

This API is part of the our ecosystem. It allows you to make payments, find out the status of transactions and much more. Here you will find the latest documentation on setting up your solution.

Important: all Mobile Money C2B/B2C payments must be processed only with verified phone numbers.

Before proceeding with the request, please confirm that the phone number:

  • has been previously verified by the customer;
  • matches the number stored in your database.

This requirement is essential for minimizing fraud risk.

Available Payment Providers (Test Environment)

Use the test provider below during sandbox integration. Note that responses from the simulator do not include a callback — transactions remain in the "in progress" state.

ID Name Country Description
14 Simulator ANY For testing purposes

Example response from test provider (ID: 14)

When using the simulator provider, a successful request returns the following structure. Note that status: 1 means "in progress" — use the /status method to poll for updates.

{
  "order_id": "54321",
  "transaction_id": "12345",
  "transaction_ref": "",
  "status": 1,
  "result": {
    "code": 0,
    "message": "OK"
  },
  "provider_result": {
    "code": -8888,
    "message": "Good"
  },
  "service_id": 1,
  "service_version": "1.03/1.14|1.0/1.26|1.0/1.0|1.01/1.01|1.01/1.01||1.01/1.27",
  "service_date_time": "2023-05-15 10:00:00.000000",
  "confirm_type": 0
}

Generating Signature

To generate a correct signature, use your secretKey and apply recursive HMAC SHA-512 hashing on all request fields, excluding the signature field itself.

Example in PHP:

function calculateSignature(array $data, string $secretKey, string $prefix = '', int $depth = 16, int $level = 0): string {
    if ($level >= $depth) {
        throw new Exception('Too deep');
    }

    $result = '';
    foreach ($data as $key => $value) {
        if ($key === 'signature') continue;
        $fullKey = $prefix . $key;
        if (is_array($value)) {
            $result .= calculateSignature($value, $secretKey, $fullKey . '.', $depth, $level + 1);
        } else {
            $result .= $fullKey . $value;
        }
    }

    return $level === 0
        ? strtolower(hash_hmac('sha512', $result, $secretKey))
        : $result;
}

$postData = [
    'merchant_id' => 'fffed61b...',
    'provider_id' => 10,
    'client_id' => '254000000000',
    'country' => 'KE',
    'order_id' => 'order_3444298767545',
    'amount' => 1000,
    'currency' => 'KES',
    'callback_url' => 'https://my.callback.url'
];

$secretKey = 'cf11635572...';
$postData['signature'] = calculateSignature($postData, $secretKey);

Status Codes

Code Name Description
-1 undefined Unknown or error state
0 initiated Operation is initiated
1 in progress Operation is in progress
2 success Operation completed successfully
3 failed Operation failed
4 cancelled Operation was cancelled

Operation Types

Operation type codes visible in callbacks:

Code Type
16 payment_b2c
17 payment_c2b
32 paybill

Available Currencies

Code Note
KES Example for test requests
MWK Malawian kwacha
UGX Ugandan shilling
TZS Tanzanian shilling
ZMW Zambian kwacha
XOF West African CFA franc
XAF CFA franc BEAC
NGN Naira Nigeria

Callbacks

Transaction status is sent via callback because it requires asynchronous confirmation from the client system. Usually the callback should arrive within 2–3 minutes.

If no callback is received, use the status API method to check transaction result. Successful callback = HTTP 200 from merchant'

Payment Methods

Benin

Provider ID Provider Name Notes
9523 MTN Check provider id with your manager

The phone number must consist of exactly 8 numeric digits in the following format: 229 01 XXXXXXXX (3-digit country code 229 + 01 + 8-digit local phone number). Example: 2290112345678 No spaces, plus signs, separators, or other characters are permitted.

C2B for Provider_ids that do not require OTP or Redirect: 9523

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST C2B request) and set extra data depending on the provider_id:
Provider_id No Extra Required customer_email customer_name return_url
9523 *
  1. Customer gets push from operator and confirm the operation
  2. Merchant gets a callback (or requests the status) with the final state of the operation

B2C flow is the same for everyone, please specify the required extra parameters

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST B2C request) and set extra data depending on the provider_id:
Provider_id No Extra Required customer_email customer_name return_url
9523 *
  1. Customer receives funds to their mobile number
  2. Merchant gets a callback (or requests the status) with the final state of the operation

Note deposits and withdrawals are made in multiples of 5.

Benin limits

Provider_id c2b minimum b2c minimum Maximum transaction limit
9523 XOF 100.00 XOF 100.00 XOF 2'000'000.00

Congo-Brazzaville

Provider ID Provider Name Notes
9525 MTN Check provider id with your manager

242000000000 - This is the format of the phone number you have to send in the payment requests.

C2B for Provider_ids that do not require OTP or Redirect: 9525

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST C2B request) and set extra data depending on the provider_id:
Provider_id No Extra Required customer_email customer_name return_url
9525 * *
  1. Customer gets push from operator and confirm the operation
  2. Merchant gets a callback (or requests the status) with the final state of the operation

B2C flow is the same for everyone, please specify the required extra parameters

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST B2C request) and set extra data depending on the provider_id:
Provider_id No Extra Required customer_email customer_name return_url
9525 * *
  1. Customer receives funds to their mobile number
  2. Merchant gets a callback (or requests the status) with the final state of the operation

Congo-Brazzaville limits

Provider_id c2b minimum b2c minimum Maximum transaction limit
9525 XAF 100.00 XAF 100.00 XAF 2'000'000.00

Kenya

Provider ID Provider Name Notes
9515, 9574 M-Pesa Safaricom Check provider id with your manager

254000000000 - This is the format of the phone number you have to send in the payment requests.

C2B for Provider_ids that do not require OTP or Redirect: 9515, 9574

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST C2B request) and set extra data depending on the provider_id:
Provider_id No Extra Required customer_email customer_name return_url
9515 *
9574 *
  1. Customer gets push from operator and confirm the operation
  2. Merchant gets a callback (or requests the status) with the final state of the operation

B2C flow is the same for everyone, please specify the required extra parameters

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST B2C request) and set extra data depending on the provider_id:
Provider_id No Extra Required customer_email customer_name return_url
9515 *
9574 *
  1. Customer receives funds to their mobile number
  2. Merchant gets a callback (or requests the status) with the final state of the operation

Kenya limits

Provider_id c2b minimum b2c minimum Maximum transaction limit
9515 KES 143.00 KES 10.00 KES 250'000.00
9574 KES 10.00 KES 10.00 KES 85'000.00

Nigeria

Provider ID Provider Name Notes
9611 BankTransfer Check provider id with your manager
9612 Opay Check provider id with your manager
9613 Palmpay Check provider id with your manager
9579 Airtel Check provider id with your manager

C2B:

  • The customer initiates the payment on the merchant side and sets extra data depending on the provider_id
Provider_id No Extra Required customer_email customer_name Phone in customer_id return_url
9611 *

Regardless of the extra parameters used for these methods, we strongly recommend specifying at least: customer_email, customer_name and user phone number in the customer_id parameter of the main request body to unify the solution.

  • Merchant sends C2B request to the platform
  • Platform returns temporary bank account details in the API response in status request (extra parameters)
    • account_number
    • bank_name
    • account_name
      Please note that the exact parameter names may differ slightly depending on the bank, so it is correct to display the entire extra section from the status request result to the user, for example:
"extra": 
{
"account_name": "MONEY TECH – LTD",
"account_number": "9999793854",
"bank_name": "GLOBAL BANK",
"transfer_amount": "1550"
}, 
  • Merchant displays these bank details to the Customer.
  • Customer makes a bank transfer to the provided details from their wallet.
  • Merchant gets a callback with the final state of the operation once the funds are received.

B2C Payments for universal bank transfer

  • Customer initiates the withdrawal on Merchant side.
  • Merchant receives the list of available banks and its codes via get banks API Method
  • Customer selects on the Merchant’s side the Bank and specifies their recipient’s bank account
  • Merchant sends B2C request to the platform where customer_id is customer bank account number and sets extra data
    • bank_code got from get banks API Method response
    • Extra parameters used:
Provider_id bank_code customer_email customer_name customer_phone
9611 * *

Regardless of the extra parameters used for these methods, we strongly recommend specifying at least: customer_email, customer_name to unify the solution.

  • Platform transfers funds to the Customer's bank account
  • Merchant gets a callback from the platform with the final state of the operation

Provider_ids redirecting to Provider payment pages: 9612, 9613

C2B:

  1. Customer initiates the payment on Merchant side
  2. Merchant sends C2B request to the platform where customer_id should be phone number
    In the extra parameters are specified:
  • customer_name
  1. Merchant gets the status of the operation and extra data customer_redirect
    Example of a user redirect link:
"extra": 
{
"customer_redirect": "https://checkout.provider.com/202511131111MqKRft39377/pay"
}, 
  1. Merchant redirect Customer to provider page
  2. Customer makes a payment from their bank using the payment details
  3. Merchant gets a callback (or requests the status) with the final state of the operation

B2C Opay (9612) Palmpay (9613):

  1. Customer initiates the payment on Merchant side and set extra data of their OPay, PalmPay or Pay Attitude bank account where customer_id is bank account
    In the extra parameters are specified:
  • customer_name
  1. Merchant sends B2C request to the platform
  2. Customer receives funds to their bank account in OPay or Palmpay
  3. Merchant gets a callback (or requests the status) with the final state of the operation

C2B for Provider_ids that do not require OTP or Redirect: 9579

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST C2B request) and set extra data depending on the provider_id:
Provider_id No Extra Required customer_email customer_name return_url
9579 *
  1. Customer gets push from operator and confirm the operation
  2. Merchant gets a callback (or requests the status) with the final state of the operation

B2C flow is the same for everyone, please specify the required extra parameters

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST B2C request) and set extra data depending on the provider_id:
Provider_id No Extra Required customer_email customer_name return_url
9579 *
  1. Customer receives funds to their mobile number
  2. Merchant gets a callback (or requests the status) with the final state of the operation

Nigeria limits

Provider_id c2b minimum b2c minimum Maximum transaction limit
9611, 9612, 9613 NGN 50.00 NGN 50.00 NGN 1'000'000.00
9579 NGN 50.00 NGN 50.00 NGN 5'000'000.00

Senegal

Provider ID Provider Name Notes
9259 Wave Check with your manager
9322, 9599, 9521 Orange Chack with your manager
9522 Free Money Chack with your manager

221000000000 - This is the format of the phone number you have to send in the payment requests.

C2B for Provider_ids that do not require OTP or Redirect: 9522

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST C2B request) and set extra data depending on the provider_id:
Provider_id No Extra Required customer_email customer_name return_url
9522 *
  1. Customer gets push from operator and confirm the operation
  2. Merchant gets a callback (or requests the status) with the final state of the operation

C2B for Provider_ids redirecting to Provider payment pages: 9259, 9322, 9599, 9521

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST C2B request) and set extra data depending on the provider_id:
Provider_id Empty customer_email customer_name customer_ip return_url
9322, 9521 *
9259 *
9599 *
  1. Merchant gets the status of the operation and extra data customer_redirect
    Example of a user redirect link:
"extra": 
{
"customer_redirect": "https://checkout.provider.com/202511131111MqKRft39377/pay"
}, 
  1. Merchant redirect Customer to provider page
  2. Customer confirms the payment on the provider page
  3. Merchant gets a callback (or requests the status) with the final state of the operation

B2C flow is the same for everyone, please specify the required extra parameters

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST B2C request) and set extra data depending on the provider_id:
Provider_id Empty customer_email customer_name return_url
9259, 9521, 9522 *
9322 *
9599 *
  1. Customer receives funds to their mobile number
  2. Merchant gets a callback (or requests the status) with the final state of the operation

Senegal Limits

Provider_id c2b minimum b2c minimum Maximum transaction limit
9322, 9269, 9521, 9522 XOF 200.00 XOF 200.00 XOF 2'000'000.00
9599 XOF 100.00 XOF 100.00 XOF 1'000'000.00

Tanzania

Provider ID Provider Name Notes
9370 Airtel Check provider id with your manager
9630 HaloPesa Check provider id with your manager
9369 Vodacom Check provider id with your manager
9376 Tigo Check provider id with your manager

255000000000 - This is the format of the phone number you have to send in the payment requests.

C2B for Provider_ids that do not require OTP or Redirect: 9369, 9370, 9376, 9630

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST C2B request) and set extra data depending on the provider_id:
Provider_id Empty customer_email customer_name return_url
9369, 9370, 9376, 9630 * *
  1. Customer gets push from operator and confirm the operation
  2. Merchant gets a callback (or requests the status) with the final state of the operation

B2C flow is the same for everyone, please specify the required extra parameters

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST B2C request) and set extra data depending on the provider_id:
Provider_id Empty customer_email customer_name return_url
9369, 9370, 9376, 9630 * *
  1. Customer receives funds to their mobile number
  2. Merchant gets a callback (or requests the status) with the final state of the operation

Tanzania Limits

Provider_id c2b minimum b2c minimum Maximum transaction limit
9369, 9370, 9376, 9630 TZS 1'000.00 TZS 1'000.00 TZS 5'000'000.00

Togo

Provider ID Provider Name Notes
9527 TOGOCOM Check provider id with your manager
9526 Moov Check provider id with your manager

The phone number must consist of exactly 8 numeric digits in the following format: 228XXXXXXXX (3-digit country code 228 + 8-digit local phone number). Example: 22890123456 No spaces, plus signs, separators, or other characters are permitted.

C2B for Provider_ids that do not require OTP or Redirect: 9526, 9527

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST C2B request) and set extra data depending on the provider_id:
Provider_id No Extra Required customer_email customer_name return_url
9526, 9527 *
  1. Customer gets push from operator and confirm the operation
  2. Merchant gets a callback (or requests the status) with the final state of the operation

B2C flow is the same for everyone, please specify the required extra parameters

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST B2C request) and set extra data depending on the provider_id:
Provider_id No Extra Required customer_email customer_name return_url
9526, 9527 *
  1. Customer receives funds to their mobile number
  2. Merchant gets a callback (or requests the status) with the final state of the operation

Note deposits and withdrawals are made in multiples of 5.

Togo limits

Provider_id c2b minimum b2c minimum Maximum transaction limit
9526, 9527 XOF 100.00 XOF 100.00 XOF 2'000'000.00

Ivory Coast

Provider ID Provider Name Notes
9262, 9519 Wave Check with your manager
9260 Moov Check with your manager
9261, 9516, 9585 MTN Check with your manager
9324 Orange Check with your manager

2250XXXXXXXXX - This is the format of the phone number you have to send in the payment requests.

C2B for Provider_ids that do not require OTP or Redirect: 9260, 9261, 9516, 9585

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST C2B request) and set extra data depending on the provider_id:
Provider_id Empty customer_email customer_name return_url
9260, 9261 *
9516 *
9585 *
  1. Customer gets push from operator and confirm the operation
  2. Merchant gets a callback (or requests the status) with the final state of the operation

C2B for Provider_ids that require a OTP: 9324

  1. Customer create OTP code on ussd_code #144*82#
  2. Customer initiates the payment on Merchant side
  3. Merchant sends request to the platform (POST C2B request) and set extra data depending on the provider_id:
Provider_id Empty customer_email customer_name return_url otp
9324 *

Example Request:

  {
  "merchant_id": "your merchant id",
  "customer_id": "2250705145655",
  "order_id": "test_161225_01_1",
  "amount": "1111",
  "currency": "XOF",
  "country": "BF",
  "callback_url": "your callback url",
  "provider_id": "9324",
  "signature": "1c594d338bc3f413bd61cb97d697e98ad5772071da533",
  "extra": {
    "otp": "7777"
  },
  }
  1. Operator debits funds from customer mobile number
  2. Merchant gets a callback (or requests the status) with the final state of the operation

C2B for Provider_ids redirecting to Provider payment pages: 9262, 9519

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST C2B request) and set extra data depending on the provider_id:
Provider_id Empty customer_email customer_name customer_ip return_url
9262 *
9519 * *
  1. Merchant gets the status of the operation and extra data customer_redirect
    Example of a user redirect link:
"extra": 
{
"customer_redirect": "https://checkout.provider.com/202511131111MqKRft39377/pay"
}, 
  1. Merchant redirect Customer to provider page
  2. Customer confirms the payment on the provider page
  3. Merchant gets a callback (or requests the status) with the final state of the operation

B2C flow is the same for everyone, please specify the required extra parameters

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST B2C request) and set extra data depending on the provider_id:
Provider_id Empty customer_email customer_name return_url
9260, 9261, 9262, 9324, 9516 *
9519 * *
9585 *
  1. Customer receives funds to their mobile number
  2. Merchant gets a callback (or requests the status) with the final state of the operation

Ivory Coast Limits

Provider_id c2b minimum b2c minimum Maximum transaction limit
9262, 9324, 9261, 9260, 9585 XOF 200.00 XOF 200.00 XOF 2'000'000.00
9516, 9519 XOF 100.00 XOF 100.00 XOF 2'000'000.00

Ghana

Provider ID Provider Name Notes
9343, 9582 MTN Check provider id with your manager
9344 Vodafone Check provider id with your manager

233000000000 - This is the format of the phone number you have to send in the payment requests.

C2B for Provider_ids that do not require OTP or Redirect: 9343, 9344, 9582

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST C2B request) and set extra data depending on the provider_id:
Provider_id Empty customer_email customer_name return_url
9343, 9344 * *
9582 *
  1. Customer gets push from operator and confirm the operation
  2. Merchant gets a callback (or requests the status) with the final state of the operation

B2C flow is the same for everyone, please specify the required extra parameters

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST B2C request) and set extra data depending on the provider_id:
Provider_id Empty customer_email customer_name return_url
9343, 9344 * *
9582 *
  1. Customer receives funds to their mobile number
  2. Merchant gets a callback (or requests the status) with the final state of the operation

Ghana limits

Provider_id c2b minimum b2c minimum Maximum transaction limit
9343, 9344 GHS 1.00 GHS 10.00 GHS no limit
9582 GHS 1.00 GHS 1.00 GHS 10'000.00

Zambia

Provider ID Provider Name Notes
9341 MTN Check provider id with your manager
9342 Airtel Check provider id with your manager

260000000000 - This is the format of the phone number you have to send in the payment requests.

C2B for Provider_ids that do not require OTP or Redirect: 9341, 9342

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST C2B request) and set extra data depending on the provider_id:
Provider_id Empty customer_email customer_name return_url
9341, 9342 * *
  1. Customer gets push from operator and confirm the operation
  2. Merchant gets a callback (or requests the status) with the final state of the operation

B2C flow is the same for everyone, please specify the required extra parameters

  1. Customer initiates the payment on Merchant side
  2. Merchant sends request to the platform (POST B2C request) and set extra data depending on the provider_id:
Provider_id Empty customer_email customer_name return_url
9341, 9342 * *
  1. Customer receives funds to their mobile number
  2. Merchant gets a callback (or requests the status) with the final state of the operation

Zambia limits

Provider_id c2b minimum b2c minimum Maximum transaction limit
9341, 9342 ZMW 1.00 ZMW 1.00 ZMW 20'000.00

Online Payments

Cashless payment from the customer to the merchant

path Parameters
public_id
required
string
Example: f54ec96649be11ebb3780242ac130002

Merchant public ID

Request Body schema: application/json
required

Parameters to initiate a customer to the merchant payment

merchant_id
required
string (merchantIdDef)

Unique Merchant ID received during the merchant registration

customer_id
required
string (customerIdDef)

Customer ID (usually mobile phone number of the customer)

customer_user_id
required
string (customerUserIdDef) <= 200 characters

Unique customer identifier on the merchant’s side (e.g., internal user ID, CRM ID)

order_id
required
string (orderIdDef)

The unique value is generated by the transaction initiator for each Operation. Max length is 128 symbols. Allowed symbols: [a-z], [A-Z], [0-9], “_” (underscore character), “-” (hyphen), “:” (colon), “.” (dot). For example, GUID or TIMESTAMP can be used as an order_id. This parameter provides API idempotency. It means that requests with identical nonce from the same transaction initiator will have identical responses and The corresponding operation won’t be repeated.

amount
required
string

Amount to pay, should be in format with two digits after point

currency
required
string (currencyDef)

Currency code in ISO 4217 format from the list of availabe currencies

country
string (countryDef)

Country code in ISO 3166-1 alpha-2 format as defined in the payment providers

callback_url
string

URL to notify the merchant via callback. Recommended

provider_id
required
integer (providerDef)
Enum: 14 40

Provider ID. Can be one of the option from this list.

signature
required
string (signatureDef)

Merchant’s request and callback have to be signed to verify sent data. To generate the signature all sent parameters are included in the order they were sent. The parameter signature should be excluded, of course. Example can be found here

Responses

Callbacks

Request samples

Content type
application/json
{
  • "merchant_id": "e0fecd91fcb24f348048193b3fb34875ba3722b4",
  • "customer_id": 900000001,
  • "customer_user_id": "user-123456",
  • "order_id": "16280954971628095497",
  • "amount": "100.00",
  • "currency": "KES",
  • "country": "KE",
  • "callback_url": "https://example.com/callback",
  • "provider_id": 14,
  • "signature": "d7d6d76b0e22c6f9d369fa6c24f107053d12bfd24d3b154f2deb6676bf179c123134e1f20879c803be455d81cfe792f00cd8892c26ce7cf5a05beebb9c80843e"
}

Response samples

Content type
application/json
{
  • "order_id": "16280954971628095497",
  • "transaction_id": "732007046722",
  • "transaction_ref": "MP.33234.342.CP33",
  • "status": 2,
  • "result": {
    },
  • "provider_result": {
    },
  • "service_id": 1,
  • "service_version": 11.1,
  • "service_date_time": "2020-11-25 10:08:32.832969"
}

Callback payload samples

Callback
POST: Asynchronous notification of the merchant about the last performed transaction
Content type
application/json
{
  • "transaction_id": "1234567",
  • "order_id": "16280954971628095497",
  • "service_id": 12345,
  • "service_version": "5.2.0",
  • "service_date_time": "2020-11-25 10:08:32.832969",
  • "result": {
    },
  • "signature": "d7d6d76b0e22c6f9d369fa6c24f107053d12bfd24d3b154f2deb6676bf179c123134e1f20879c803be455d81cfe792f00cd8892c26ce7cf5a05beebb9c80843e"
}

Cashless payment from the merchant to the customer.

Cashless payment from the merchant to the customer. If the confirm_type response parameter is a non-zero merchant, send the second payment_b2c request with confirmation data according to the section Confirmation Types.

path Parameters
public_id
required
string
Example: f54ec96649be11ebb3780242ac130002

Merchant public ID

Request Body schema: application/json
required

Parameters to initiate the merchant to the customer payment

merchant_id
required
string (merchantIdDef)

Unique Merchant ID received during the merchant registration

customer_id
required
string (customerIdDef)

Customer ID (usually mobile phone number of the customer)

customer_user_id
required
string (customerUserIdDef) <= 200 characters

Unique customer identifier on the merchant’s side (e.g., internal user ID, CRM ID)

order_id
required
string (orderIdDef)

The unique value is generated by the transaction initiator for each Operation. Max length is 128 symbols. Allowed symbols: [a-z], [A-Z], [0-9], “_” (underscore character), “-” (hyphen), “:” (colon), “.” (dot). For example, GUID or TIMESTAMP can be used as an order_id. This parameter provides API idempotency. It means that requests with identical nonce from the same transaction initiator will have identical responses and The corresponding operation won’t be repeated.

amount
required
string

Amount to pay, with two digits after point

currency
required
string (currencyDef)

Currency code in ISO 4217 format from the list of availabe currencies

country
string (countryDef)

Country code in ISO 3166-1 alpha-2 format as defined in the payment providers

callback_url
string

URL to notify the merchant via callback

provider_id
required
integer (providerDef)
Enum: 14 40

Provider ID. Can be one of the option from this list.

signature
required
string (signatureDef)

Merchant’s request and callback have to be signed to verify sent data. To generate the signature all sent parameters are included in the order they were sent. The parameter signature should be excluded, of course. Example can be found here

Responses

Request samples

Content type
application/json
{
  • "merchant_id": "e0fecd91fcb24f348048193b3fb34875ba3722b4",
  • "customer_id": 900000001,
  • "customer_user_id": "user-123456",
  • "order_id": "16280954971628095497",
  • "amount": "100.00",
  • "currency": "KES",
  • "country": "KE",
  • "callback_url": "https://example.com/callback",
  • "provider_id": 14,
  • "signature": "d7d6d76b0e22c6f9d369fa6c24f107053d12bfd24d3b154f2deb6676bf179c123134e1f20879c803be455d81cfe792f00cd8892c26ce7cf5a05beebb9c80843e"
}

Response samples

Content type
application/json
{
  • "order_id": "16280954971628095497",
  • "transaction_id": "532007056722",
  • "transaction_ref": "",
  • "status": 2,
  • "result": {
    },
  • "provider_result": {
    },
  • "service_id": 11,
  • "service_version": 11.1,
  • "service_date_time": "2020-11-25 10:08:32.832969",
  • "confirm_type": 0
}

Request a status of the transaction performed earlier

path Parameters
public_id
required
string
Example: f54ec96649be11ebb3780242ac130002

Merchant public ID

Request Body schema: application/json
required

Get the status of the performed transaction

merchant_id
required
string (merchantIdDef)

Unique Merchant ID received during the merchant registration

order_id
required
string (orderIdDef)

The unique value is generated by the transaction initiator for each Operation. Max length is 128 symbols. Allowed symbols: [a-z], [A-Z], [0-9], “_” (underscore character), “-” (hyphen), “:” (colon), “.” (dot). For example, GUID or TIMESTAMP can be used as an order_id. This parameter provides API idempotency. It means that requests with identical nonce from the same transaction initiator will have identical responses and The corresponding operation won’t be repeated.

signature
required
string (signatureDef)

Merchant’s request and callback have to be signed to verify sent data. To generate the signature all sent parameters are included in the order they were sent. The parameter signature should be excluded, of course. Example can be found here

Responses

Request samples

Content type
application/json
{
  • "merchant_id": "e0fecd91fcb24f348048193b3fb34875ba3722b4",
  • "order_id": "16280954971628095497",
  • "signature": "d7d6d76b0e22c6f9d369fa6c24f107053d12bfd24d3b154f2deb6676bf179c123134e1f20879c803be455d81cfe792f00cd8892c26ce7cf5a05beebb9c80843e"
}

Response samples

Content type
application/json
{
  • "order_id": "16280954971628095497",
  • "transaction_id": "732007046722",
  • "transaction_ref": "MP.33234.342.CP33",
  • "status": 2,
  • "result": {
    },
  • "provider_result": {
    },
  • "service_id": 1,
  • "service_version": 11.1,
  • "service_date_time": "2020-11-25 10:08:32.832969"
}

Get banks

path Parameters
public_id
required
string
Example: f54ec96649be11ebb3780242ac130002

Merchant public ID

Request Body schema: application/json
required

Get available banks

merchant_id
required
string (merchantIdDef)

Unique Merchant ID received during the merchant registration

provider_id
required
integer (providerDef)
Enum: 14 40

Provider ID. Can be one of the option from this list.

signature
required
string (signatureDef)

Merchant’s request and callback have to be signed to verify sent data. To generate the signature all sent parameters are included in the order they were sent. The parameter signature should be excluded, of course. Example can be found here

Responses

Request samples

Content type
application/json
{
  • "merchant_id": "e0fecd91fcb24f348048193b3fb34875ba3722b4",
  • "provider_id": 14,
  • "signature": "d7d6d76b0e22c6f9d369fa6c24f107053d12bfd24d3b154f2deb6676bf179c123134e1f20879c803be455d81cfe792f00cd8892c26ce7cf5a05beebb9c80843e"
}

Response samples

Content type
application/json
{
  • "banks": [
    ],
  • "result": {
    }
}

Backoffice API

Overview

Separate functionality. This section documents the Backoffice API (bo_api_url) — a different API from the merchant Payment API documented above. It is not part of the payment_c2b / payment_b2c / status integration and uses its own base URL and authentication (OAuth 2.0 Client Credentials, not request signatures).

Payment API Backoffice API
Base URL https://api.almarapay.net https://bo_api_url
Authentication Request signature (signature) OAuth 2.0 Client Credentials, Authorization: Bearer
Credentials Merchant ID and secret key Client ID and Client Secret from the Backoffice

1. Purpose

This feature gives Backoffice entities programmatic access to the BO API through the OAuth 2.0 Client Credentials Grant, decoupled from any interactive user session.


2. Process overview

The flow has three sequential stages:

  1. Generate credentials — create a client_id / client_secret pair bound to a specific entity, through the Backoffice UI (see Getting credentials).
  2. Get an access token — exchange the pair for a JSON Web Token (JWT) by calling /oauth/token (see Authentication).
  3. Make an authorized request — use the token in the Authorization header to call protected BO API endpoints.

The access token's lifetime is 1800 seconds (30 minutes). Once it expires, request a new one using the same credentials.


Getting credentials

3. Generating credentials

3.1 Steps

  1. Open My Profile in the Backoffice UI.
  2. In the Roles & Access block, select the card for the entity you need.
  3. In the Backoffice API Access section, click Generate API credentials.
  4. Save the Client ID and Client Secret shown in the dialog.

3.2 Important notes

  • The Client Secret is shown once, in plaintext, immediately after generation. It cannot be retrieved again in plaintext afterwards.
  • If a pair has already been generated for the entity, the control becomes Regenerate Secret (see section 4).

3.3 Assigning a role for API access

  • For the issued credentials to grant access to protected BO API endpoints, the entity must have at least one role flagged for API access (is_api_user). The roles available to the entity for API access are listed in the access token under api_user_roles (see section 5.4).
  • Role assignment is done by the partner's administrator. If no eligible role is assigned, requests to protected endpoints are rejected with 403 no_api_user_roles (see Errors).

4. Regenerating credentials

4.1 Steps

  1. On the entity's card, click Regenerate Secret.
  2. Confirm the action in the dialog.
  3. Save the new Client Secret shown in the dialog.

4.2 Important notes

  • The Client ID stays the same across regenerations.
  • The previous Client Secret is invalidated immediately once the action is confirmed.
  • Access tokens issued before the regeneration remain valid until they expire (expires_in) — regenerating does not immediately revoke tokens already issued.

Warning. Regenerating credentials for an entity used by a live integration will break that integration until the consumer updates its stored credentials.


Authentication

5. Getting an access token

5.1 Request

POST /api/v1/oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&client_id={CLIENT_ID}&client_secret={CLIENT_SECRET}

The same parameters can be sent as application/json.

5.2 Example

curl -X POST 'https://bo_api_url/api/v1/oauth/token' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=client_credentials&client_id=<CLIENT_ID>&client_secret=<CLIENT_SECRET>'

5.3 Response

{
  "access_token": "string",
  "token_type": "Bearer",
  "expires_in": 1800
}

This grant does not issue a refresh token. Once the token expires (expires_in), repeat the request above with the same client_id and client_secret to get a new one. Re-requesting a token needs no additional confirmation and can be done as often as needed, within rate limits (429 when exceeded).

5.4 Token structure

The access token carries an entities claim — an array with a single element, corresponding to the entity the credentials were issued for:

Field Type Description
entity_type string Entity type
entity_id integer or null Entity identifier
roles array[string] Full list of roles assigned to the entity
api_user_roles array[string] Subset of roles eligible for API access

The token also carries an auth_method claim set to client_credentials, marking how the token was obtained.


6. Making authorized requests

6.1 Request

GET /api/v1/{endpoint}
Authorization: Bearer {ACCESS_TOKEN}

6.2 Example

curl -X GET 'https://bo_api_url/api/v1/merchant-accounts?clients[]=<CLIENT>' \
  -H 'Authorization: Bearer <ACCESS_TOKEN>'

6.3 Scope

The scope of the request is resolved automatically from the entity carried in the token. There's no need to pass X-ENTITY-TYPE / X-ENTITY-ID headers.

Requesting data belonging to an entity other than the one in the token is rejected (see Errors).

Send requests only to https://bo_api_url: a token used on another partner's domain is rejected with 403 entity_domain_mismatch.


Errors

7. Response code reference

Code Value When it occurs
200 — Request succeeded, within the token's scope
400 invalid_request POST /oauth/token: a required parameter is missing
400 unsupported_grant_type POST /oauth/token: grant_type is not client_credentials
400 — Invalid query parameter, or a merchant/branch outside the token's entity. The body carries message (and errors per parameter) instead of error
401 invalid_client POST /oauth/token: unknown Client ID or wrong Client Secret
401 unauthorized The access token is missing, invalid or has expired
403 no_api_user_roles The entity has no role eligible for API access
403 insufficient_role A role is present, but isn't among the roles allowed for the requested endpoint
403 out_of_entity_scope The request falls outside the scope of the entity carried in the token
403 entity_domain_mismatch The token belongs to another partner — use bo_api_url
403 unknown_host The request was sent to an unknown domain
429 — Too many requests — retry later
503 — Service temporarily unavailable — retry later

Examples:

{ "error": "out_of_entity_scope" }
{
  "message": "The currency field must be an integer.",
  "errors": { "currency": ["The currency field must be an integer."] }
}

8. Additional notes

Access control is enforced at independent levels: the request domain must belong to the token's partner, a role check (api_user_roles) against the endpoint's requirements, and an entity-scope check. Passing one check doesn't guarantee passing the others.


Merchant accounts

9. Merchant balances

9.1 Purpose

Unified endpoint for retrieving merchant balances. Replaces the five separate balance endpoints previously used per entity type. Carries no query logic of its own on the BO API side — the request is proxied to the Balance Service as-is.

9.2 Request

GET /api/v1/merchant-accounts
Authorization: Bearer {ACCESS_TOKEN}

Query parameters

Parameter Type Required Description
clients[] array[integer] no Merchant identifier (client). For merchant_brand and merchant_company entities, omitting this parameter automatically scopes the query to the entity's own client.
date string (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS) no Balance snapshot date. Omitting it returns the current balance.
branch integer no Branch identifier.
currency integer no Currency numeric code (ISO 4217).
integration integer no Provider integration identifier.
provider_id integer no Provider ID.

9.3 Scope resolution

The scope of the query is determined by the entity type carried in the access token:

entity_type Scope resolution
merchant_brand Automatically scoped to its own client, matching entity_id
merchant_company Automatically resolved to a client_id + branch_id pair
wl_partner Automatically scoped to the whitelabel matching entity_id
wl_branch Automatically scoped to its own branch

9.4 Response

{
  "accounts": [
    {
      "country": "KEN",
      "country_name": "Kenya",
      "currency": 404,
      "public_id": "1011104044040000000000XXXXXXXXXXXXXXXXXX",
      "total_amount": "1500.00",
      "hold_amount": "200.00",
      "available_amount": "1300.00",
      "client": 3017,
      "merchant_name": "Demo Merchant",
      "branch": 223,
      "payment_method": 1,
      "payment_method_name": "M-Pesa",
      "provider_id": 9052,
      "provider_id_name": "9052-M-Pesa-KEN"
    }
  ]
}

The date field is present in the response root only when the corresponding query parameter was supplied. Field relationship: available_amount = total_amount − hold_amount.

Note. country carries the short country code; the full name is in the separate country_name field. provider_id carries the Provider ID (gate), with its name in provider_id_name; the naming format depends on the specific provider integration.

9.5 Example requests

No parameters (merchant_brand entity):

curl -X GET 'https://bo_api_url/api/v1/merchant-accounts' \
  -H 'Authorization: Bearer <ACCESS_TOKEN>'

The query is automatically scoped to the entity's own client.

Explicit clients[] and date:

curl -X GET 'https://bo_api_url/api/v1/merchant-accounts?clients[]=1225&date=2026-09-10' \
  -H 'Authorization: Bearer <ACCESS_TOKEN>'

Requesting another merchant's data (merchant_brand entity):

curl -X GET 'https://bo_api_url/api/v1/merchant-accounts?clients[]=3024' \
  -H 'Authorization: Bearer <ACCESS_TOKEN_FOR_A_DIFFERENT_MERCHANT>'

Response: 400 {"message": "clients do not match current merchant brand."}.

Get an access token

Exchanges a client_id / client_secret pair for a JWT access token (OAuth 2.0 Client Credentials Grant). The token is valid for expires_in seconds (1800). No refresh token is issued — request a new token with the same credentials once the current one expires.

Request Body schema:
required
grant_type
required
string
Value: "client_credentials"
client_id
required
string
client_secret
required
string

Responses

Request samples

Content type
No sample

Response samples

Content type
application/json
{
  • "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.xxxxx.xxxxx",
  • "token_type": "Bearer",
  • "expires_in": 1800
}

Get merchant account balances

Unified endpoint for retrieving merchant balances. Replaces the five entity-specific balance endpoints previously used for each entity type. Carries no balance logic of its own — the request is proxied to the Balance Service as-is.

The scope of the query is resolved automatically from the entity carried in the access token; see the scope resolution table for how each entity type is scoped.

Authorizations:
bearerAuth
query Parameters
clients[]
Array of integers
Example: clients[]=3017

Merchant identifiers (client). For merchant_brand and merchant_company tokens it can be omitted — the query is scoped to the entity's own merchant.

date
string
Example: date=2026-10-22

Balance snapshot date, YYYY-MM-DD or YYYY-MM-DD HH:MM:SS. Omit for the current balance.

branch
integer

Branch identifier.

currency
integer
Example: currency=404

Currency numeric code (ISO 4217), e.g. 404 for KES.

integration
integer

Provider integration identifier.

provider_id
integer

Provider ID.

Responses

Response samples

Content type
application/json
{
  • "date": "2026-10-22",
  • "accounts": [
    ]
}