Logo Lanfrica

Neurotech-HQ/python-dpo

Domain:

digital infrastructure

Record type:

software
Creator:
Neu
Host:
A python package to easy the integration with Direct Online Pay (Mpesa, TigoPesa, AirtelMoney, Card Payments) # python-dpo A python package to easy the integration with Direct Online Pay (DPO) which easily allow you easily integrate with payment options once without having to deal with each of them individually; - Mpesa - TigoPesa - AirtelMoney - Card Payments - MasterCard - Visa - American Express - Orange Money - MTN MOMO ## Getting started To gets started with python-dpo you need to install the package first, here how; ```bash pip install DirectPayOnline --upgrade ``` ## Configuring .env You can configure some variables directly on **.env** file and so they will be loaded by the dotenv package. Here some of importants of things you to configure; ```bash COMPANY_TOKEN=9F416C11-127B-4DE2-AC7F-D5710E4C5E0A CURRENCY=TZS ADDRESS=Tanzania SERVICE_TYPE=3854 COMPANY_REFERENCE=34TESTREFF ``` ## How does it work ? 1. Create payment token 2. Verify token 3. Redirect to DPO payment page 4. Fetch response 5. Done ## Example of usage ```python >>> from dotenv import load_dotenv >>> load_dotenv() # loading environment variables >>> from DirectPayOnline import DPO >>> dpo = DPO(sandbox=False) >>> response = dpo.create_token( { 'amount': 400, "service_description": "Sarufi.io subscription" } ) >>> transtoken = response.get('API3G')['TransToken'] >>> dpo.create_payment_url(transtoken) 'secure.3gdirectpay.com' ``` When a user visit a payment_url, he/she will have an option to pay through preffered payment option, where if its a mastercard or visa or mobile money (Mpesa, TigoPesa, AirtelMoney). ## Issues ? If you encounter any issue with the usage of the package, please raise one so as we can fix it as soon as possible. ## Contributions **Python-DPO** is an opensource project under MIT Public LICENSE, contributions of any kind are welcomes from; - fixing Typos - improving documentation - writing detailed example usecases - fixing bugs and adding new features - sharing with your developer friends and communit …