Skip to main content

tigopesa

Python package to easy the tigopesa api integration

Getting started

To get started with Tigopesa, you firstly need to install it as show below;

pip install tigopesa

Authorization and Configuration

Before you begin making transaction with tigopesa module, you firstly need to initialize your tigopesa api credentials client_id and client_secret you were given.

Whether are sandbox keys or production keys, all of them are in great use with the tigopesa package

Here how to initialize;

        >>> from tigopesa import Tigopesa
        >>> tigopesa = Tigopesa(
                    client_secret='xxxx',
                    client_id ='xxxx'
                    environment="sandbox"
                )
        # OR 

        # You can do this;

        >>> from tigopesa import Tigopesa
        >>> tigopesa = Tigopesa(environment='production')
        >>> tigopesa.client_id = 'xxxx'
        >>> tigopesa.client_secret = "xxxx'

Once you initialize your module, you might need still need to configure your module with couple of more information ready to begin making transactions, there are required paramaters and optional parameters while configuring as shown below;

    # Master mechant (Required parameters)

    account: str
    pin: str
    account_id: str

    # Mechant Informations

    mechant_reference: Optional[str] = ''
    mechant_fee: Optional[str] = '0.0'
    mechant_currency_code: Optional[str] = ''

    # Other_information
    language: Optional[str] = 'eng'
    terminal_id: Optional[str] = ''
    currency_code: Optional[str] = 'TZS'

    tax: Optional[str] = '0.0'
    fee: Optional[str] = '0.0'

    exchange_rate: Optional[str] = '1'

    # Callbacks and Redirects

    callback_url: Optional[str] = 'https://kalebujordan.dev/'
    redirect_url: Optional[str] = 'https://kalebu.github.io/pypesa/'

    # Subscribers default Information

    subscriber_country_code: Optional[str] = '255'
    subscriber_country: Optional[str] = 'TZA'

As you can see there about 3 required parameters while the rest being optional parameters, so in our example we are going to configure using only 3 required parameters and the rest will just take the default values;

    >>> from tigopesa import Tigopesa
    >>> tigopesa.configure(
                account = '255xxxxx', 
                pin = 'xxxxx'
                account_id = 'xxxxxx'
                .........
            )

Authorizing Payments

Now once we are done with the authentication and the authorization part, we can start making authorizing tigopesa payment, Here an example you would authorize a secure tigopesa payment with tigopesa library;

>>> response = tigopesa.authorize_payment({
            "amount": 4999,
            "first_name": "Kalebu",
            "last_name": "Gwalugano",
            "customer_email": "kalebjordan.kj@gmail.com",
            "mobile": "255757294146",}
        )

print(response)

# Response output 

{'transactionRefId': 'f9995a1ab5d04235a2aeeef37baad129', 'redirectUrl': 'https://secure.tigo.com/v1/tigo/payment-auth/transactions?auth_code=CgFsXfSZRL&transaction_ref_id=f9995a1ab5d04235a2aeeef37baad129&lang=eng', 'authCode': 'CgFsXfSZRL', 'creationDateTime': 'Sat, 1 May 2021 20:50:34 UTC', 'SessionLife': 600}

Issues

If you're facing issue with the use of the package, raise an issue and I will be working to fixing it as soon as I can;

Contributing

Tigopesa has a lot of modules to integrate, it can be overwhelming doing all of them by myself together with other responsibilities so I warmly welcome contributors (code + documentation) to contribute to this package.

Credits

All the credits to;

Metadata

Release files for tigopesa 0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tigopesa 0.6
File Size Uploaded Provenance
tigopesa-0.6.tar.gz 6.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for tigopesa 0.6
File Interpreter ABI Platform
tigopesa-0.6-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / tigopesa-0.6.tar.gz

Download URL tigopesa-0.6.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
05038f865a01d3f7b59ba91df5e3f961c85b02e219758d9dc98faaa52c1dc10b
BLAKE2b-256 checksum
How to use checksums
70195f22810aecae4043cc33f53a90c0806f357c4c6fe609fb0f87ccdd3b5c1c
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.5

Release files / tigopesa-0.6-py3-none-any.whl

Download URL tigopesa-0.6-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97e5ee0fac7225ddbe0d13c34af0f1a3aa3a18867b598bb6c4d02966cc568b9a
BLAKE2b-256 checksum
How to use checksums
3a3f1330f91081734192e6286f2cecb7e06cfe82c6fd778aadba1ad39ce3e184
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.5

Security for tigopesa 0.6

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page