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.0.tar.gz
(6.3 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.0-py3-none-any.whl
(7.0 kB
view details)
File details
Details for the file khpay-0.1.0.tar.gz.
File metadata
- Download URL: khpay-0.1.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66bd387a0fc7847b4bb0ca22c894d2f87c0f2d6d70c51e31aa408b5f6fad99f4
|
|
| MD5 |
20c5998eca9fb1547178b957ab9ca426
|
|
| BLAKE2b-256 |
50ad676ae5fcc4fcf0cf5d9cccbd43ebf45562d189a21366d7c0594c9424496d
|
File details
Details for the file khpay-0.1.0-py3-none-any.whl.
File metadata
- Download URL: khpay-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.0 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 |
e2e8f7485a27d8a31567363da97fe1b9c2127a315ab1a8ba89cdd08b3d7b1cf2
|
|
| MD5 |
73b32d03e926df9f3ef9d636b712ef1e
|
|
| BLAKE2b-256 |
e0c26d9f8dc453eef08b43a92c57e3c105f36aa709de742a0d129ecbf841eab0
|