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.
- 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.
- Log in to your M-Pesa Developer Account.
- Open the Go Live section.
- Complete the required testing and approval process.
- Submit your application for production approval.
- Once approved, copy the credentials and Production URL from your M-Pesa account.
- Production API credentials
- Production URL
- Staging credentials (optional, for testing)
Configure M-Pesa in ERPNext
After obtaining your credentials, configure the integration as follows:
- Open M-Pesa Settings.
- Enter all required API credentials.
- Select the appropriate environment:
- Production for live transactions.
- Staging for testing with a separate M-Pesa application.
- Enable the integration.
- Save the document.
- 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.
- Enter the customer’s registered mobile number.
- Click to initiate the payment request.
- The customer receives a payment request in the M-Pesa mobile application.
- After the customer authorizes the payment, ERPNext prompts the cashier to confirm and complete the transaction.
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.
- Open the M-Pesa Settings.
- Click Get Account Balance.
- The latest account balance is displayed on the dashboard.
Supported Transaction Currency
M-Pesa supports transactions only for companies whose Company Currency is set to KSH (Kenyan Shilling).
The M-Pesa integration is designed exclusively for ERPNext POS transactions and is not available for shopping cart or standard eCommerce checkout payments.