Merchant REST API for LIVE crypto payments — create invoices, redirect to hosted checkout, verify IPN webhooks, and settle to your wallet. Copy-paste examples in curl, Node, PHP, and Python.
MZA Payments is a crypto payment API for merchants. Create invoices, accept deposits in many cryptocurrencies, and settle to one payout wallet (for example USDT BEP-20) after confirmation.
This reference mirrors a Postman-style collection: every endpoint lists method, path, parameters, example requests, and example responses.
Item
Value
Base URL
https://mzapayments.com/api/v1
Protocol
HTTPS + JSON
Auth
Authorization: Bearer <API_SECRET>
Environment
LIVE (mza_…) or SANDBOX (mza_test_…) — create keys in Dashboard → API keys
SANDBOX API keys (mza_test_…). Create invoice → POST /sandbox/simulate-payment to fake-confirm and fire IPNs.
Deposit address
Create an invoice and send the buyer to hosted checkout. A payment and deposit address exist only when cryptoCurrency is set on the invoice, or the buyer picks a coin on checkout.
IPN callback
Account webhooks (Dashboard → Webhooks / POST /webhooks) plus optional per-invoice ipnCallbackUrl on POST /invoices (same HMAC headers). IPN secret alone is not enough (see GET /account).
Balance / min-amount / payout status
GET /balance (custody), GET /min-amount?fromCurrency=&toCurrency=, GET /payouts/:id, POST /payments/:id/refund ({ refundAddress } + X-MZA-TOTP → custody payout + payment.refunded IPN).
success_url / cancel_url
Optional successUrl / cancelUrl on POST /invoices (https). Tokens: {INVOICE_CODE}, {MERCHANT_ORDER_ID}, {STATUS}. Hosted checkout redirects after PAID / CANCELLED / EXPIRED.
Payout API
POST /api/v1/payouts (LIVE key + payouts:write). Requires body idempotencyKey (bound to amount/destination), destination on Dashboard payout wallets, X-MZA-TOTP (2FA), and optional MZA_PAYOUT_IP_ALLOWLIST. Bare usdt/usdc require network.
Authentication
Create a LIVE API key in Dashboard → API keys. Format: `mza_<8-char-prefix>_<secret>`. New keys include invoices, payments, and webhooks permissions by default.
Authenticate with Authorization: Bearer <full_secret>. Never put secrets in browsers, mobile apps, or public repos — call /api/v1 from your backend only.
Rate limits: 120 requests/minute per API key and 60 auth attempts/minute per IP. Responses include X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset (unix seconds). Exceeding returns HTTP 429 with Retry-After.
SANDBOX: create a key with environment SANDBOX (secret starts with mza_test_). Then POST /sandbox/simulate-payment with paymentId or invoiceId.
LIVE invoices and deposits require at least one active payout wallet with auto-convert (Dashboard → Payout wallets), e.g. USDT BEP-20.
Fix: add a wallet, then retry POST /invoices.
Error: AMOUNT_TOO_SMALL
The fiat or crypto amount is below the network / exchange minimum for the selected coin. Raise amountDue or pick another coin.
Error: COIN_PAUSED
That deposit coin is temporarily unavailable for this merchant or settlement route. Offer another coin at checkout.
Error: RATE_LOCKED_EXPIRED
The ~20 minute deposit rate lock expired. Reselect the coin on hosted checkout to create a fresh payment.
Account & settlements
GET /account — payoutWalletReady, webhookConfigured, feePercent, environment.
GET /settlements and GET /settlements/{id} — settle amounts, fee, rate, txHash, merchantOrderId.
GET /webhooks/deliveries and POST /webhooks/deliveries/{id}/retry — IPN attempt history (HMAC verification unchanged).
Payment statuses
Poll GET /payments/{id} or rely on webhooks. Treat CONFIRMED (and OVERPAID when you accept overpay) as success only after you verify the webhook signature or re-fetch the payment.
Status
Meaning
Merchant action
PENDING
Awaiting on-chain deposit
Show address + amount; wait
AWAITING_CONFIRMATIONS
Tx seen, confirmations in progress
Show progress; do not fulfill yet
CONFIRMED
Required confirmations reached
Fulfill order / credit account
UNDERPAID
Received less than expected
Apply your underpay policy
OVERPAID
Received more than expected
Fulfill; optional credit
EXPIRED
Payment window ended
Create a new invoice/payment
FAILED
Payment failed
Retry or contact customer
REFUNDED
Funds returned
Update order state
Quick start
1. Dashboard → Payout wallets: set your settlement wallet (e.g. USDT BEP-20).
2. Dashboard → API keys: create a LIVE key and copy the secret once (Show/Copy anytime after regenerate).
3. Dashboard → Webhooks / IPN: copy your IPN secret and register an HTTPS callback URL.
4. POST /invoices from your backend. Use data.invoice.checkoutUrl (or /pay/{code}) to redirect the buyer.
5. Buyer pays any supported coin on hosted checkout. After confirmations, we convert to your payout asset.
6. Fulfill only after verifying IPN for payment.confirmed or invoice.paid (or re-fetch GET /payments/{id}|{code}).
Sandbox: use an mza_test_ API key and POST /api/v1/sandbox/simulate-payment. LIVE keys (mza_…) create real on-chain invoices. Hosted payment links are LIVE-only.
Invoices are the primary way to collect payment. Optionally set cryptoCurrency; otherwise the customer chooses at hosted checkout.
POST/invoices
Create invoice
Creates an invoice. If cryptoCurrency is set and live rails are ready, a payment may be created immediately; otherwise the customer selects a coin on the checkout page.
Name
In
Type
Required
Description
Idempotency-Key
header
string
no
Replays the first 201 for 24 hours. A different body with the same key returns 409.
orderId
body
string
yes
Your order id. The response returns it as merchantOrderId. Response orderId is the public MZA- code.
amountDue
body
string
yes
Decimal string, e.g. "49.99"
currency
body
string
yes
Fiat currency, e.g. "USD"
cryptoCurrency
body
string
no
Optional crypto id; omit to let customer choose
description
body
string
no
Shown on checkout
customerEmail
body
string
no
Customer email
metadata
body
object
no
Arbitrary JSON for your system
expiresAt
body
string (ISO date)
no
Invoice expiry
successUrl
body
string
no
https URL; buyer redirected after PAID. Tokens: {INVOICE_CODE}, {MERCHANT_ORDER_ID}, {STATUS}
cancelUrl
body
string
no
https URL; buyer redirected after CANCELLED or EXPIRED. Same tokens as successUrl.
HTTP 201. The body includes data.invoice.checkoutUrl. Generated clients must read the 201 response, not an empty 200.
Request orderId is yours. Response orderId is the public MZA- code. Response merchantOrderId is the request orderId.
On invoice.paid / payment.* / settlement.completed, data.merchantOrderId and data.invoiceCode (or code) are always present when an invoice is linked.
The same Idempotency-Key returns the first response with Idempotent-Replayed: true. A changed body with that key returns 409.
successUrl / cancelUrl (https only) redirect the buyer from hosted checkout after PAID or CANCELLED/EXPIRED. Tokens: {INVOICE_CODE}, {MERCHANT_ORDER_ID}, {STATUS}.
Redirect buyers to data.invoice.checkoutUrl (preferred).
GET /invoices/{id} accepts either the internal cuid or the public MZA-########## code. GET /invoices?merchantOrderId=… looks up by your order id.
Duplicate merchantOrderId / orderId returns the existing invoice (HTTP 200) with Idempotent-Replayed: true and data.replayed=true (not 409).
Missing payout wallet on LIVE returns error.code PAYOUT_WALLET_REQUIRED (with docsUrl).
Omit cryptoCurrency so the customer picks a coin at checkout. Set it only when you want a payment and deposit address in data.payment immediately.
GET/invoices
List invoices
Cursor-paginated invoice list for the authenticated merchant.
Register an HTTPS IPN URL and verify every delivery with your account IPN secret (HMAC). Sorted SHA-512 checks plus Stripe-style timestamp signatures.
Dashboard → Webhooks / IPN: copy your IPN secret and register an HTTPS callback.
Every delivery is a JSON envelope: { id, type, created, data }. Fulfill when type is payment.confirmed or invoice.paid (also subscribe to payment.updated / settlement.completed as needed).
Headers: X-Mza-Ipn-Signature (HMAC-SHA512 of recursively key-sorted JSON), X-Mza-Signature (HMAC-SHA256 of `{timestamp}.{rawBody}`), X-Mza-Timestamp, X-Mza-Event.
Respond with HTTP 2xx quickly. A failed delivery is tried 5 times immediately, then on a schedule, up to 10 attempts total. Dashboard → Test delivery sends a fake webhook, not a simulated payment.
Currently emitted events: payment.updated, payment.underpaid, payment.overpaid, payment.confirmed, payment.refunded, invoice.paid, settlement.completed. Fulfill on payment.confirmed / invoice.paid; use payment.underpaid for partials.