ABA Payway Python SDK
A clean, dependency-free Python SDK for the ABA PayWay payment gateway.
Python 3.10+ · No third-party dependencies · Stdlib only
Image Preview
Quick Start
1. Install
pip install aba-payway
OR Update Last Version
pip install --upgrade aba-payway
2. Configure
from aba_sdk import PayWayClient, PayWayConfig, Environment
config = PayWayConfig(
merchant_id="your_merchant_id",
api_key="your_api_key",
env=Environment.sandbox, # OR Environment.production
)
client = PayWayClient(config)
3. Generate a QR Code
from aba_sdk.models import QRRequest, Currency, PaymentOption
from aba_sdk.utils import encode_items, encode_url
from aba_sdk.utils.timestamp import get_req_time
request = QRRequest(
tran_id=tran_id = f"ORDER-{get_req_time()}",
amount=8.00,
currency=Currency.USD, # Supported KHR, USD
payment_option=PaymentOption.ABAPAY_KHQR,
first_name="Khon",
last_name="Chanphearaa",
email="phearaa@example.com",
phone="012345678",
# Optional
items=encode_items([
{"name": "Coffee", "quantity": 2, "price": 2.50},
{"name": "Sandwich", "quantity": 1, "price": 3.00},
]),
callback_url=encode_url("https://yoursite.com/payway/callback"),
lifetime=6,
)
response = client.qr.generate_qr(request)
print(response.qr_string) # Raw KHQR string
print(response.abapay_deeplink) # Deep link for ABA Mobile
response.save_qr_image("qr.png") # Save Base64 PNG to disk
Error Handling
from aba_sdk import PayWayAPIError, PayWayRequestError
try:
response = client.qr.generate_qr(request)
except PayWayAPIError as e:
# API returned an error (wrong domain, invalid hash, etc.)
print(f"[{e.code}] {e.message} trace={e.trace_id}")
except PayWayRequestError as e:
# Network timeout or connection error
print(f"Network error: {e}")
Enums Reference
Currency
| Value | Constant |
|---|---|
USD |
Currency.USD |
KHR |
Currency.KHR |
PaymentOption
| Value | Constant | Notes |
|---|---|---|
abapay |
PaymentOption.ABAPAY |
|
khqr |
PaymentOption.KHQR |
|
abapay_khqr |
PaymentOption.ABAPAY_KHQR |
Most common |
wechat |
PaymentOption.WECHAT |
USD only |
alipay |
PaymentOption.ALIPAY |
USD only |
abapay_khqr_wechat_alipay |
PaymentOption.ALL |
USD only |
QRImageTemplate
TEMPLATE1, TEMPLATE1_COLOR, TEMPLATE2, TEMPLATE2_COLOR, TEMPLATE3, TEMPLATE3_COLOR
Extending the SDK
Each API group gets its own file in aba_sdk/api/ and its own models in aba_sdk/models/.
Then register the new client in PayWayClient:
# aba_sdk/client.py
from .api.checkout import CheckoutClient # new module
class PayWayClient:
def __init__(self, config):
self.qr = QRClient(config)
self.checkout = CheckoutClient(config) # add here
Scope Project Feature
- Generate QRCode
- Check Transaction
- Close Transaction
Example How to Usages
Folder /examples
Run Python File
Environments
| Environment | Base URL |
|---|---|
| Sandbox | https://checkout-sandbox.payway.com.kh |
| Production | https://checkout.payway.com.kh |
Note: Your IP/domain must be whitelisted by PayWay before production calls work. Contact
paywaysales@ababank.comfor production credentials.
Metadata
Release files for aba-payway 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aba_payway-0.1.4.tar.gz | 13.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aba_payway-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.9 kB
Release files / aba_payway-0.1.4.tar.gz
| Download URL | aba_payway-0.1.4.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8bd4464db046de40978641971de1b7b1a350424aaf91efa5b0d5d205571a239b
|
|
BLAKE2b-256 checksum How to use checksums |
2dc597e88f5f1cf41476a342d72874b0d2b680ad0303342aa23f5e3043e461a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 21, 2026.
Transparency logRelease files / aba_payway-0.1.4-py3-none-any.whl
| Download URL | aba_payway-0.1.4-py3-none-any.whl |
|---|---|
| Size | 19.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ecf0088b44671e284e51a5ddaeaf162e8816c064c2ea74e99bafe7e0e6975c21
|
|
BLAKE2b-256 checksum How to use checksums |
2310095b1b1454210758e34cd912766d6303748ee9895189a891dfcf0f38b460
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 21, 2026.
Transparency log