2025-03-30 13:26:31 +02:00
2025-03-30 13:23:45 +02:00
---
2025-03-30 12:46:54 +02:00
2025-03-30 13:26:31 +02:00
**License:** GNU General Public License v3.0 (consistent with Dolibarr’ s open-source framework)
2025-03-30 12:46:54 +02:00
2025-03-30 13:23:45 +02:00
#### Overview
2025-03-30 13:26:31 +02:00
Dolipesa 1.0.1 is a tailored payment module that seamlessly integrates M-Pesa, a widely used mobile payment platform in East Africa, with Dolibarr ERP/CRM. This first release empowers businesses to accept M-Pesa payments for invoices, orders, and other transactions directly within Dolibarr, utilizing its native payment infrastructure and M-Pesa’ s API for a streamlined experience.
2025-03-30 12:46:54 +02:00
2025-03-30 13:23:45 +02:00
#### Features
1. **M-Pesa Payment Gateway Integration**
2025-03-30 13:26:31 +02:00
- Employs M-Pesa’ s STK Push API to prompt customers for PIN entry on their mobile devices.
- Facilitates payments for invoices and sales orders within Dolibarr.
- Supports Kenyan Shilling (KES), with plans for broader currency compatibility in future updates.
2025-03-30 12:46:54 +02:00
2025-03-30 13:23:45 +02:00
2. **Payment Confirmation**
2025-03-30 13:26:31 +02:00
- Verifies transactions in real-time via M-Pesa’ s callback/result URL.
- Automatically updates Dolibarr invoice/order statuses (e.g., "Draft" to "Paid") upon payment success.
2025-03-30 12:46:54 +02:00
2025-03-30 13:23:45 +02:00
3. **Basic Configuration**
2025-03-30 13:26:31 +02:00
- Offers an admin panel to input M-Pesa API credentials (Consumer Key, Consumer Secret, Shortcode, Passkey).
- Allows customization of the payment description shown to customers during STK Push.
2025-03-30 12:46:54 +02:00
2025-03-30 13:23:45 +02:00
4. **Transaction Logging**
2025-03-30 13:26:31 +02:00
- Logs M-Pesa transaction IDs and statuses in Dolibarr for easy reconciliation and tracking.
2025-03-30 12:45:40 +02:00
2025-03-30 13:23:45 +02:00
5. **Public Payment Page**
2025-03-30 13:26:31 +02:00
- Enhances Dolibarr’ s `/public/payment/newpayment.php` endpoint to include M-Pesa as a payment option.
2025-03-30 13:23:45 +02:00
#### Requirements
- **Dolibarr Version:** 19.0.* or higher (tested up to 20.0.0 as of March 30, 2025).
2025-03-30 13:26:31 +02:00
- **PHP Version:** 7.4 or later (aligned with Dolibarr’ s specifications).
- **M-Pesa API Access:**
- Safaricom Daraja API credentials (Consumer Key, Consumer Secret, Shortcode, Passkey).
2025-03-30 13:23:45 +02:00
- A registered callback URL hosted on your Dolibarr server.
2025-03-30 13:26:31 +02:00
- **Server:** HTTPS-enabled (mandatory for secure API communication).
- **Dependencies:** PHP cURL extension for API interactions.
2025-03-30 13:23:45 +02:00
#### Installation Instructions
1. **Download the Module**
2025-03-30 13:26:31 +02:00
- Get the `dolipesa-1.0.1.zip` file from [Your Repository/Dolistore Link].
2025-03-30 13:23:45 +02:00
2. **Install the Module**
2025-03-30 13:26:31 +02:00
- Log into Dolibarr as an administrator.
- Go to **Home > Setup > Modules > Deploy/Install External App/Module** .
- Upload `dolipesa-1.0.1.zip` and click **Install** .
- If upload issues occur, manually unzip the file into `/custom` (e.g., `/var/www/dolibarr/custom/dolipesa` ).
2025-03-30 13:23:45 +02:00
3. **Activate the Module**
2025-03-30 13:26:31 +02:00
- Navigate to **Home > Setup > Modules** .
- Find "Dolipesa - M-Pesa Payment," click **Activate** , and adjust settings as needed.
2025-03-30 13:23:45 +02:00
#### Configuration
1. **Obtain M-Pesa API Credentials**
2025-03-30 13:26:31 +02:00
- Sign up at [developer.safaricom.co.ke ](https://developer.safaricom.co.ke ).
- Acquire a Consumer Key, Consumer Secret, and Passkey.
- Set a callback URL (e.g., `https://your-dolibarr-domain.com/custom/dolipesa/callback.php` ).
2025-03-30 13:23:45 +02:00
2. **Set Up in Dolibarr**
2025-03-30 13:26:31 +02:00
- Go to **Home > Setup > Modules > Dolipesa - M-Pesa Payment > Configure** .
- Input your Shortcode, Consumer Key, Consumer Secret, Passkey, and Callback URL.
- Save your settings.
2025-03-30 13:23:45 +02:00
3. **Test the Integration**
2025-03-30 13:26:31 +02:00
- Generate a test invoice in Dolibarr.
- Visit the public payment page (e.g., `https://your-dolibarr-domain.com/public/payment/newpayment.php?source=invoice&ref=INVREF` ).
- Choose "M-Pesa," enter a test phone number, and confirm the STK Push in a test M-Pesa account.
2025-03-30 13:23:45 +02:00
#### Usage
2025-03-30 13:26:31 +02:00
- **For Customers:**
- Select "M-Pesa" on the payment page, input your phone number, and approve the STK Push notification.
- **For Admins:**
- Track transactions via **Bank & Cash > M-Pesa Transactions** (a new module-added tab).
2025-03-30 13:23:45 +02:00
#### Technical Notes
2025-03-30 13:26:31 +02:00
- **Hook Implementation:** Integrates with Dolibarr’ s "newpayment" hooks at `/public/payment/newpayment.php` , setting session variables (`TRANSACTIONID` , `FinalPaymentAmt` , `currencyCodeType` ) per Dolibarr’ s payment documentation.
- **API Calls:** Leverages M-Pesa’ s OAuth token and STK Push endpoints (e.g., `https://sandbox.safaricom.co.ke/mpesa/stkpush/v1/processrequest` for testing).
- **Security:** Enforces HTTPS for API calls; encrypts API credentials in Dolibarr’ s database.
2025-03-30 13:23:45 +02:00
#### Known Limitations (1.0.1)
2025-03-30 13:26:31 +02:00
- Limited to KES transactions.
- Basic error handling without retry for failed STK Push attempts.
2025-03-30 13:23:45 +02:00
- Sandbox mode only (production requires Safaricom approval).
#### Changelog
- **1.0.1 (March 30, 2025):**
2025-03-30 13:26:31 +02:00
- Resolved callback URL validation issue.
- Marked as the initial stable release post-1.0.0 beta.
2025-03-30 13:23:45 +02:00
#### Future Enhancements (Planned for 1.1.0)
2025-03-30 13:26:31 +02:00
- Multi-currency support with conversion.
- Retry mechanism for failed transactions.
- Payment success email notifications for customers.
2025-03-30 13:23:45 +02:00
#### Support
2025-03-30 13:26:31 +02:00
- Submit issues or feature requests to [support@nestict.com ](mailto:support@nestict.com ).
- Access documentation at [https://www.community.nestict.com/dashboard ](https://www.community.nestict.com/dashboard ).
---