A python package to easy the integration with Direct Online Pay (Mpesa, TigoPesa, AirtelMoney, Card Payments)

Overview

python-dpo

Downloads Downloads Downloads

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;

Getting started

To gets started with python-dpo you need to install the package first, here how;

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;

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

>> transtoken = response.get('API3G')['TransToken'] >>> dpo.create_payment_url(transtoken) 'https://secure.3gdirectpay.com/payv2.php?ID=1D0CC035-40E5-44A3-B5EF-034A34AD33E9' ">
>>> 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)
'https://secure.3gdirectpay.com/payv2.php?ID=1D0CC035-40E5-44A3-B5EF-034A34AD33E9'

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 community

Give it a star

Was this useful to you ? Then give it a star so that more people can make use of this.

Credits

An inspiration for this came from dpo-php Thanks to amazing work made by Novath Thomas and Alpa Olomi.

All the credits to:

You might also like...
This is simple maker for level card in discord bot.
This is simple maker for level card in discord bot.

mariocard This is simple maker for level card in discord bot in discord.py or pycord. Installing Python 3.8 or higher is required # Linux/macOS pip3 i

This checks that your credit card is valid or not

Credit_card_Validator This checks that your credit card is valid or not. Where is the app ? main.exe is the application to run and main.py is the file

Generate direct m3u playlist for all the channels subscribed in the Tata Sky portal
Generate direct m3u playlist for all the channels subscribed in the Tata Sky portal

Tata Sky IPTV Script generator A script to generate the m3u playlist containing direct streamable file (.mpd or MPEG-DASH or DASH) based on the channe

A simple Telegram bot that converts a phone number to a direct whatsapp chat link
A simple Telegram bot that converts a phone number to a direct whatsapp chat link

Open in WhatsApp I was using a great app to open a whatsapp chat with a given number directly without saving that number in my contact list, but I fel

A telegram bot that can upload telegram media files to anonfiles.com and give you direct download link

✯ AnonFilesBot ✯ Telegram Files to AnonFiles Upload Bot It will Also Give Direct Download Link Process : Fork This Repositry And Simply Cick On Heroku

This Telegram bot allows you to create direct links with pre-filled text to WhatsApp Chats

WhatsApp API Bot Telegram bot to create direct links with pre-filled text for WhatsApp Chats You can check our bot here. The bot is based on the API p

A script to generate the m3u playlist containing direct streamable file (.mpd or MPEG-DASH or DASH) based on the channels that the user has subscribed on the Tata Sky portal. You just have to login using your password or otp that's it . This bot is created by AJTimePyro and It accepts direct downloading url & then return file as telegram file.
This bot is created by AJTimePyro and It accepts direct downloading url & then return file as telegram file.

URL Uploader Bot This is the source code of URL Uploader Bot. And the developer of this bot is AJTimePyro, His Telegram Channel & Group. You can use t

Simple Telegram Bot to extract various types of archives from a telegram file or a direct link

Unzipper Bot A Telegram Bot to Extract Various Types Of Archives Features Extract various types of archives like rar, zip, tar, 7z, tar.xz etc. Passwo

Comments
  • Unable to use Sandbox = True

    Unable to use Sandbox = True

    hello, I am implementing DPO's payment gateway in my site.

    I would like to make test transactions using the test credentials that they have provided in their documentation in the credentials sections. here https://docs.paygate.co.za/#testing

    I am also not able to use these creds in the sandbox = False mode.

    opened by ghost 1
Releases(v0.2)
  • v0.2(Nov 14, 2021)

    New features and refactoring

    • email_to_token()
    • mvisa_create_qrcode()
    • refund_token()
    • verify_token()
    • update_token()
    • verify_xpay
    • cancel_token()
    • mobile_payment_options()
    • charge_token_auth()
    • bank_transfer_options()
    • charge_credit_card()
    Source code(tar.gz)
    Source code(zip)
  • v0.1(Nov 12, 2021)

Owner
NEUROTECH
Our Mission elevate Africa innovation to the world through technology and artificial intelligence
NEUROTECH
A simple weather information tool.

pwy A simple weather information tool. Table of Contents Features Dependencies Installation Usage Update Changelog Credits License Features ASCII art

Clint 105 Dec 31, 2022
Yes, it's true :revolving_hearts: This repository has 301 stars.

