Title: Mastering Safaricom B2C: How to Configure G2 Portal Operators for Automated Payouts Tags: #mpesa, #php, #fintech, #api

Published: (May 8, 2026 at 05:35 PM EDT)
2 min read
Source: Dev.to

Source: Dev.to

How to Set Up a B2C Operator in the Safaricom M-PESA G2 Portal

If you are working with the Daraja B2C (Business to Customer) API, you’ve probably realized that having a working Paybill is only half the battle. To actually send money out (disbursements), you need an Initiator—a specific digital identity authorized to move funds.

If you’re seeing errors like “Invalid Access Token” or “Initiator Information,” follow the steps below to configure the initiator correctly in the M‑PESA G2 Portal.

Access the G2 Portal

  1. Log into the M‑PESA G2 Portal at org.ke.m-pesa.com.
  2. Use your Organization Admin credentials (the primary account Safaricom provided when your Paybill or Till was first created).

Create the Operator (The “Initiator”)

  1. Navigate to User ManagementCreate Operator.
  2. Username – Choose a distinct name (e.g., Devmaster2). This is the value you will use in your code as InitiatorName.
  3. Role – Assign Business Manager or Business Contributor.
    • Business Manager is recommended because it allows the API to both initiate transactions and view transaction status.

Set and Encrypt the Password

  1. After creating the operator, log in as that new user.
  2. Set a permanent password for the operator.
  3. Do not store the plain password in your code.
  4. Encrypt the password using Safaricom’s Public Key Certificate to generate the Security Credential required by the API.

The Shortcut

Manually handling token generation, password encryption, and other Daraja authentication steps can be time‑consuming and error‑prone. Consider using a unified gateway such as OptimaPay Bridge, which automates token generation and security credential creation, letting you focus on your business logic.

0 views
Back to Blog

Related posts

Read more »