Skip to main content

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

  1. Normal Payment
  2. Agreement Creation
  3. Agreement Payment
  4. Refund
  5. 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_id is the ID bKash uses to identify individual payments.
  • payment.bkash_url is 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pybkash-0.3.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybkash-0.3.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file pybkash-0.3.0.tar.gz.

File metadata

  • Download URL: pybkash-0.3.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for pybkash-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a8a4849e6ca030602c37b3025acbf28f2d20c3a1b4d4b8331ad2a27d39fe7fcf
MD5 83c21cbccd69695ab500a1f9f40c5266
BLAKE2b-256 b3c86128a3a2552aad9d55b3484e5a86b95182f46413a0e7112298467e7f7d24

See more details on using hashes here.

File details

Details for the file pybkash-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pybkash-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for pybkash-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 81bd97967318f9b9e00af4da1b9927a4450803bfd2f81157c612602b6cb16d0e
MD5 3ac800004c61e6d1287a4da1c705454e
BLAKE2b-256 4d2b24d4a848b99adb48da90349a7c409827aedb94b91fef99b4cec0992347de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page