MyChurchDocs

STK push

A payment prompt on the member's phone: they pick the account and amount in the app or on USSD, and M-Pesa asks for their PIN. No paybill number or account number to type.

Where prompts come from

  • Giving in the app: make-payment/{account}, for one account, several accounts at once, or on behalf of another person (Member App API: Giving).
  • Event fees and event support, class fees, parking, merchandise orders and fundraiser contributions in the app.
  • The USSD giving menu ("Mpesa From This Number" or "From a different Number").
POSThttps://uat-api.mychurch.co.ke/api/v2/make-payment/{account}Member token
bash
curl -X POST https://uat-api.mychurch.co.ke/api/v2/make-payment/00000000-0000-4000-8000-0000000000c1 \
  -H "Authorization: Bearer $MEMBER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"amount": 1000, "phone": "254712345678"}'

What happens

  1. The API records a payment request and answers the app at once with status: true. The app tells the member to check their phone.
  2. In the background, MyChurch sends the prompt with the church's paybill credentials: CustomerPayBillOnline for a paybill, CustomerBuyGoodsOnline for a till. The account reference is the collection account number, or a generated MP- / OP- number for split and on-behalf payments.
  3. The member enters their M-Pesa PIN (or cancels, or ignores it).
  4. Safaricom posts the result to MyChurch's STK callback. The result is matched to the request by Safaricom's CheckoutRequestID. A cancelled or failed prompt credits nothing.
  5. A completed prompt becomes a payment claim like any other and goes through verification before it is credited and receipted.

Requirements

  • The paybill has a passkey stored and payment prompts allowed (Paybill setup).
  • The amount is a whole number of shillings, at least KES 1.
  • The phone is a Safaricom line; 07..., 01... and 2547... forms are accepted.
  • Collection accounts tied to a bank account rather than a paybill push through the bank instead (Equity or KCB), where the church has that integration.

Accounts with no payment channel

If a collection account has neither a paybill nor a bank account, the member gets the church's payment instructions by SMS instead of a prompt.

Troubleshooting

  • No prompt appears: the phone may be off or not on Safaricom, or STK is off for the paybill. Nothing is charged.
  • Prompt paid, no receipt yet: verification usually completes within a minute. If the paybill has no initiator stored, it waits; see Paybill setup.
  • Paid twice: each prompt is a separate M-Pesa transaction; both are credited. Refunds are made by the church from M-Pesa.