B2B
By the end of this track you can send money without paying twice.
0/3 finished
Step 1
The idea
Business to business: paying a Paybill or Till, or topping up your own B2C account. Daraja's field is spelled RecieverIdentifierType. Keep that spelling.
Step 2
How it works
When to use it
B2B moves money between shortcodes: paying a supplier's Paybill or Till, or moving money from your collection account to your B2C account so you can pay out.
The request
POST to /mpesa/b2b/v1/paymentrequest. BusinessPayBill pays a Paybill and needs an AccountReference, with RecieverIdentifierType 4. BusinessBuyGoods pays a Till, with RecieverIdentifierType 2. BusinessPayToBulk tops up your own B2C utility account. The initiator needs the B2B role.
{ "Initiator": "testapi", "SecurityCredential": "<encrypted password>", "CommandID": "BusinessPayBill", "SenderIdentifierType": "4", "RecieverIdentifierType": "4", "Amount": 10, "PartyA": "600996", "PartyB": "600000", "AccountReference": "INV-77", "Remarks": "Supplier invoice 77", "QueueTimeOutURL": "https://your-domain.example/b2b/timeout", "ResultURL": "https://your-domain.example/b2b/result"}Same rules as B2C
Same initiator and SecurityCredential, the same two-step answer, and the same unknown-outcome care from P2.
Step 3
Try it
600000 is a sandbox test shortcode.
$ mpesa pay b2b 600000 10
With the MCP server, ask your agent to use mpesa_b2b_payment
Step 4
Common mistakes
- Correcting
RecieverIdentifierTypeto "Receiver". Daraja rejects it. - Paying a Paybill without an account reference, so the supplier can't match it.
- Sending identifier type
4for a Till. Tills use2.
Go deeper
Why not fix the spelling of RecieverIdentifierType?
Answer in your own words first.
Show the answerHide the answer
Daraja rejects the corrected name.