M‑Pesa

M‑Pesa Integration Steps

Set up payments for your pledge drives using Paybill, Till (Buy Goods), or STK Push.

Overview

Pledge Drive supports three ways to receive donations with M‑Pesa:

  • STK Push – Prompt donors’ phones for quick checkout.
  • Paybill (C2B) – Donors pay to your Paybill Short Code.
  • Buy Goods (Till) – Donors pay to your Till Number.

Create a Safaricom App (Daraja)

  1. Go to developer.safaricom.co.ke and sign in.
  2. Create an application and enable required APIs: C2B and Lipa na M‑Pesa Online (STK Push).
  3. Copy your Consumer Key and Consumer Secret.
  4. If using STK Push, note your Passkey.

Configure in Pledge Drive

  1. Open Settings → Payments in your dashboard.
  2. Paste Consumer Key, Consumer Secret, and STK Passkey (if using STK Push).
  3. Enable your preferred methods: Paybill and/or Buy Goods, then fill the ShortCode / Till Number.
  4. Optionally, set a Webhook Token for added security.

Register C2B URLs (Paybill/Till)

If you use Paybill or Till, register your C2B URLs in Daraja to receive confirmations:

  • Validation URL: https://YOUR_DOMAIN/c2b/validation
  • Confirmation URL: https://YOUR_DOMAIN/c2b/confirmation

Replace YOUR_DOMAIN with your deployed host. In development, prefer STK Push.

Using STK Push

With credentials set, Pledge Drive can initiate STK Push requests for pledges and for subscription upgrades.

  • Ensure phone numbers are in 07xx or 2547xx format.
  • STK callbacks are handled at: /mpesa/stk/callback

Tips & Troubleshooting

  • Use production credentials and Short Codes when going live.
  • Whitelist your callback domain in Daraja if required.
  • Check the dashboard’s Payments card for which methods are enabled.
  • For help, email support@pledgedrive.app.