Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
      • Get a Tailored Demo
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +32 2 290 34 90
    • Get a Tailored Demo
  • Pricing
  • Help
  1. APPS
  2. Extra Tools
  3. M-Pesa C2B Connector v 16.0
  4. Sales Conditions FAQ

M-Pesa C2B Connector

by Metro Ict Limited https://odoo.co.ke
Odoo

$ 330.81

v 16.0 Third Party
Apps purchases are linked to your Odoo account, please sign in or sign up first.
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies • Invoicing (account)
• Discuss (mail)
• Contacts (contacts)
Community Apps Dependencies Show
KE C2B Common (M-Pesa/Kopo Kopo)
Lines of code 674
Technical Name payment_mpesa_c2b
LicenseOPL-1
Websitehttps://odoo.co.ke
Versions 16.0
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies • Invoicing (account)
• Discuss (mail)
• Contacts (contacts)
Community Apps Dependencies Show
KE C2B Common (M-Pesa/Kopo Kopo)
Lines of code 674
Technical Name payment_mpesa_c2b
LicenseOPL-1
Websitehttps://odoo.co.ke
Versions 16.0
  • Description
  • Documentation
  • License
Price:
$329.00 USD
Supports:
Community
Enterprise
Availability:
On Premise
Odoo.sh
Odoo Online

M-Pesa • Integration

M-Pesa C2B Connector

Seamlessly integrate Safaricom M-Pesa PayBill and BuyGoods payments into Odoo accounting. Automates C2B transaction processing with intelligent payment reconciliation and partner matching.

Hero
  • Screenshots
  • Features
  • FAQs
  • Releases

☁️Compatibility

Verified support across different Odoo environments

Community
Enterprise
Odoo.sh
Not supported on Odoo Online

📸 Screenshots

Visual guide to M-Pesa C2B Connector functionality

M-Pesa Daraja Configuration

PayBill configuration with Daraja API credentials and C2B URL registration.

M-Pesa configuration

C2B Callback Processing

Live C2B webhook processing showing payment creation and partner matching.

C2B callback processing

Payment Metadata Fields

Account payment form displaying M-Pesa transaction metadata and reconciliation status.

Payment form fields
📱 C2B Processing
  • 📡 /callback/c2b webhook handler
  • 💰 PayBill/BuyGoods automation
✨ Smart Reconciliation
  • 🪄 Reconciliation wizard interface
  • 🔗 Auto-reconciliation for existing partners
🦁 Daraja API
  • 🔗 C2B URL registration
  • 🧪 C2B payment simulation
📊 Transaction Tracking
  • 🔍 Complete M-Pesa metadata capture
  • 📄 Invoice integration methods

No. Python backend controllers not allowed.

Yes, separate configurations per company.

OAuth authentication with business short code validation.

Minor updates free; major upgrades require new purchase.

Latest Release 18.0.1.0.0

2024-12-27
Add
  • Initial release with Daraja API integration and C2B processing.
  • Reconciliation wizard and automated payment posting.
  • Comprehensive M-Pesa transaction tracking.

📅 Changelog

v16.0.1.0.0
2025-08-22
🚀 Initial Release
  • ➕ Add Full automation workflows
  • ⚡ Improve Performance & stability enhancements

📜 Licensing

License Type
OPL-1
Redistribution
Not Allowed
Full Policy
View Policy
Important: This module is distributed under OPL-1. Redistribution in any form is strictly prohibited. Please review our full license policy for complete terms and conditions.

💬 Support & Contact

Email support@odoo.co.ke
Website https://odoo.co.ke/helpdesk
Phone +254739444447
Response Time 1 business day SLA
🎁 90-day complimentary support included with your purchase

M-Pesa C2B Connector

M-Pesa C2B Connector

Version: 16.0.1.0.0 Author: Metro Ict Limited Website: https://odoo.co.ke License: OPL-1

Overview

The M-Pesa C2B Connector is a comprehensive Odoo module that seamlessly integrates Safaricom M-Pesa PayBill and BuyGoods payments into your Odoo accounting system. This module automates the entire customer-to-business (C2B) payment workflow, from webhook reception to payment reconciliation, eliminating manual data entry and reducing accounting errors.

Features

Webhook Integration - Automatic C2B webhook callback handling at /callback/c2b - Real-time payment processing and recording - Support for both PayBill and BuyGoods transactions - Comprehensive payload validation and error handling - Support for both sandbox and production environments

Payment Processing - Automatic creation of payment records from M-Pesa webhooks - Intelligent partner matching using phone number hashing - Auto-creation of new partners with customer names from M-Pesa data - Automatic payment posting and journal entry creation - Transaction reference tracking and metadata storage

