Official KHPay SDK + CLI — create payments, tail logs, fire test transactions.
Project description
khpay — Python SDK & CLI
Official Python package for the KHPay payment gateway.
Install
pip install khpay
Library usage
from khpay import KHPay
client = KHPay("ak_your_api_key")
payment = client.create_payment(10.00, "USD", "Order #123")
print(payment["data"]["payment_url"])
status = client.check_payment(payment["data"]["transaction_id"])
Verify a webhook signature
from khpay import KHPay
ok = KHPay.verify_webhook_signature(raw_body, header_signature, webhook_secret)
CLI
Once installed, the khpay command is available on your PATH.
khpay login # paste your ak_… key (stored in ~/.khpay/config.json, mode 0600)
khpay whoami # show merchant info
khpay logs --status 400 # filter API logs
khpay inspect 1842 # full body + headers for log #1842
khpay test success # magic $1 → auto-success
khpay test decline # magic $2 → declined
khpay test gateway-down # magic $3 → 502
khpay test fraud # magic $4 → fraud-block
khpay webhook test # fire test webhook
khpay config # show saved config (key is masked)
Environment variables
KHPAY_API_KEY— overrides stored keyKHPAY_BASE_URL— overrides stored base URL (defaulthttps://khpay.site/api/v1)
Requirements
- Python 3.8+
- No runtime dependencies (uses stdlib only)
License
MIT
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
khpay-0.1.1.tar.gz
(8.6 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
khpay-0.1.1-py3-none-any.whl
(8.6 kB
view details)
File details
Details for the file khpay-0.1.1.tar.gz.
File metadata
- Download URL: khpay-0.1.1.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01adfbcca58598e019775c6631e0acb2811f0046d7fe13ad3035f4c1c2642b1f
|
|
| MD5 |
f8bc186a8fa4f41effd34ee4469434f7
|
|
| BLAKE2b-256 |
403efef4306f20c62513a8479289571fbcb342ac5cd64ff4fdd810455d1fdc3c
|
File details
Details for the file khpay-0.1.1-py3-none-any.whl.
File metadata
- Download URL: khpay-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72744cf43e7dfcdb282fd4ea01c500b38906de1a21025051441a097b3ce85e55
|
|
| MD5 |
6c34dff430ce992a2a0f50a610454609
|
|
| BLAKE2b-256 |
17ffd5add40fe00638e9dde86fba72f28b68f3a24e8912f2cd2db41bc3ff017e
|