Python client for PayStation payment APIs.
- Initialize payments through PayStation
- Check transaction status by invoice number
- Supports sandbox and production environments
- Simple request/response flow with JSON responses
- Python 3.10+
requests>=2.32.5
From PyPI:
pip install paystationFrom source:
git clone https://github.com/rozari0/paystation.git
cd paystation
pip install .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)sandbox=True uses https://sandbox.paystation.com.bd.
sandbox=False uses https://api.paystation.com.bd.
Create a PayStation client instance.
merchant_id(str): PayStation merchant IDpassword(str): PayStation passwordsandbox(bool): SetTruefor sandbox
Initiates a payment.
Required parameters:
invoice_number(str): Unique invoice IDpayment_amount(float): Amount to be paidcust_name(str): Customer namecust_phone(str): Customer phonecust_email(str): Customer emailcallback_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"},
)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)- You call
initiate_paymentand get a response from PayStation. - The customer completes payment on the PayStation page.
- PayStation sends the result to your
callback_url. - You verify final status by calling
get_transaction_status_by_invoice.
- The client returns
response.json()directly. - Add your own handling for timeouts, connection errors, and invalid JSON.
- Keep production credentials private.
This project is licensed under the MIT License. See LICENSE.