POST: Pay Hero Wallet- Withdraw To Bank
This end point is used to withdraw funds from your payments wallet to Bank
Request Method
Endpoint enables you to withdraw funds to Bank
POST https://backend.payhero.co.ke/api/v2/withdraw
Headers
Authorization:*
String
Basic basicAuthToken
Request Body
external_reference
String
Your unique reference to track this transaction Eg: INV-009
amount*
Integer
Eg: 100
account_number*
String
Eg: 9762536252625,
This represents the bank account number.
network_code*
String
A unique digit code is used for identifying the various banks.
Refer to the list below
callback_url
String
Your endpoint URL that we will use to send payment status response eg: https://example.com/callback.php
channel*
String
Value: bank
channel_id
Integer
Your payment wallet channel ID
payment_service
String
Value: b2c
{
    "status": "QUEUED",
    "merchant_reference": "W5ZBQBHJOS",
    "checkout_request_id": "553125-97e66f37-200d-47ef-84bb-eb9b64ab8ad5",
    "response_code": "0",
    "conversation_id": "97e66f37-200d-47ef-84bb-eb9b64ab8ad5"
}Bank Network Codes
- 01 KCB 
- 02 Standard Chartered Bank KE 
- 03 Absa Bank 
- 07 NCBA 
- 10 Prime Bank 
- 11 Cooperative Bank 
- 12 National Bank 
- 14 M-Oriental 
- 16 Citibank 
- 18 Middle East Bank 
- 19 Bank of Africa 
- 23 Consolidated Bank 
- 25 Credit Bank 
- 31 Stanbic Bank 
- 35 ABC Bank 
- 36 Choice Microfinance Bank 
- 43 Eco Bank 
- 50 Paramount Universal Bank 
- 51 Kingdom Bank 
- 53 Guaranty Bank 
- 54 Victoria Commercial Bank 
- 55 Guardian Bank 
- 57 I&M Bank 
- 61 HFC Bank 
- 63 DTB 
- 65 Mayfair Bank 
- 66 Sidian Bank 
- 68 Equity Bank 
- 70 Family Bank 
- 72 Gulf African Bank 
- 74 First Community Bank 
- 75 DIB Bank 
- 76 UBA 
- 78 KWFT Bank 
- 89 Stima Sacco 
- 97 Telcom Kenya 
Sample Code
This represents PHP Curl example of how to make the request, you can implement this in your specific language of choice
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://backend.payhero.co.ke/api/v2/withdraw',
  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 =>'{
    "external_reference": "TX1234ABCre55",
    "account_number": "1000188171991", 
    "bank_account_name": "NCBA Bank",
    "amount": 100,
    "network_code": "07", 
    "callback_url": "https://example.com",
    "channel": "bank",
    "channel_id":12345,
    "payment_service": "b2c"
}
',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Authorization: Basic 3A6anVoWFZrRk5qSVl0MGNMOERGMlR3dlhrQ0VWUWJHNDVVVnNaMEdDSw=='
  ),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Callback URL Response Sample
This represents the JSON that will be sent to your request callback_url
{
  "forward_url": "",
  "response": {
    "Amount": 50,
    "CheckoutRequestID": "cbb768d1-7803-4436-b793-f9df65e716a2",
    "ExternalReference": "TX1234ABCre55",
    "MerchantRequestID": "3F7CORFVG3",
    "RecipientAccountNumber": "9918191819181918",
    "ResultCode": 0,
    "ResultDesc": "Transaction processed successfully.",
    "Status": "Success",
    "TransactionID": "SAJ1I2SQ43"
  },
  "status": true
}Last updated
Was this helpful?
