MercanPay Python client
Official Python client for MercanPay — accept TRX and USDT (TRC20) payments. Full API reference: https://mercanpay.com/documentation
pip install mercanpay
from mercanpay import MercanPay, MercanPayError, verify_webhook
zp = MercanPay("https://mercanpay.com", "mp_...") # API key from your merchant panel
# Invoice priced in USD — the customer picks the coin on the payment page
inv = zp.create_invoice(price_usd="25", order_id="order-1001", callback_url="https://shop.example/hook")
# Invoice in a fixed coin
inv = zp.create_invoice("USDT", "25", order_id="order-1002")
print(inv["address"], inv["payment_url"])
# Payout from your merchant balance (needs the 'withdrawals' scope; safe to retry with the same idempotency_key)
w = zp.create_withdrawal("USDT", "10", "T...", idempotency_key="wd-123")
print(w["status"]) # queued -> processing -> completed
# Webhook receiver (Flask example)
@app.post("/hook")
def hook():
if not verify_webhook(SECRET, request.get_data(), request.headers.get("X-MercanPay-Signature", "")):
abort(401)
event = request.get_json()
if event["type"] == "invoice.paid":
...
return "ok"
Errors raise MercanPayError with .status, .code (e.g. insufficient_funds) and .message.
Metadata
Release files for mercanpay 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mercanpay-1.0.0.tar.gz | 5.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mercanpay-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.6 kB
Release files / mercanpay-1.0.0.tar.gz
| Download URL | mercanpay-1.0.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e75ab7ea259a604fcf525bff4174c3365ca14a069ae7fd7b15e44958f6226c57
|
|
BLAKE2b-256 checksum How to use checksums |
bd404695a7a92bd5cbeecb16361c0047bc8ce775af2901689bca6dab7c0cf793
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.0
|
Release files / mercanpay-1.0.0-py3-none-any.whl
| Download URL | mercanpay-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3a25a9a7aaee72c1e3ecc13294eb4aca18d344c23360f522156c5bc3e66bbf2f
|
|
BLAKE2b-256 checksum How to use checksums |
610274d0c7fa32daf2785ceee860b6bd078897516032a9c9ea64b390948e7931
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.0
|