Frappe Mpsa Payments is a Frappe-based application that integrates with Safaricom's Daraja API, providing tools to manage and reconcile Mpesa payments within Frappe ecosystem. This app is designed for businesses using Mpesa's C2B(Customer-to-Business) and Mpesa Express payment solutions, enabling the easy setup of Mpesa payment settings, URL registration and reconciliation of payments.
- Mpesa Settings: Configure credentials for Safaricom's Daraja API for Mpesa Express, Mpesa C2B and Mpesa B2C
- Mpesa C2B Payment Register URL: Enables C2B payment setup, allowing the registration of URLs for incoming Mpesa payments.
- Mpesa C2B Payment Register: Records individual incoming payments recieved via the C2B callback.
- Mpesa Payment Reconciliation: View and reconcile draft Mpesa payments with unpaid sales invoices.
This DocType is central to configuring Safaricom's Daraja API credentials, allowing for seamless integration of various Mpesa payment services (Mpesa Express, C2B, and B2C). This DocType holds the necessary credentials and identifiers for authentication and payment initiation.
- API Type: Select the type of Mpesa API integration you’re setting up (Mpesa Express, C2B, or B2C).
- Consumer Key: A unique key provided by Safaricom to authenticate API calls.
- Consumer Secret: A secret code paired with the Consumer Key to secure API access.
- Security Credential: Encryption credential used for additional security, particularly in B2C transactions.
- Till Number: Identifier for C2B payments, where customers make payments directly to a till.
- Business Shortcode: A unique code used to identify your business account in the Mpesa system.
- Online PassKey: An additional authentication key, specifically for initiating Mpesa Express (STK Push) transactions.
This DocType registers the callback URLs for incoming C2B payments. Once registered, Safaricom will notify your app when payments are received, enabling real-time reconciliation.
- Mpesa Settings: Links to the configured Mpesa Settings, pulling in the necessary credentials.
- Company: Specifies the company associated with the payment registration.
- Mode of Payment: Identifies the payment mode for better categorization in your accounting or ERP system.
- Register Status: Displays the status of the URL registration (e.g., Success, Pending), useful for troubleshooting or verification.
This DocType records individual incoming payments via the C2B method, capturing essential details from Safaricom’s Daraja API. This data can be used for transaction verification, customer inquiries, and reconciliation with unpaid invoices.
- Full Name: Customer’s full name as recorded in the Mpesa transaction.
- Transaction Type: Type of transaction (typically "Pay Bill" or "Buy Goods").
- Trans ID: Unique transaction ID generated by Mpesa.
- Trans Time: Timestamp of the transaction.
- Trans Amount: Amount transferred by the customer.
- Business Short Code: The business shortcode involved in the transaction.
- Bill Ref Number: Reference number associated with the transaction.
- Invoice Number: Associated invoice for easy reconciliation.
- Org Account Balance: Account balance at the time of the transaction.
- Third Party Trans ID: Identifier from any third-party integration.
- Posting Date & Time: Date and time when the transaction was recorded in your system.
- Company: The company receiving the payment.
- Default Currency: The currency in which the transaction was processed.
- Customer: Links to the customer making the payment.
- Mode of Payment: Type of payment method used.
- Currency: The currency in which the transaction was processed.
This DocType is used to store the required public key certificates for both sandbox and production environments. These certificates are necessary to establish secure connections between your system and Mpesa’s API, especially for encrypting sensitive information in B2C transactions.
- Sandbox Certificate: Used for testing in the Daraja sandbox environment.
- Production Certificate: Used for live transactions in the production environment.
The Payment Gateway DocType facilitates the integration of Mpesa with your ERPNext system’s payment gateways, enabling transactions to be routed correctly.
- Gateway Settings: Contains necessary settings for the payment gateway to work with Mpesa.
- Gateway Controller: Manages the routing and processing of payments through the specified payment gateway.
This DocType lists and organizes draft Mpesa payments, making it possible to reconcile these draft(s) mpesa payments with pending/unpaid invoices. This DocType streamlines the reconciliation process by matching Mpesa transactions with unpaid sales invoices.
- Customer: Links to the customer who has any outstanding invoices.
- Company: The company to which the payment(s) and invoice(s) applies.
- Currency: The currency in which the transaction occured.
- Invoices: Displays a list of associated unpaid invoices.
- Mpesa Payments: Displays a list of draft Mpesa payments.
- Ensure you have a working Frappe and ERPNext instance
- Clone this repository into your Frappe bench apps directory.
bench get-app https://github.com/navariltd/frappe-mpsa-payments.git
- Install the app into your site
bench --site [your-site-name] install-app frappe_mpsa_payments
- Configure the "Mpesa Settings" doctype with appropriate values.
agpl-3.0