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;
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 ?
- Create payment token
- Verify token
- Redirect to DPO payment page
- Fetch response
- Done
Example of usage
>>> 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 = token.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:
- kalebu
- Novath Thomas
- and all the contributors
Metadata
Release files for DirectPayOnline 0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| DirectPayOnline-0.4.tar.gz | 8.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| DirectPayOnline-0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.7 kB
Release files / DirectPayOnline-0.4.tar.gz
| Download URL | DirectPayOnline-0.4.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86d98ca7d27bb23b276651b79e94767cbf517373805f1486f5a99bffa136b8e6
|
|
BLAKE2b-256 checksum How to use checksums |
c482b0116e8876c8124e12f34c0599b2ca8c353041753e1cee17e1fddebbee93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10
|
Release files / DirectPayOnline-0.4-py3-none-any.whl
| Download URL | DirectPayOnline-0.4-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
59a38d3eb202e830367aefb06364d3d8efd38687b55ea59c749cb4e405d2520d
|
|
BLAKE2b-256 checksum How to use checksums |
ce8fce165d1a642b567997a01e453c480c0f234b4711c6fe04b1bdab2f8703bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.10
|
Security for DirectPayOnline 0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.