Skip to main content

python soofa

This package is aimed at simplifying the process of integrating soofapay payment solution to your python systems. You can check our website for more

Installation

$ pip install soofa

Usage

1. Checking for a transaction

from soofa import Soofa, Transaction

soofa = Soofa("you_soofa_till_number", "your_client_secret_here")
exists = soofa.find("tranaction_id_here")
if exists:
    transaction: Transaction = soofa.get_transaction()
    print(transaction.tid)
    print(transaction.sender)
    print(transaction.gross_amount)
else:
    print("No such transaction")

The expected response for transaction check is Transaction object with various keys and methods

There is an additional method for getting the entire JSON object.

transaction.json()

{
    "status": "SUCCESSFUL",
    "sender_currency": "KES",
    "receiver_currency": "KES",
    "tid": "QTMB3",
    "reference": "T5004",
    "receipt_no": "NFQ6U45W28",
    "timestamp": 1561499777.715254,
    "gross_amount": 5,
    "net_amount": 4.8605,
    "transacted_via": "mpesa",
    "is_money_in": true,
    "sender": "+254701234567",
    "receiver": "Dev Market"
}

The table below describes all the attributes of the transaction object.

Key

Description

status

The state of the transaction, either SUCCESSFUL or PENDING

sender_currency

The currency of the person who performed the transaction

receiver_currency

The currency of the business, if the transaction was Money in for the business

reference

The transaction reference passed when making a transaction

timestamp

Unix timestamp for the transaction

gross_amount

The amount of the transaction

net_amount

The amount received after deducting soofa

transacted_via

The service provider which facilitated the transaction eg. mpesa, visa, airtelmoney, mastercard, tkash …

is_money_in

A boolean indicating if the money was to the business or out of the business

sender

The performer of transaction

receiver

The receiver of the transaction which is the business if the transaction was inbound

2. Checking your soofa business account balance

from soofa import Soofa

soofa = Soofa("you_soofa_till_number", "your_client_secret_here")
balance = soofa.get_balance()
print(balance)

The expected response for checking balance is a JSON with three fields:

{
    “balance”: “1587.49”,
    “currency”: “KES”,
    “timestamp”: 1561820831.623298
}

Metadata

Release files for soofa 0.1.11

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

Source distribution (sdist)

Source distribution for soofa 0.1.11
File Size Uploaded Provenance Actions
soofa-0.1.11.tar.gz 3.7 kB Without provenance Details for soofa-0.1.11.tar.gz

Release files / soofa-0.1.11.tar.gz

Download URL soofa-0.1.11.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dbf27f673784148d8d08cb7ef6ef54f0dcd080b52c96841a0a2c31d8d99dc3a3
BLAKE2b-256 checksum
How to use checksums
a091f4a700e6e155f397fab0ea036203c0cfd7206829aa4bc26da8010bbb6ab3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

Security for soofa 0.1.11

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