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 IDpassword(str): PayStation passwordsandbox(bool): SetTruefor sandbox
initiate_payment(...)
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"},
)
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
- 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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29299f2927bb96a0cec6ff8b5ea70c198c00f2d67fc6777c05896aa3972aa4a8
|
|
| MD5 |
8862009e3988cdf3d23ef231454cf8e1
|
|
| BLAKE2b-256 |
7b2900d14d6d9a30eafb2b67d6f24b67c8b1b6a2da77a873d19b62154ff419b5
|
Provenance
The following attestation bundles were made for paystation-1.0.0.tar.gz:
Publisher:
python-publish.yml on rozari0/Paystation
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
paystation-1.0.0.tar.gz -
Subject digest:
29299f2927bb96a0cec6ff8b5ea70c198c00f2d67fc6777c05896aa3972aa4a8 - Sigstore transparency entry: 1101542274
- Sigstore integration time:
-
Permalink:
rozari0/Paystation@7b9e8a36ea06b23816a888ec479e558c1b168c27 -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/rozari0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7b9e8a36ea06b23816a888ec479e558c1b168c27 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb7be812da84dc3a8f6a9d63091348278a6fca3cec63454e058ea37b8e4b66d3
|
|
| MD5 |
ccd345ac3f4a6e0d76e7131639769270
|
|
| BLAKE2b-256 |
fc79def93f25c4e9e7cd65d56a2f2859b5b8fdfdb4b8af7ff8012f27a9d62532
|
Provenance
The following attestation bundles were made for paystation-1.0.0-py3-none-any.whl:
Publisher:
python-publish.yml on rozari0/Paystation
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
paystation-1.0.0-py3-none-any.whl -
Subject digest:
fb7be812da84dc3a8f6a9d63091348278a6fca3cec63454e058ea37b8e4b66d3 - Sigstore transparency entry: 1101542276
- Sigstore integration time:
-
Permalink:
rozari0/Paystation@7b9e8a36ea06b23816a888ec479e558c1b168c27 -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/rozari0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7b9e8a36ea06b23816a888ec479e558c1b168c27 -
Trigger Event:
release
-
Statement type: