PayStackEase Library
PayStackEase API Library is a Python library that simplifies interacting with the Paystack API. It provides both asynchronous and synchronous wrappers for various Paystack functionalities, making it easier to integrate payment processing into your Python projects.
📝: Read more on paystack api documentation: Paystack API DOCUMENTATION
📝: Read more on paystackease api documentation: PayStackEase DOCUMENTATION
Getting Started
You should create a Paystack account to generate a Paystack Secret Key. You can see this in the settings page >> API keys and Webhook section.
⚠️: Warning: Do not expose your secret key or commit your secret key to git, or use them in client-side code.
💡: Take Note: Public key is to be used from your front-end when integrating using Paystack Inline. In this case you have to use you secret key
✅: Good: Set your secret key in environment variables as seen: PAYSTACK_SECRET_KEY=your-secret-key
Create a Virtual Environment
-
For Windows:
-
Create virtual environment
py -m venv <environment_name> -
Activate the virtual environment
<environment_name>\Scripts\activate
-
-
For Unix/macOS
-
Create virtual environment
python3 -m venv <environment_name> -
Activate the virtual environment
<environment_name>/bin/activate
-
Install paystackease library:
pip install paystackease
pipx install paystackease
poetry add paystackease
If you want to download the sdist packages directly:
Download the wheel distribution file and install using pip
pip install paystackease-2.0.0-py3-none-any.whl
Download the source distribution file, and install using pip
pip install paystackease-2.0.0.tar.gz
To get a development version of paystackease
Clone from the dev branch GitHub repository, unzip and install:
git clone -b dev https://github.com/cla-bit/PayStackEase.git
cd PayStackEase
pip install paystackease
API usage
Making a Transaction [Synchronous]
If after setting your secret key in environment variables, for a synchronous transaction process all you need to do is use the transaction API to make a transaction.
To create a transaction or initialize a transaction:
- import the Paystack API wrapper.
from paystackease import PayStackBase
- Create an instance to use the PaystackBase wrapper to interact with the Transaction API.
paystack_client = PayStackBase()
- Use the instance and call the transaction method to initialize a transaction
create_transaction = paystack_client.transactions.initialize(
email="johndoe@email.com",
amount=10000000)
print(f"Transaction Created: {create_transaction}")
✅: Good: You can check your Paystack account, go to the Transaction page, and you will see the transaction just created.
Other Tools
Similar to calling the PayStackBase, you can also call other tools to make your work easy. For example:
from paystackease import AccountType
val1 = AccountType.PERSONAL.value
print(val1)
"personal"
from paystackease import convert_to_subunit
# amount should be in subunit in this case 10000 kobo = 100 naira
money = convert_to_subunit(100, Currency.NGN)
print(money)
10000
from paystackease import Channels
bank = Channels.BANK.value
print(bank)
"bank"
from paystackease import Currency
val1 = Currency.NGN.value
print(val1)
"NGN"
from paystackease import DocumentType
val1 = DocumentType.IDENTITY_NUMBER.value
print(val1)
"identityNumber"
Others are: EventType, Interval, MobileMoney, PWT, QRCODE, RecipientType, ResendOTP, Resolution, RiskAction, SplitType, STATUS, etc.
Metadata
Release files for paystackease 2.3.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| paystackease-2.3.7.tar.gz | 47.0 kB | Without provenance | Details for paystackease-2.3.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| paystackease-2.3.7-py3-none-any.whl | Python 3 | none | any | Details for paystackease-2.3.7-py3-none-any.whl |
Total release size: 130.9 kB
Release files / paystackease-2.3.7.tar.gz
| Download URL | paystackease-2.3.7.tar.gz |
|---|---|
| Size | 47.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b909ffaecbdb710ec26f4695f13130055b99083c2cda72fbf33682b1879c2f0
|
|
BLAKE2b-256 checksum How to use checksums |
991f7d61ffd9c31ca4edc5fe101303608b64688e518695f6406161ccf5454e11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.9.25 Linux/6.14.0-1017-azure
|
Release files / paystackease-2.3.7-py3-none-any.whl
| Download URL | paystackease-2.3.7-py3-none-any.whl |
|---|---|
| Size | 83.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
96f7d1bdb50fc1e923f8db5f9b3513962cb342d72f4fe315adb9fb6ee8b83b8b
|
|
BLAKE2b-256 checksum How to use checksums |
99f3186137149f4146e727ec3b4543e35a2f79c4c65e1cd1236479457b9956c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.9.25 Linux/6.14.0-1017-azure
|
Security for paystackease 2.3.7
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.