Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuel-mwendwa authored Oct 30, 2024
1 parent e2f2d29 commit 074197f
Showing 1 changed file with 104 additions and 2 deletions.
106 changes: 104 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,109 @@
## Frappe Mpsa Payments

Frappe Mpsa Payments
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.

## Features

- **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 Payments DocType:** View and reconcile draft Mpesa payments with unpaid sales invoices

## Key Functions
#### DocTypes
<h4>Mpesa Settings</h4>

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.

1. **API Type:** Select the type of Mpesa API integration you’re setting up (Mpesa Express, C2B, or B2C).
2. **Consumer Key:** A unique key provided by Safaricom to authenticate API calls.
3. **Consumer Secret:** A secret code paired with the Consumer Key to secure API access.
4. **Security Credential:** Encryption credential used for additional security, particularly in B2C transactions.
5. **Till Number:** Identifier for C2B payments, where customers make payments directly to a till.
6. **Business Shortcode:** A unique code used to identify your business account in the Mpesa system.
7. **Online PassKey:** An additional authentication key, specifically for initiating Mpesa Express (STK Push) transactions.

![Screenshot from 2024-10-30 15-55-09](https://github.com/user-attachments/assets/f786501f-5c5d-4c27-9a62-ba3d76ce9562)


<h4>Mpesa C2B Payment Register URL</h4>

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.

1. **Mpesa Settings:** Links to the configured Mpesa Settings, pulling in the necessary credentials.
2. **Company:** Specifies the company associated with the payment registration.
3. **Mode of Payment:** Identifies the payment mode for better categorization in your accounting or ERP system.
4. **Register Status:** Displays the status of the URL registration (e.g., Success, Pending), useful for troubleshooting or verification.

![Screenshot from 2024-10-30 15-56-11](https://github.com/user-attachments/assets/a30279f5-0fd7-4543-8a0a-1b8a8e2ec363)

<h4>Mpesa C2B Payment Register</h4>

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.

1. **Full Name:** Customer’s full name as recorded in the Mpesa transaction.
2. **Transaction Type:** Type of transaction (typically "Pay Bill" or "Buy Goods").
3. **Trans ID:** Unique transaction ID generated by Mpesa.
4. **Trans Time:** Timestamp of the transaction.
5. **Trans Amount:** Amount transferred by the customer.
6. **Business Short Code:** The business shortcode involved in the transaction.
7. **Bill Ref Number:** Reference number associated with the transaction.
8. **Invoice Number:** Associated invoice for easy reconciliation.
9. **Org Account Balance:** Account balance at the time of the transaction.
10. **Third Party Trans ID:** Identifier from any third-party integration.
11. **Posting Date & Time:** Date and time when the transaction was recorded in your system.
12. **Company:** The company receiving the payment.
13. **Default Currency:** The currency in which the transaction was processed.
14. **Customer:** Links to the customer making the payment.
15. **Mode of Payment:** Type of payment method used.
16. **Currency:** The currency in which the transaction was processed.

![Screenshot from 2024-10-30 16-02-55](https://github.com/user-attachments/assets/5eb459ae-ccfb-4a47-bcae-e6c43b397594)

<h4>Mpesa Public Key Certificate</h4>

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.

1. **Sandbox Certificate:** Used for testing in the Daraja sandbox environment.
2. **Production Certificate:** Used for live transactions in the production environment.

![Screenshot from 2024-10-30 16-05-19](https://github.com/user-attachments/assets/ab93b070-75df-4e76-81e5-2179cfefcffd)

<h4>Payment Gateway</h4>

The Payment Gateway DocType facilitates the integration of Mpesa with your ERPNext system’s payment gateways, enabling transactions to be routed correctly.

1. **Gateway Settings:** Contains necessary settings for the payment gateway to work with Mpesa.
2. **Gateway Controller:** Manages the routing and processing of payments through the specified payment gateway.

![Screenshot from 2024-10-30 16-06-27](https://github.com/user-attachments/assets/03d795f3-1b44-4011-8c9f-330ea747a09c)

<h4>Mpesa Payments</h4>

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.

1. **Customer:** Links to the customer who has any outstanding invoices.
2. **Company:** The company to which the payment(s) and invoice(s) applies.
3. **Currency:** The currency in which the transaction occured.
4. **Invoices:** Displays a list of associated unpaid invoices.
5. **Mpesa Payments:** Displays a list of draft Mpesa payments.

![Screenshot from 2024-10-30 16-07-48](https://github.com/user-attachments/assets/1a61bdce-529e-411f-9a70-1d6a6170ca4e)

## Installation
1. Ensure you have a working Frappe and ERPNext instance
2. Clone this repository into your Frappe bench apps directory.

```
git clone https://github.com/navariltd/frappe-mpsa-payments.git
```

3. Install the app into your site
```
bench --site [your-site-name] install-app frappe-mpsa-payments
```
4. Configure the "Mpesa Settings" doctype with appropriate values.


#### License

agpl-3.0
agpl-3.0

0 comments on commit 074197f

Please sign in to comment.