A Pythonic client for the bKash payment gateway. Supports both synchronous and asynchronous usage and covers the entire API surface.
Project description
pybkash
A Pythonic client for the bKash payment gateway. Supports both synchronous and asynchronous usage and covers the entire API surface.
Features
- Normal Payment
- Agreement Creation
- Agreement Payment
- Refund
- Search Transaction
Installation
pip install pybkash
Usage
Synchronous Client
from pybkash import Client, Token
# First, initialize the token. This will be passed to the Client.
token = Token(
username="your_username",
password="your_password",
app_key="your_app_key",
app_secret="your_app_secret",
sandbox=True # Use False for production
)
Then, create a client object by passing the token:
client = Client(token)
You can now use this client to perform various operations.
Step 1: Create Payment
payment = client.create_payment(
callback_url="https://yoursite.com/callback",
payer_reference="CUSTOMER001", # Passing a phone or bKash number pre-populates the wallet number field on the bKash checkout page.
amount=1000 # Amount in BDT
)
This returns a PaymentCreation object:
payment.payment_idis the ID bKash uses to identify individual payments.payment.bkash_urlis the payment URL — send the user to this page.
After the user has completed the payment:
Step 2: Execute Payment
execution = client.execute_payment(payment.payment_id)
This returns a PaymentExecution object.
# Verify completion
if execution.is_complete():
print(f"Payment successful! TrxID: {execution.trx_id}")
else:
print(f"Payment status: {execution.status}")
Documentation
For detailed synchronous and asynchronous usage information, including return types and attributes, see docs.
Project details
Release history Release notifications | RSS feed
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 pybkash-0.1.0.tar.gz.
File metadata
- Download URL: pybkash-0.1.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00b115957a927dbf975bd5d4e6f480e9fa519b8c7538aeedf332df18e917ac42
|
|
| MD5 |
fbe70cb083e069a5687417dd4b4ec98d
|
|
| BLAKE2b-256 |
15b0fa4a03310ebf3c034f4668e87b3572cf93daaecf86db46bc26281f0254c6
|
File details
Details for the file pybkash-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pybkash-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16d5acf6c7f2f12a6ee4b28b5b61070a42501a6c01834fe4922567ed6ee44550
|
|
| MD5 |
14b639d6c9437b6952b2b4f86e2bfd01
|
|
| BLAKE2b-256 |
309702ab96cf7cc82f0e4e3b8c3317f456c0bf43d40bca49c3b29c5dc3c6d18f
|