Official SePay Payment Gateway SDK for Python
Project description
SePay Payment Gateway SDK for Python
Official Python library for integrating SePay Payment Gateway.
Installation
Install using pip:
pip install sepay-pg
Quick Start
Initialize Client
from sepay_pg import SePayClient
sepay = SePayClient(
merchant_id="YOUR_MERCHANT_ID",
secret_key="YOUR_MERCHANT_SECRET_KEY",
env="sandbox" # or "production"
)
Generate Checkout Parameters
order_data = {
'order_invoice_number': 'INV-123456',
'order_amount': 100000, # 100,000 VND
'order_description': 'Test payment description',
'success_url': 'https://yourwebsite.com/payment/success',
'error_url': 'https://yourwebsite.com/payment/error',
'cancel_url': 'https://yourwebsite.com/payment/cancel'
}
checkout_fields = sepay.generate_checkout_data(order_data)
# Resulting dictionary contains all required fields including merchant and signature:
# print(checkout_fields['signature'])
Verify Webhook IPN Signature
# Verify signature header from SePay webhook post request
is_valid = sepay.verify_webhook_signature(
signature_header=request.headers.get('x-sepay-signature'),
raw_payload=request.data # raw request body bytes
)
API Queries
# Get order details
order = sepay.get_order("INV-123456")
# Get transactions history
transactions = sepay.get_transactions({"limit": 10})
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sepay_pg-1.0.0.tar.gz
(4.9 kB
view details)
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 sepay_pg-1.0.0.tar.gz.
File metadata
- Download URL: sepay_pg-1.0.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68774c9e282d8f9fffa6d774106622073ce3eecbc4b41fa438cb1916f3be8783
|
|
| MD5 |
300dcb5975aee243bb70946e77ba1048
|
|
| BLAKE2b-256 |
c3ae851a437230b3a6340f395de79473e088b9a0f02b20c993112a83af81a710
|
File details
Details for the file sepay_pg-1.0.0-py3-none-any.whl.
File metadata
- Download URL: sepay_pg-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62cc67d49c6d1fbdee7a5ed0215f6fa3cb36e5c0b7b2776554236dc66c11ff74
|
|
| MD5 |
5afbda1e30b65b2f1e5cd14220f0ab7b
|
|
| BLAKE2b-256 |
e6f83c63dfaf5b0fee427f56ae14d1c8140093809d6bb23776be74e32e95128f
|