Daraja API Integration - Full integration with Safaricom's Daraja API - OAuth token management for secure API authentication - C2B URL registration for webhook endpoints - Transaction simulation for testing - Support for multiple business short codes

Enhanced Payment Records - Extended payment model with M-Pesa-specific fields - Complete transaction metadata storage (TransID, MSISDN, etc.) - Customer name tracking (FirstName, MiddleName, LastName) - Bill reference number and invoice tracking - Raw payload storage for audit and debugging - Transaction timestamp preservation

Reconciliation Tools - Dedicated reconciliation wizard for unmatched payments - Manual partner assignment capabilities - Bulk payment processing and reconciliation - Auto-reconciliation status tracking - Phone number hash updates for future matching

Configuration Management - Easy-to-use configuration interface in Accounting settings - Environment switching (Sandbox/Production) - Multiple business short code support - Journal assignment for payment recording - Webhook URL configuration and testing

How It Works

1. Configuration Setup The module provides a configuration model (mpesa.paybill.config) where you set up:

  • Environment (Sandbox/Production)
  • Business Short Code (PayBill number)
  • Till Number (for BuyGoods)
  • Daraja API credentials (Consumer Key and Secret)
  • Journal for recording payments
  • Callback URL for webhook notifications

2. Daraja API Registration Once configured, the module can register your webhook URLs with Safaricom:

  • Obtains OAuth token using consumer credentials
  • Registers Confirmation and Validation URLs
  • Stores registration status for monitoring
  • Enables webhook reception from M-Pesa

3. Payment Processing Flow When a customer makes an M-Pesa payment to your PayBill/Till:

  1. Safaricom sends a webhook to your configured callback URL
  2. The module validates the webhook payload and required fields
  3. Extracts transaction details (amount, phone number, reference, etc.)
  4. Normalizes and hashes the customer's phone number
  5. Searches for existing partner using phone number hash
  6. Creates new partner with customer names if not found
  7. Creates and posts payment record in Odoo
  8. Returns success/error response to Safaricom

4. Partner Matching The module uses intelligent partner matching:

  • Normalizes Kenyan phone numbers to standard format (+254...)
  • Creates secure hashes of phone numbers for privacy
  • Matches payments to existing partners using phone hashes
  • Falls back to legacy hash formats for backward compatibility
  • Auto-creates partners with full names from M-Pesa data

5. Reconciliation Workflow For unmatched or disputed payments:

  • Use the reconciliation wizard to manually assign partners
  • Bulk process multiple unreconciled payments
  • Update phone hashes for future automatic matching
  • Track reconciliation status and history

Installation

Prerequisites

  • Odoo 18.0 or later
  • payment_c2b_common_ke module (dependency)
  • account module (standard Odoo module)
  • l10n_ke module (Kenyan localization)
  • Active Safaricom M-Pesa PayBill or BuyGoods account
  • Daraja API credentials from Safaricom
  • Public-facing server for webhook callbacks

Installation Steps

  1. Download and Install

    Place the module in your Odoo addons directory:

    # Copy module to addons directory
    cp -r payment_mpesa_c2b /path/to/odoo/addons/
    
  2. Update Module List

    In Odoo, go to Apps → Update Apps List

  3. Install Module

    Search for "M-Pesa C2B Connector" and click Install

  4. Install Dependencies

    Ensure the following modules are installed: - payment_c2b_common_ke - account (usually pre-installed) - l10n_ke (Kenyan localization)

Configuration

