M-Pesa Trigger
AI-generatedSummary
Listen for specific M-Pesa Daraja API callback events by configuring a webhook that triggers on chosen transaction types, optionally filtering for only successful transactions and normalizing the output format.
Inputs
- Event (required) — Select the M-Pesa callback event to listen for, such as Payment Received, STK Push Completed, B2C Completed, B2B Completed, Reversal Completed, Account Balance Completed, or Transaction Status Completed.
- Only Successful Transactions — Optionally restrict triggering to only successful transactions where ResultCode equals 0.
- Normalize Output — Choose whether to transform the raw callback payload into a consistent, normalized data structure for easier processing.
Output shape
a single item with JSON data containing the callback payload, either normalized or raw depending on the 'Normalize Output' setting
If 'Only Successful Transactions' is enabled, the trigger ignores callbacks with non-zero ResultCode and does not forward data. The webhook acknowledges all callbacks with a 'ResultCode: 0, ResultDesc: Accepted' response to M-Pesa.
Examples
Example 1: Trigger on a successful Payment Received event and receive a normalized JSON object detailing the transaction, including transaction ID, type, amount, phone number, status, timestamp, and original raw payload.
Set Event to 'Payment Received', enable 'Only Successful Transactions' to true, keep 'Normalize Output' true.