A Typed Python client for the Pesapal API with sync/async support, order submission, IPN management, and optional CLI tools.
Project description
pesapal-client
A Typed Python client for the Pesapal API with sync/async support, order submission, IPN management, and optional CLI tools.
Features
- Typed models for requests and responses using Pydantic
- Sync and async API support
- Order submission and payment status tracking
- IPN (Instant Payment Notification) management
- Subscription management
- Automatic authentication and token refresh
- Custom exceptions for error handling
- Utility functions for JWT and JSON parsing
- Optional CLI tools for quick integration
Installation
pip install pesapal-client
Quick Start
from pesapal_client.client import PesapalClientV3
from pesapal_client.v3.schemas import InitiatePaymentOrderRequest
client = PesapalClientV3(
consumer_key="your_consumer_key",
consumer_secret="your_consumer_secret",
is_sandbox=True,
)
payment_request = InitiatePaymentOrderRequest(
amount="1000",
currency="KES",
description="Test payment",
# ...other required fields...
)
response = client.one_time_payment.initiate_payment_order(payment_request)
print(response.redirect_url)
Documentation
License
This project is licensed under the MIT License - see the LICENSE file for details.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pesapal_client-0.1.2.tar.gz.
File metadata
- Download URL: pesapal_client-0.1.2.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.13 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f7e30e07bfe057656b2c74fabc39244962b8e5fa9a45e2eb67643a31c216850
|
|
| MD5 |
c8be5f4dbe66ecbb794f25b09b984e79
|
|
| BLAKE2b-256 |
c321f4f925a74db4b4599ed30f9eed5729e222a44769e3c7e0da20bbaa4bc395
|
File details
Details for the file pesapal_client-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pesapal_client-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.13 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
270e279e2f0e446d8ae3d8bb167436db0df086b863a1d69e16ef387e705303fe
|
|
| MD5 |
f07d604f13db35957156a438459c753d
|
|
| BLAKE2b-256 |
fd8d08f6bfca2d3141a99b12d32481f71de94276ab9c6a13a21ddafec1310559
|