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.2.1.tar.gz (7.8 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.2.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pybkash-0.2.1.tar.gz
Algorithm Hash digest
SHA256 57e1384a87f3ed3c7b1cb5b285a0f38e33a1f043bcfe735d55a2eacc9d1ad1c6
MD5 df0df68fdd4c4fad11321bbc3c23afef
BLAKE2b-256 e38cd757c994453463bbd11549513880b76585c4d3cc312f9817345137c2f8fa

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pybkash-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 74985f7ac1dd66912da72714a48bf07003d123390beede76955db7deade3a0b6
MD5 3506ede2c3aba772a47424ae1ab7cf51
BLAKE2b-256 a3959d911de915ce3aff6037b59c56f16eea77096bf3e357f019ecc17036e8f9

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