A python package to easy push payment integration with Tola Payments with Mpesa, TigoPesa, and AirtelMoney Tanzania
Project description
Tola Payments Python Package
A python package to easy push payment integration with Tola Payments with Mpesa, TigoPesa, and AirtelMoney Tanzania. You can easily charge a customer's phone number with a specified amount, and the package will handle the necessary details to make the payment using the Tola Mobile API. No need to integrate each MNO individualy.
Installation To install the Tola Payments package, run the following command:
pip install tola_payments
Usage
Configuration
To use the package, you need to set up your Tola Mobile API credentials in a .env file. Add the following variables to your .env file: To use the Tola Payments package, you first need to import it into your Python code. Here's an example:
TOLA_USERNAME= TOLA_PASSWORD= VODA_TARGET= TIGO_TARGET= AIRTEL_TARGET= TOLA_LIVE_URL =
Next, create an instance of the TolaPayments class, providing your Tola Mobile API credentials:
from tolapyments import TolaPayments
tolapayments = TolaPayments(is_sandbox=True)
Note that the is_sandbox parameter specifies whether you're using the Tola Mobile sandbox environment or the live environment. If you're using the sandbox environment, set is_sandbox to True. Otherwise, set it to False and provide the live API URL via the TOLA_LIVE_URL environment variable.
To charge a customer, call the charge_customer method on your TolaPayments instance, passing in the customer's phone number, the amount to charge, and a source reference
response =tolapayments.charge_costomer(amount="1000",phone_number="+25561189850", sourcereference='4546f56543poF66')
print(response.text)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tola_payments-0.1.4.tar.gz
.
File metadata
- Download URL: tola_payments-0.1.4.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed70f03ee8a42d5d88c816e81041edb49a144a716925ce1a80b9221a037be172 |
|
MD5 | d2f7e23bf66349f8edfd78b97d792d84 |
|
BLAKE2b-256 | 4ecb614da79961f88d871e7e73009244713ec93343213253d5401e4a50ee9534 |
File details
Details for the file tola_payments-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: tola_payments-0.1.4-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fe2392df70c62d5a2a5fc1b49f34111e02d96c61d05f49ec36179f8d9d6a4e5 |
|
MD5 | 9ad092304dca6e4a8ff75abe355e9b56 |
|
BLAKE2b-256 | dfc8138eade5e062de0e3435559b6a635d6cd42ac191d83c07677f4964b2f527 |