Skip to main content

A simple Python library for interacting with the PayStation API.

Project description

Paystation

Python client for PayStation payment APIs.

Features

  • Initialize payments through PayStation
  • Check transaction status by invoice number
  • Supports sandbox and production environments
  • Simple request/response flow with JSON responses

Requirements

  • Python 3.10+
  • requests>=2.32.5

Installation

From PyPI:

pip install paystation

From source:

git clone https://github.com/rozari0/paystation.git
cd paystation
pip install .

Quick Start (Sandbox)

Use the following sandbox credentials:

  • Merchant ID: 104-1653730183
  • Password: gamecoderstorepass
from paystation import PayStation

client = PayStation(
	merchant_id="104-1653730183",
	password="gamecoderstorepass",
	sandbox=True,
)

response = client.initiate_payment(
	invoice_number="INV-1001",
	payment_amount=100.0,
	cust_name="John Doe",
	cust_phone="01700000000",
	cust_email="john@example.com",
	callback_url="https://your-domain.com/paystation/callback",
)

print(response)

Environments

sandbox=True uses https://sandbox.paystation.com.bd.

sandbox=False uses https://api.paystation.com.bd.

API Reference

PayStation(merchant_id, password, sandbox=False)

Create a PayStation client instance.

  • merchant_id (str): PayStation merchant ID
  • password (str): PayStation password
  • sandbox (bool): Set True for sandbox

initiate_payment(...)

Initiates a payment.

Required parameters:

  • invoice_number (str): Unique invoice ID
  • payment_amount (float): Amount to be paid
  • cust_name (str): Customer name
  • cust_phone (str): Customer phone
  • cust_email (str): Customer email
  • callback_url (str): URL for payment callback/result

Optional parameters:

  • currency (str, default: "BDT")
  • reference (str | None)
  • cust_address (str | None)
  • checkout_items (str | dict | None)
  • pay_with_charge (bool, default: False)
  • emi (bool , default: False)
  • opt_a (str | dict | None)
  • opt_b (str | dict | None)
  • opt_c (str | dict | None)

Returns:

  • dict: Parsed JSON response from PayStation

Example with optional fields:

response = client.initiate_payment(
	invoice_number="INV-1002",
	payment_amount=250.0,
	cust_name="Jane Doe",
	cust_phone="01800000000",
	cust_email="jane@example.com",
	callback_url="https://your-domain.com/paystation/callback",
	currency="BDT",
	reference="ORDER-2026-0001",
	cust_address="Dhaka, Bangladesh",
	checkout_items={"item": "Premium Plan", "qty": 1},
	pay_with_charge=True,
	emi=True,
	opt_a={"source": "web"},
)

get_transaction_status_by_invoice(invoice_number)

Checks transaction status for an invoice.

  • invoice_number (str): Invoice used during payment initiation

Returns:

  • dict: Parsed JSON response from PayStation
status = client.get_transaction_status_by_invoice("INV-1001")
print(status)

Typical Callback Flow

  1. You call initiate_payment and get a response from PayStation.
  2. The customer completes payment on the PayStation page.
  3. PayStation sends the result to your callback_url.
  4. You verify final status by calling get_transaction_status_by_invoice.

Notes

  • The client returns response.json() directly.
  • Add your own handling for timeouts, connection errors, and invalid JSON.
  • Keep production credentials private.

License

This project is licensed under the MIT License. See LICENSE.

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

paystation-1.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

paystation-1.1.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file paystation-1.1.0.tar.gz.

File metadata

  • Download URL: paystation-1.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for paystation-1.1.0.tar.gz
Algorithm Hash digest
SHA256 9925778205b227aa55353b53a60499ec366b8bc88e88b5231c925da2210d3c2e
MD5 3df959dccf9decf97c30b3fe463727a9
BLAKE2b-256 195db86eb8c0409c2a5054735d4e7190444dafdf108a0639ed838182896be30e

See more details on using hashes here.

Provenance

The following attestation bundles were made for paystation-1.1.0.tar.gz:

Publisher: python-publish.yml on rozari0/Paystation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file paystation-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: paystation-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for paystation-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ed2e67d14256f0408c9f414effcdfce5786e24abdd5e090243d0e1845b3884e
MD5 fd23156bc6343f4ee4bddd162a52aaa3
BLAKE2b-256 b7f041bdf198a69fb2016b07253693a6a5a0b5b352e3f5a136aa49e0a603c28c

See more details on using hashes here.

Provenance

The following attestation bundles were made for paystation-1.1.0-py3-none-any.whl:

Publisher: python-publish.yml on rozari0/Paystation

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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