Skip to main content

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

tola_payments-0.1.3.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

tola_payments-0.1.3-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file tola_payments-0.1.3.tar.gz.

File metadata

  • Download URL: tola_payments-0.1.3.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for tola_payments-0.1.3.tar.gz
Algorithm Hash digest
SHA256 9a2dde6e146be04f1e34cd172ccf4829a03efe4ea02a57f1e4980a8d8f4ab417
MD5 ab34f920a8b85b4fcb8a84a602ba0ca5
BLAKE2b-256 84afd89bf91cad6a915fc36ea08b36d08f1b694ad4dfd7af508573444d8508e2

See more details on using hashes here.

File details

Details for the file tola_payments-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for tola_payments-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f7ed343134ccf08c0a8f07efe1c7272d0596cf99164eddba418541daf3f366cf
MD5 6db4aeffa18b6cde56d85be8e635ae60
BLAKE2b-256 5aac2af9d7cf20b33b8268bef1c72f630022a478afa2900e957afde042fe82d8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page