Skip to main content

M-Pesa Integration

The M-Pesa Integration enables ERPNext to process payments through the M-Pesa payment gateway. The integration is designed specifically for Point of Sale (POS) transactions, allowing customers to complete payments directly from their M-Pesa mobile application. This integration is not supported for the ERPNext shopping cart.

Summary

  • Integrate ERPNext POS with the M-Pesa payment gateway.
  • Accept customer payments directly through the M-Pesa mobile app.
  • Automatically create the required Payment Gateway, Mode of Payment, and Bank Account records.
  • View your M-Pesa account balance directly from ERPNext.

How to Access M-Pesa Settings

Navigate to:

Integrations > Payments > M-Pesa Settings

Get Your M-Pesa API Credentials

Before configuring ERPNext, obtain your production credentials from your M-Pesa developer account.

  1. Log in to your M-Pesa Developer Account.
  2. Open the Go Live section.
  3. Complete the required testing and approval process.
  4. Submit your application for production approval.
  5. Once approved, copy the credentials and Production URL from your M-Pesa account.
Required Credentials

  • Production API credentials
  • Production URL
  • Staging credentials (optional, for testing)

Configure M-Pesa in ERPNext

After obtaining your credentials, configure the integration as follows:

  1. Open M-Pesa Settings.
  2. Enter all required API credentials.
  3. Select the appropriate environment:
    • Production for live transactions.
    • Staging for testing with a separate M-Pesa application.
  4. Enable the integration.
  5. Save the document.
What Happens Automatically?

  • A Payment Gateway record is created.
  • A Bank account is added to the Chart of Accounts.
  • A Payment Gateway Account is created.
  • A corresponding Mode of Payment is created.
  • Required custom fields are added to the POS Settings for M-Pesa payments.

Configure the Payment Gateway Account

The Payment Gateway Account allows you to manage the financial configuration for M-Pesa payments.

  • Select the bank account used for payment settlement.
  • Configure the default Payment Request email template if required.
  • Manage the payment gateway settings used during transactions.

Once configured, ERPNext is ready to process payments through M-Pesa.

M-Pesa POS Payments

After adding the M-Pesa Mode of Payment to your POS Profile, ERPNext displays an additional payment section during checkout.

  1. Enter the customer’s registered mobile number.
  2. Click to initiate the payment request.
  3. The customer receives a payment request in the M-Pesa mobile application.
  4. After the customer authorizes the payment, ERPNext prompts the cashier to confirm and complete the transaction.
POS Payment Flow

ERPNext sends the payment request directly to the customer’s M-Pesa application, allowing secure payment confirmation without manually entering payment details.

View M-Pesa Account Balance

ERPNext allows you to retrieve your current M-Pesa account balance directly from the M-Pesa gateway.

  1. Open the M-Pesa Settings.
  2. Click Get Account Balance.
  3. The latest account balance is displayed on the dashboard.

Supported Transaction Currency

Supported Currency

M-Pesa supports transactions only for companies whose Company Currency is set to KSH (Kenyan Shilling).

Note

The M-Pesa integration is designed exclusively for ERPNext POS transactions and is not available for shopping cart or standard eCommerce checkout payments.

Rating: 0 / 5 (0 votes)