Cuoral
Background
Left vector overlay
Right vector overlay
Bubble background decoration

M-Pesa Integration Guide

Automatically detect payment failures and recover failed transactions

40% of churn in Kenya is involuntary — failed M-Pesa payments that customers never report. This integration helps you catch them automatically.

What You'll Need

  • M-Pesa business account (Paybill or Till)
  • API credentials from Safaricom Developer Portal
  • Cuoral Pro or Enterprise plan
  • ~10 minutes

Setup Steps

1

Get API Credentials

Go to Safaricom Developer Portal and create an app.

Copy your Consumer Key and Consumer Secret.

2

Connect in Cuoral

In Cuoral: Settings → Integrations → Payment Gateways → Connect M-Pesa

3

Configure Webhook

Copy your Cuoral webhook URL and paste it in Safaricom's Callback URL settings.

Important: Without the callback URL, M-Pesa won't notify Cuoral about payment events.

4

Map Customer Phone Numbers

Cuoral automatically matches payments if customer phone numbers are stored in your database. Format: 254XXXXXXXXX

5

Set Up Payment Alerts

Create an alert for failed payments:

"Hi [Name] ⚠️ Your M-Pesa payment for [Product] failed. Retry here: [link]"

What Cuoral Tracks

  • Payment success/failure status
  • Failure reasons (insufficient balance, timeout, etc.)
  • Payment timing and patterns
  • All data feeds into customer health scores

Troubleshooting

Payments not showing in Cuoral?

Check that callback URL is set correctly in Safaricom portal

Wrong customers matched?

Verify phone numbers match M-Pesa format (254XXXXXXXXX)