Yes, it's true! Inspired by a similar repository from @RealPeha, but implemented using a webhook on AWS Lambda and API Gateway, so it's serv

511 Dec 30, 2022
Asynchronous Python Wrapper for the GoFile API

Asynchronous Python Wrapper for the GoFile API

Gautam Kumar 22 Aug 04, 2022
Lib for create and show QRCode to PIX, you can show this code in another applications for payment by final consumer.

Biblioteca para a geração de codigos QR (BRCode como chamados na documentação do BACEN) a fins de facilitar a exibição para pagamentos ao consumidor.

João Camargo 13 Oct 05, 2022
Telegram Voice Chat Music Player UserBot Written with Pyrogram Smart Plugin and tgcalls

Telegram Voice Chat UserBot A Telegram UserBot to Play Audio in Voice Chats. This is also the source code of the userbot which is being used for playi

Dash Eclipse 7 May 21, 2022
Easy to use API Wrapper for somerandomapi.ml.

Overview somerandomapi is an API Wrapper for some-random-api.ml Examples Asynchronous from somerandomapi import Animal

Myxi 1 Dec 31, 2021
A Python wrapper for the Yelp API v2

python-yelp-v2 A Python wrapper for the Yelp API v2. The structure for this was inspired by the python-twitter library, and some internal methods are

Matthew Conlen 12 Oct 24, 2017
Community-based extensions for the python-telegram-bot library.

Community-based extensions for the python-telegram-bot library. Table of contents Introduction Installing Getting help Contributing License Introducti

74 Dec 24, 2022
A file-based quote bot written in Python

Let's Write a Python Quote Bot! This repository will get you started with building a quote bot in Python. It's meant to be used along with the Learnin

A . S . M . RADWAN 2 Apr 03, 2022
⚔️ Fastest tibia bot API

📝 Description tibia bot api using python ⌨ Development ⚙ Running the app python bot.py ✅ ROADMAP Add confidence to floor level to have more accuracy

Lucas Santos 133 Dec 28, 2022
A Python library for miHoYo bbs and HoYoLAB Community

A Python library for miHoYo bbs and HoYoLAB Community. genshin 原神签到小助手

384 Jan 05, 2023
An API wrapper around the pythonanywhere's API.

pyaww An API wrapper around the pythonanywhere's API. The name stands for pythonanywherewrapper. 100% API coverage Most of the codebase is documented

7 Dec 11, 2022
TwitterBot-ImageCollector - Twitter bot that collects images from likes saves the image

TwitterBot-ImageCollector Bot de Twitter que recolecta imagenes a partir de los

Gx3 Studios 4 Jun 01, 2022
Python SDK for Facebook's Graph API

Facebook Python SDK This client library is designed to support the Facebook Graph API and the official Facebook JavaScript SDK, which is the canonical

Mobolic 2.7k Jan 07, 2023
Stream Telegram files to web

Telegram File Stream Bot A Telegram bot to stream files to web Demo Bot » Report a Bug | Request Feature Table of Contents About this Bot Original Rep

Wrench 572 Jan 09, 2023
AWS SQS event redrive Lambda With Python

AWS SQS event redrive Lambda This repository contains one simple AWS Lambda function in Python to redrive AWS SQS events from source queue to destinat

1 Oct 19, 2021
Celestial - a Python regex Discord chatbot who can talk with you.

Celestial a Python regex Discord chat bot who can talk with you. Invite url: https://discord.com/api/oauth2/authorize?client_id=927573556961869825&per

Jirayu Kaewsing 3 Jan 01, 2023
Download archived malware from ActiveState's source code mirror

malware-archivist (ma) Tool to aid security researchers in dissecting malware. Often, repository maintainers will remove malicious packages entirely f

ActiveState Software 28 Dec 12, 2022
A code to match you with the perfect Taylor Swift song for your mood and relationship status.

taylorswift A package for matching your current mood and relationship status to a suitable Taylor Swift song. Requirements: Python 2 or 3, and the num

Megan Mansfield 82 Dec 09, 2022
Forked from 0x36 on github who then rewrote the ida_kernelcache python framework

Forked from 0x36 on github who then rewrote the ida_kernelcache python framework. Sadly 0x36 doesn't seem to have push updates to the project and it took me a very long time to figure out why this wa

Turnerhackz1 6 Dec 13, 2022