Actions12
- Account Actions
- B2B Actions
- B2C Actions
- C2B Actions
- Identity Actions
- Pull API Actions
- STK Push Actions
C2B → Simulate
AI-generatedSummary
Simulate a Customer to Business (C2B) transaction in the M-Pesa sandbox environment to test payment processing flows.
Inputs
- Short Code (required) — Your M-Pesa Paybill or Till number to which the simulated payment is directed.
- Amount (required) — The amount of money to simulate transferring.
- Phone Number (required) — Customer phone number initiating the transaction, formatted as 2547xxxxxxxx.
- Transaction Type (required) — Type of C2B transaction to simulate, either 'Pay Bill' for payments to Paybill numbers or 'Buy Goods' for payments to Till numbers.
- Bill Reference Number — Optional account number or reference for the transaction; if omitted, a default value 'Test' is used.
Output shape
a single record containing the API response JSON for the simulated transaction
Returns the response from the M-Pesa C2B simulation endpoint, indicating success or failure of the simulated transaction. This operation is only available in the sandbox environment.
Examples
Example 1: Simulate a payment of 100 KES from a customer with phone number 254712345678 to Paybill number 123456
Set Short Code to 123456, Amount to 100, Phone Number to 254712345678, Transaction Type to 'Pay Bill', and optionally provide a Bill Reference Number.