MercanPay Integrations
Py

Python SDK

The official Python library: add crypto payments to Django, Flask or FastAPI in a few lines.

AvailableSDKPython 3pipDjangoFlaskFastAPI

Installation

With pip (recommended):

pip install mercanpay

For offline servers download the .whl file and run pip install mercanpay-1.0.0-py3-none-any.whl.

Creating an invoice

from mercanpay import MercanPay

zp = MercanPay("https://mercanpay.com", "mp_...")  # API key from your merchant panel

# USD-priced invoice: 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")
print(inv["payment_url"])

Verifying webhooks (Flask)

from mercanpay import verify_webhook

@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":
        ...  # mark the order as paid
    return "ok"

Payouts

w = zp.create_withdrawal("USDT", "10", "T...", idempotency_key="wd-123")
print(w["status"])  # queued -> processing -> completed

Errors raise MercanPayError (.status, .code, .message). See the documentation for every endpoint.

You may also like

SDKPHP

PHP SDK Available

The official PHP 8+ library: invoices, payouts and webhook signature checks in one class.

PHP 8ComposerLaravelWebhook
Detailsv1.0.0Download
PluginWoo

WooCommerce plugin Available

Add USDT and TRX as a payment method to your WooCommerce store; orders update automatically when the payment is confirmed.

WordPressWooCommerceHPOSBlocks
Detailsv1.0.0Download
PluginW

WordPress payment & donation buttons Available

Put a payment or donation button, card or QR code on any WordPress page, no WooCommerce needed.

WordPressBağışGutenbergShortcode
Detailsv1.0.0Download

Start accepting crypto payments in minutes

Accept USDT and TRX (TRC20). Fees from 0.4%, a hosted payment page, API and webhooks.