Skip to main content

M-Pesa paybill setup and go-live

Connect your Safaricom paybill to Metron: credentials, Save and test, register C2B URLs, the go-live check and what to do when Safaricom already holds URLs.

3 min readUpdated 2026-11-20Owner / AdminAccountant

Without a paybill, payments cannot post. Do this before you tell customers to pay.

What you need from Safaricom#

  • Your paybill (shortcode)
  • Daraja API consumer key and consumer secret
  • The passkey for STK push
  • Whether you are on sandbox or production

Add the paybill#

  1. Open SettingsIntegrations Console (or SettingsM-Pesa / Daraja).
  2. Add a connection of kind M-Pesa Paybill.
  3. Enter the shortcode, consumer key, consumer secret, passkey and environment.
  4. Choose which branches it serves, or make it your default.
  5. Press Save & test. Metron signs in to Daraja with your key and secret. The passkey is only shape-checked, because it can only be proven with a real STK prompt.

The connection should show Working.

Register the C2B URLs#

C2B URLs tell Safaricom where to send payment notifications.

  1. On the paybill connection, press Register C2B URLs.
  2. Expected result: "C2B URLs registered".

The URLs end in a key specific to your paybill. A payment is accepted only if it arrives through them.

If Safaricom says it already holds URLs#

Safaricom kept older URLs for this shortcode. If the paybill was used with another system, email apisupport@safaricom.co.ke from the paybill owner's address and ask them to change the Confirmation and Validation URLs to the two shown on screen.

A payment that arrives without a valid key#

It is held, not credited and not lost. The customer is never bounced at the till. A critical event is raised and the finance check "C2B inbox drained" fails until someone resolves it. If it was a real payment, confirm it against your M-Pesa statement. If nobody paid, it was a forgery and nothing happened.

Test it#

0 of 4 done

Several paybills#

You can connect more than one, for example one per branch. Each payment resolves to its owner from the shortcode Safaricom sends. A shortcode that no ISP owns is refused and held for a person to resolve.

If payments are not arriving#

  1. Is the paybill Working? Open the failure details.
  2. Credentials rejected: edit, paste the new key and secret, Save & test, then Register C2B URLs again.
  3. STK push fails with "integration not configured": the branch has no paybill and you have no default. Set one.
  4. Payments missing from the ledger: look for unverified or failed items in the inbox. See Unassigned payments and exceptions.
Something missing or wrong in this guide?WhatsApp usEmail feedback