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
Metadata
Release files for khpay 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| khpay-0.1.1.tar.gz | 8.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| khpay-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.2 kB
Release files / khpay-0.1.1.tar.gz
| Download URL | khpay-0.1.1.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
01adfbcca58598e019775c6631e0acb2811f0046d7fe13ad3035f4c1c2642b1f
|
|
BLAKE2b-256 checksum How to use checksums |
403efef4306f20c62513a8479289571fbcb342ac5cd64ff4fdd810455d1fdc3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Release files / khpay-0.1.1-py3-none-any.whl
| Download URL | khpay-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
72744cf43e7dfcdb282fd4ea01c500b38906de1a21025051441a097b3ce85e55
|
|
BLAKE2b-256 checksum How to use checksums |
17ffd5add40fe00638e9dde86fba72f28b68f3a24e8912f2cd2db41bc3ff017e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Security for khpay 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.