Skip to main content

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


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)

Uploaded Source

Built Distribution

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

sepay_pg-1.0.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

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

Hashes for sepay_pg-1.0.0.tar.gz
Algorithm Hash digest
SHA256 68774c9e282d8f9fffa6d774106622073ce3eecbc4b41fa438cb1916f3be8783
MD5 300dcb5975aee243bb70946e77ba1048
BLAKE2b-256 c3ae851a437230b3a6340f395de79473e088b9a0f02b20c993112a83af81a710

See more details on using hashes here.

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

Hashes for sepay_pg-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 62cc67d49c6d1fbdee7a5ed0215f6fa3cb36e5c0b7b2776554236dc66c11ff74
MD5 5afbda1e30b65b2f1e5cd14220f0ab7b
BLAKE2b-256 e6f83c63dfaf5b0fee427f56ae14d1c8140093809d6bb23776be74e32e95128f

See more details on using hashes here.

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