Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
pyshoket
, connecting MNO such as Tigo (Tigopesa),
Halotel (Halopesa) and Airtel (Airtel money)pip
pip install pyshoket
git clone https://github.com/maen08/pyshoket
To perform payments with Shoket, you need to pass PRIVATE_KEY
in the request. Its already handled in this wrapper, what you need to do is to keep your Shoket key private.
.env
file to store your keyPRIVATE_KEY=mpBsk_icAldgTTvXXXXXXXXXXXXXXXX
NB: No space between equal sign
To enable payments in your project with pyshoket
, this is how you can do it.
from pyshoket import PyShoket
shoket = PyShoket()
response = shoket.make_payment(
amount=2000,
customer_name='Stanley Ruheza',
customer_email='stanleyruheza@gmail.com',
customer_number='255717610000',
channel='Tigo'
)
print(response)
If we check the response of the above request (Successful request), it will be something like this:
# Response of successful request
{
"Status": "success" ,
"customer" {
"customer_name": "376FcD3gbidW",
"email": "stanleyruheza@gmail.com",
"id": 64043
},
"data": {
"amount": 2000,
"channel": "Tigo",
"currency": "TSH",
"number_used": "255717610000",
"status": "Success",
"transaction_date": "2022-03-01 15:08:59.917691"
},
"message": "Transaction is completed",
"reference": "adz49dS428b7kbDTdG4MN"
}
If the private key is incorrect, then you'll recieve this response:
# Unsuccessful response
{
"detail": "Unauthorized Access",
"message": "Errors!, Unsuccessful payment",
"status_code": "401"
}
Pyshoket is an open source project so feel free to contribute. You can contribute in various ways, including:
Credits to all contributors of Pyshoket. Your work is worthy.
Share the project with your team, give it a star and use it.
Pyshoket is an Open Source project under MIT licence
FAQs
A Python wrapper for Shoket API
We found that pyshoket demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.