Skip to main content
Glama
B2CAccountTopUp.md11.9 kB
# B2CAccountTopUp **Source:** https://developer.safaricom.co.ke/apis/B2CAccountTopUp --- [![safaricom logo](../images/B2CAccountTopUp_img_0.svg)](/) HomeAPIsDashboardMarketplaceFAQsMiniApps Log Out 1. Discover APIs 2. / 3. B2C Account Top Up ![](../images/B2CAccountTopUp_img_1.svg) ###### B2C Account Top Up By Safaricom This API enables you to load funds to a B2C shortcode directly for disbursement. POST https://sandbox.safaricom.co.ke/mpesa/b2b/v1/paymentrequest Use API Get Started in 3 easy steps ![simulator-progress](../images/B2CAccountTopUp_img_2.svg) Open Simulator API DocumentationError Overview This API enables you to load funds to a B2C shortcode directly for disbursement. The transaction moves money from your MMF/Working account to the recipient’s utility account. Request Body { "Initiator":"testapi", "SecurityCredential":"IAJVUHDGj0yDU3aop/WI9oSPhkW3DVlh7EAt3iRyymTZhljpzCNnI/xFKZNooOf8PUFgjmEOihUnB24adZDOv3Ri0Citk60LgMQnib0gjsoc9WnkHmGYqGtNivWE20jyIDUtEKLlPr3snV4d/H54uwSRVcsATEQPNl5n3+EGgJFIKQzZbhxDaftMnxQNGoIHF9+77tfIFzvhYQen352F4D0SmiqQ91TbVc2Jdfx/wd4HEdTBU7S6ALWfuCCqWICHMqCnpCi+Y/ow2JRjGYHdfgmcY8pP5oyH25uQk1RpWV744aj2UROjDrxTnE7a6tDN6G/dA21MXKaIsWJT/JyyXg==", "CommandID":"BusinessPayToBulk", "SenderIdentifierType":"4", "RecieverIdentifierType":"4", "Amount":"239", "PartyA":"600979", "PartyB":"600000", "AccountReference":"353353", "Requester":"254708374149", "Remarks":"OK", "QueueTimeOutURL":"https://mydomain/path/timeout", "ResultURL":"https://mydomain/path/result" } Request Parameter Definition | | | | | | --- | --- | --- | --- | | **Name** | **Description** | **Type** | **Sample Values** | | CommandID | For this API use **BusinessPayToBulk**only. | String | BusinessPayToBullk | | Initiator | The M-Pesa API operator username. This user needs Org Business Pay to Bulk API initiator role  on M-Pesa | String | Username, user\_name | | SecurityCredential | The encrypted password of the M-Pesa API operator. The process for encrypting the initiator password has been described under docs. An online encryption tool is available under the test credentials section. | String | 32SzVdmCvjpmQfw3X2RK8UAv7xuhhkgjfgHAJSGFA.../ Gulsuiduisa304dXxFC5+3lslkk2TDJY/Lh6ESVwtq== | | PartyA | Your shortcode. The shortcode from which money will be deducted. | Number | Shortcode (5-6 digits) e.g., 600979 | | SenderIdentifierType | The type of shortcode from which money is deducted. For this API, only "4" is allowed. | Number | 4 | | PartyB | The shortcode to which money will be moved | Number | 600000 | | RecieverIdentifierType | The type of shortcode to which money is credited. This API supports type 4 only | Number | 4 | | Requester | Optional. The consumer’s mobile number on behalf of whom you are paying. | Mobile | 254708374149 | | Amount | The transaction amount. | Number | 300 | | Remarks | Any additional information to be associated with the transaction. | String | Sentence of up to 100 characters. | | QueueTimeOutURL | A URL that will be used to notify your system in case the request times out before processing. | URL | https://ip or domain: port/path | | ResultURL | A URL that will be used to send transaction results after processing. | URL | https://ip or domain: port/path | Response Body { "OriginatorConversationID": "5118-111210482-1", "ConversationID": "AG\_20230420\_2010759fd5662ef6d054", "ResponseCode": "0", "ResponseDescription": "Accept the service request successfully." } Repsonse Parameter Definition | | | | | | --- | --- | --- | --- | | **Name** | **Description** | **Type** | **Sample Values** | | OriginatorConverstionID | Unique request identifier assigned by Daraja upon successful request submission. | String | String of less then 20 characters | | ConversationID | Unique request identifier assigned by M-Pesa upon successful request submission. | String | AG\_1234567789099B3 | | ResponseCode | Status code for request submission. 0(zero) indicates successful submission. | String | 0 | | ResponseDescription | A descriptive message of the request submission status. | String | Accept the service request successfully. | Successful Result Body { "Result": { "ResultType": "0", "ResultCode":"0", "ResultDesc": "The service request is processed successfully", "OriginatorConversationID":"626f6ddf-ab37-4650-b882-b1de92ec9aa4", "ConversationID":"12345677dfdf89099B3", "TransactionID":"QKA81LK5CY", "ResultParameters": { "ResultParameter": [{ "Key":"DebitAccountBalance", "Value":"{Amount={CurrencyCode=KES, MinimumAmount=618683, BasicAmount=6186.83}}" }, { "Key":"Amount", "Value":"190.00" }, { "Key":"DebitPartyAffectedAccountBalance", "Value":"Working Account|KES|346568.83|6186.83|340382.00|0.00" }, { "Key":"TransCompletedTime", "Value":"20221110110717" }, { "Key":"DebitPartyCharges", "Value":"" }, { "Key":"ReceiverPartyPublicName", "Value":000000– Biller Companty }, { "Key":"Currency", "Value":"KES" }, { "Key":"InitiatorAccountCurrentBalance", "Value":"{Amount={CurrencyCode=KES, MinimumAmount=618683, BasicAmount=6186.83}}" }] }, "ReferenceData": { "ReferenceItem":[ {"Key":"BillReferenceNumber", "Value":"19008"}, {"Key":"QueueTimeoutURL", "Value":"https://mydomain.com/b2b/businessbuygoods/queue/"} ] } } } Successful Result Parameter Definition | | | | | | --- | --- | --- | --- | | **Name** | **Description** | **Type** | **Sample Values** | | Result | The root parameter encloses the entire result message. | JSON Object | "Result":{ } | | ResultType | A status code indicating whether the transaction was already sent to your listener. The usual value is 0. | Number | 0 | | ResultCode | A transaction result status code. 0(zero) indicates successful processing. | Number | 0 | | ResultDesc | A descriptive message for the transaction result. | String | The service request is processed successfully. | | OriginatorConversationId | Unique request identifier assigned by API gateway upon successful request submission. | String | AG\_2376487236\_126732989KJHJKH | | ConversationId | Unique request identifier assigned by M-Pesa upon successful request submission. | String | 236543-276372-2 | | TransactionID | Unique M-PESA transaction ID for the payment request. | String | LHG31AA5TX | | ResultParameters | This is a JSON object that holds more details for the transaction. | JSON Object | "Result":{"ResultParameters":{"":[ ]}} | | ResultParameter | A JSON array within the ResultParameters that holds additional transaction details as JSON objects. | JSON Object | "Result":{"ResultParameters":{"ResultParameter":[ ]}} | | TransactionID | Unique M-PESA receipt number for the payment request. | String | LHG31AA5TX | | Amount | The transaction amount that was transacted. Returned as one of the key-value objects under the ResultParameter array. | Number | 100 | | TransactionCompletedTime | A 14-digit timestamp indicating the date and time the transaction completed on M-PESA. Returned as one of the key-value objects under the ResultParameter array. | Number | 20171206163233 | | ReceiverPartyPublicName | The public name of the credit party/organization. Returned as one of the key-value objects under the ResultParameter array. | String | 600000 - saf test org | | DebitPartyCharges | Transaction fee deducted on the debit party if applicable. Value is empty if no charges apply. Returned as one of the key-value objects under the ResultParameter array. | Number | 1 | | Currency | A currency code of the transaction amount. Returned as one of the key-value objects under the ResultParameter array. | String | KES | | DebitPartyAffectedAccountBalance | The balance in the organization's account from which funds were deducted under the shortcode. Returned as one of the key-value objects under the ResultParameter array. | String | Working Account|KES|500000.00|599490.00|0.00|0.00 | | DebitAccountCurrentBalance | The balance in the organization's account from which funds were deducted under the shortcode. Returned as one of the key-value objects under the ResultParameter array. | String | {Amount={CurrencyCode=KES, MinimumAmount=59949000, BasicAmount=599490.00}} | | InitiatorAccountCurrentBalance | The balance in the organization accounts from which funds were deducted under the shortcode. Returned as one of the key-value objects under the ResultParameter array. | String | {Amount={CurrencyCode=KES, MinimumAmount=59949000, BasicAmount=599490.00}} | | ReferenceData | This JSON object holds more details for the transaction reference data. | JSON Object | "ReferenceData": {"ReferenceItem": []} | | ReferenceItem | A JSON array that holds JSON Objects with additional transaction details. | | ReferenceItem": [{"Key": "BillReferenceNumber", "Value": "19008" }, {"Key": "", "Value": "" }]] | Unsuccessful Result Body { "Result": { "ResultType":0, "ResultCode":2001, "ResultDesc":"The initiator information is invalid.", "OriginatorConversationID":"12337-23509183-5", "ConversationID":"AG\_20200120\_0000657265d5fa9ae5c0", "TransactionID":"OAK0000000", "ResultParameters":{ "ResultParameter":{ "Key":"BillReferenceNumber", "Value":12323333 } }, "ReferenceData":{ "ReferenceItem":[ { "Key":"BillReferenceNumber", "Value":12323333 }, { "Key":"QueueTimeoutURL", "Value":"https://internalapi.safaricom.co.ke/mpesa/abresults/v1/submit" } { "Key":"Occassion" } ] } } } Failed Result Parameter Definition | | | | | | --- | --- | --- | --- | | **Name** | **Description** | **Type** | **Sample Values** | | Result | The root parameter encloses the entire result message. | JSON Object | "Result":{ } | | ConversationId | This is a global unique identifier for the transaction request returned by the M-Pesa upon successful request submission. | String | 236543-276372-2 | | OriginatorConversationId | This is a global unique identifier for the transaction request returned by the API proxy upon successful request submission. | String | AG\_2376487236\_126732989KJHJKH | | ResultDesc | This is a message from the API that gives the status of the request processing and usually maps to a specific result code value. | String | The initiator information is invalid. | | ResultType | This is a status code that indicates whether the transaction was already sent to your listener. Usual value is 0. | Number | 0 | | ResultCode | This is a numeric status code that indicates the status of the transaction processing. 0 means success and any other code means an error occurred or the transaction failed. | Number | 2001 | | ResultParameters | This is a JSON object that holds more details for the transaction  in a key-value format. | JSON Object | ResultParameters:{"ResultParameter":{"Key":"BOCompletedTime","Value":20200120164825}} | | TransactionID | Unique M-PESA transaction ID for the payment request. A generic value is passed for certain failure scenarios. | String | OAK0000000 | | ReferenceData | This JSON object holds more details for the transaction reference data. | JSON Object | "ReferenceData": {"ReferenceItem": []} | | ReferenceItem | A JSON array within the that holds JSON Objects with additional transaction details | | ReferenceItem": [{"Key": "BillReferenceNumber", "Value": "19008" }, {"Key": "", "Value": "" }]] | Daraja 3.0 Daraja 3.0 is a web platform that offers access to Safaricom and M-PESA APIs that creates a bridge for payment integration to web and mobile apps. By connecting to our APIs, you open a world of possibilities to you and your clients. Together, we can transform lives. Discover more [Privacy Policy](/terms) [Terms and Conditions](/terms) Copyright@Safaricom PLC 2025 Ask Daraja about anything 😊 ![chatbot icon](../images/B2CAccountTopUp_img_3.svg) Logout of Daraja? If you Logout, you will be required to Login again to access some features. CancelLogout

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/JacksCodeVault/mpesa-daraja-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server