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.0.0.tar.gz (3.3 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.0.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for paystation-1.0.0.tar.gz
Algorithm Hash digest
SHA256 29299f2927bb96a0cec6ff8b5ea70c198c00f2d67fc6777c05896aa3972aa4a8
MD5 8862009e3988cdf3d23ef231454cf8e1
BLAKE2b-256 7b2900d14d6d9a30eafb2b67d6f24b67c8b1b6a2da77a873d19b62154ff419b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for paystation-1.0.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.0.0-py3-none-any.whl.

File metadata

  • Download URL: paystation-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb7be812da84dc3a8f6a9d63091348278a6fca3cec63454e058ea37b8e4b66d3
MD5 ccd345ac3f4a6e0d76e7131639769270
BLAKE2b-256 fc79def93f25c4e9e7cd65d56a2f2859b5b8fdfdb4b8af7ff8012f27a9d62532

See more details on using hashes here.

Provenance

The following attestation bundles were made for paystation-1.0.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