Initial Setup

  1. Navigate to Configuration

    Go to: Accounting → Configuration → M-Pesa → Paybill

  2. Create New Configuration

    Click "Create" and fill in the required fields:

    • Name: Descriptive name for your configuration
    • Environment: Choose Sandbox for testing, Production for live
    • Journal: Select the bank journal for recording payments
    • Business Short Code: Your PayBill number from Safaricom
    • Till Number: Your Till number (for BuyGoods, optional)
    • Consumer Key: Your Daraja API Consumer Key
    • Consumer Secret: Your Daraja API Consumer Secret
    • Callback URL: Your webhook endpoint (e.g., https://yourdomain.com/callback/c2b)
  3. Register C2B URLs

    Click "Register C2B URLs" to register your webhook with Safaricom

Daraja API Setup

  1. Get API Credentials

    • Visit https://developer.safaricom.co.ke
    • Create an account and new app
    • Note down Consumer Key and Consumer Secret
  2. Configure Webhook URL

    Your callback URL should be publicly accessible and point to: https://yourdomain.com/callback/c2b

  3. Test Configuration

    • Use "Test Webhook" to verify your endpoint
    • Use "Simulate C2B" to test with Safaricom's sandbox

Usage

Daily Operations

Viewing Payments - Go to Accounting → Customers → Payments - M-Pesa payments will have additional fields populated - Filter by "M-Pesa" or use advanced filters

Partner Management - Partners are automatically created from M-Pesa customer data - Phone numbers are normalized and hashed for matching - Customer names are extracted from FirstName, MiddleName, LastName

Reconciliation - Access reconciliation wizard from payment records - Go to Accounting → M-Pesa → Reconciliation (if menu exists) - Assign partners to unreconciled payments - Process multiple payments in bulk

Monitoring - Check C2B registration status in configuration - Monitor payment creation in real-time - Review raw payloads for debugging

Advanced Features

Multiple Business Codes - Configure multiple PayBill/Till numbers - Each configuration can have different journals - Automatic routing based on business short code

Reconciliation Wizard - Bulk assignment of partners to payments - Phone hash updates for future matching - Status tracking and reporting

Testing Tools - Webhook testing with sample payloads - C2B transaction simulation - Registration status monitoring

Troubleshooting

Common Issues

  1. Webhook Not Receiving Data - Verify callback URL is publicly accessible - Check SSL certificate validity - Ensure no firewall blocking Safaricom IPs - Verify business short code matches PayBill number
  2. Daraja API Errors - Verify Consumer Key and Secret are correct - Check environment setting (sandbox vs production) - Ensure API credentials are active - Review registration status messages
  3. Payment Creation Failures - Check journal configuration and permissions - Verify currency settings match KES - Review Odoo logs for detailed error messages - Ensure required fields are present in webhook
  4. Partner Matching Issues - Verify phone number normalization - Check hash generation for phone numbers - Review partner creation logic - Use reconciliation wizard for manual assignment

Webhook Payload Validation The module validates these required fields: - TransID (Transaction ID) - TransAmount (Amount) - MSISDN (Phone number) - TransTime (Transaction timestamp) - BusinessShortCode (PayBill/Till number)

Log Monitoring Enable debug logging for detailed webhook processing:

_logger = logging.getLogger(__name__)
# Check logs in Odoo for C2B processing details

API Reference

Webhook Endpoint - URL: /callback/c2b - Method: POST - Content-Type: application/json - Authentication: None (public endpoint)

Expected Payload Format:

{
  "TransactionType": "PayBill",
  "TransID": "NLJ3H6KZ8A",
  "TransTime": "20250515123045",
  "TransAmount": "2500.00",
  "BusinessShortCode": "174379",
  "BillRefNumber": "TEST1234",
  "MSISDN": "254716680977",
  "FirstName": "Jane",
  "MiddleName": "M.",
  "LastName": "Doe"
}

Response Codes: - {"ResultCode": "0", "ResultDesc": "Accepted"} - Success - {"ResultCode": "C2B00011", "ResultDesc": "Invalid JSON"} - JSON parsing error - {"ResultCode": "C2B00012", "ResultDesc": "Missing required fields"} - Validation error

Support

For technical support and questions:

  • Website: https://odoo.co.ke
  • Email: support@odoo.co.ke
  • Phone: +254739444447
  • Author: Metro Ict Limited
  • Module Version: 16.0.1.0.0

Documentation - Safaricom Daraja API: https://developer.safaricom.co.ke - Odoo Payment Documentation: https://www.odoo.com/documentation/

License

This module is licensed under OPL-1 (Odoo Proprietary License v1.0).

Changelog

Version 16.0.1.0.0 - Initial release for Odoo 18.0 - Full C2B webhook integration - Daraja API integration - Payment processing and posting - Partner matching and creation - Reconciliation wizard - Configuration management interface - Testing and simulation tools - Comprehensive M-Pesa metadata tracking

Odoo Proprietary License v1.0

This software and associated files (the "Software") may only be used (executed,
modified, executed after modifications) if you have purchased a valid license
from the authors, typically via Odoo Apps, or if you have received a written
agreement from the authors of the Software (see the COPYRIGHT file).

You may develop Odoo modules that use the Software as a library (typically
by depending on it, importing it and using its resources), but without copying
any source code or material from the Software. You may distribute those
modules under the license of your choice, provided that this license is
compatible with the terms of the Odoo Proprietary License (For example:
LGPL, MIT, or proprietary licenses similar to this one).

It is forbidden to publish, distribute, sublicense, or sell copies of the Software
or modified copies of the Software.

The above copyright notice and this permission notice must be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author or have a question related to your purchase, please use the support page.
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with