Skip to content

Real-Python-Projects/Mpesa-Wth-rest-framework-Djangoi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quick start

  1. Install the package with pip like this:

    pip install django-mpesa
  2. Add "mpesa" to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'mpesa',
    ]
  3. Add Mpesa Config variables to your project's settings.py file

    MPESA_CONFIG = {

    ... 'CONSUMER_KEY': '<Your consumer key from daraja>', 'CONSUMER_SECRET': '<Your consumer secret from daraja>', 'HOST_NAME': '<Your hostname e.g https://myhostname>', 'PASS_KEY': '<Your pass key from daraja>', 'SAFARICOM_API': 'https://sandbox.safaricom.co.ke', 'SHORT_CODE': '174379'

    }

    Check below for full setting variables description

  4. Include the polls URLconf in your project urls.py like this:

    from django.urls import path, include
    from mpesa.urls import mpesa_urls
    
    path('mpesa/', include(mpesa_urls)),
  5. Run python manage.py migrate to create the mpesa models.
  6. Start the development server and visit http://127.0.0.1:8000/admin/
  7. Visit http://127.0.0.1:8000/mpesa/ to checkout the library features.

API ENDPONTS

This module exposes some API endpoints that enable you work with MPESA API

  1. mpesa/submit/

    This endpoint allows you to submit a post request to initiate an STK push

  2. mpesa/confirm/

    This endpoint is used as the callback endpoint on which MPESA will return a transaction response/status

  3. mpesa/check-transaction/

    This endpoint allows you to manually check for the status of an mpesa transaction

About

These is mpesa intergration app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages