Register Payment Channel

Get to easily register your payment channel e.g.: MPESA Pay bill, Till number or bank account on Pay Hero,

Register Channel

POST

https://backend.payhero.co.ke/api/v2/payment_channels

You can register paybill,till or bank

Headers

Name
Value

Content-Type

application/json

Authorization

Basic <token>

Body

Name
Type
Description

channel_type

string

Can be: paybill, till or bank

account_id

number

Your pay Hero account id, you can check your profile details to get it.

short_code

number

Your MPESA paybill, till or bank paybill number

account_number

string

Your bank account number or paybill account number (if any)

description

string

Your bank name or beneficiary name for till or paybill

Response

{
    "id": 2429,
    "transaction_type": "CustomerPayBillOnline",
    "channel_type": "bank",
    "account_id": 5000,
    "short_code": "522522",
    "account_number": "1280006242",
    "description": "KCB Bank",
    "is_active": true,
    "balance_plain": null,
    "created_at": "2025-06-05T14:56:01.513658753Z",
    "updated_at": "2025-06-05T14:56:01.513658753Z"
}

Sample Code-PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://backend.payhero.co.ke/api/v2/payment_channels',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "channel_type": "bank",
    "account_id": 5000,
    "short_code": "522522", 
    "account_number": "1280006242",
    "description": "KCB Bank" 
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic cmpTWVWREVOdEZzZDV5cg=='
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Last updated

Was this helpful?