# ZiroGate integration guide for AI agents ZiroGate is a non-custodial stablecoin checkout. Every payment gets a unique deposit address, funds are swept 100% to the merchant payout wallet, and signed webhooks report the result. ZiroGate never holds funds, private keys or seed phrases. API base: https://zirogate.com Machine-readable contract: https://zirogate.com/openapi.json Short index: https://zirogate.com/llms.txt ## 1. Authentication (server-to-server) Headers: X-API-Key: zg_live_... X-API-Timestamp: unix seconds X-API-Nonce: 8-128 chars, A-Z a-z 0-9 _ - X-API-Signature: lowercase hex HMAC-SHA256 Canonical string, joined with newlines: Sign it with the API secret. The secret is never transmitted. Timestamp must be within the server tolerance window (default 300 seconds) and every nonce can be used once. Empty body is hashed as an empty string. Node example: const crypto = require('node:crypto'); function sign(secret, timestamp, nonce, method, path, body) { const bodyHash = crypto.createHash('sha256').update(body).digest('hex'); const canonical = [timestamp, nonce, method.toUpperCase(), path, bodyHash].join('\n'); return crypto.createHmac('sha256', secret).update(canonical).digest('hex'); } Use the same API key and secret for all private endpoints. ## 2. Create a payment POST /api/v2/payments Content-Type: application/json Auth: HMAC headers above Body: { "amount": "49.00", "chain": "TRC20", "order_id": "ORDER-123", "return_url": "https://shop.example/return", "callback_url": "https://shop.example/webhook", "metadata": { "customer_id": "42" } } - amount: invoice amount in the merchant profile currency (USD or EUR). - chain: optional chain key. Omit to let the customer choose on checkout. - order_id: your order identifier, echoed in the payment and webhooks. - return_url: optional page the payer returns to after checkout. - callback_url: optional per-payment webhook URL (overrides the account webhook). - metadata: optional JSON object, stored and returned. The response includes: transaction_id, status, amount, token_symbol, chain, deposit_address, invoice_amount, invoice_currency, amount_usd, quote_rate, quote_source, expires_at, checkout_url, return_url, metadata amount is the exact asset amount. invoice_amount + invoice_currency are what the merchant asked for. Redirect the customer to checkout_url. Idempotency: create one payment per order. A payment has one unique deposit address and cannot be reused. ## 3. Hosted checkout Send the customer to the returned checkout_url: https://zirogate.com/v2/pay/ Or generate a link/form with the public API key (no HMAC, no secret): GET /api/public/v2/checkout?api_key=KEY&amount=49.00&order_id=ORDER-123&return_url=... -> 303 redirect to the hosted network chooser POST /api/public/v2/checkout Content-Type: application/x-www-form-urlencoded api_key, amount, order_id, return_url, optional chain -> 303 redirect to the payment page Networks: GET /api/public/v2/checkout/options?api_key=KEY returns: { "currency": "USD", "options": [ { "chain_key": "TRC20", "network_label": "TRON (TRC-20)", "display_name": "USDT on TRON (TRC-20)", "token_symbol": "USDT", "asset_currency": "USD", "is_active": true, "unavailable_reason": null, "avg_cost_usd": 1.5, "avg_cost_label": "~$1.50" } ] } Only networks with a configured merchant payout address are returned. ## 4. Check a payment Simple server-to-server check (form body, no HMAC): POST /api/v2/check-payment Content-Type: application/x-www-form-urlencoded api_key=...&api_secret=...&transaction_id= Omit transaction_id to list recent payments. Optional: status, limit (max 100), offset. A single payment returns the payment object; a list returns { "items": [...], "total": N }. Public, unauthenticated payment status: GET /api/public/v2/payments/ Returns the same shape with return_url and no private billing fields. HMAC alternative: GET /api/v2/payments/ Statuses: - PENDING: waiting for funds, checkout countdown running. - FUNDED: funds detected, sweep in progress. - SWEPT: 100% reached the merchant wallet. Fulfil the order. - EXPIRED: countdown ended. Late payments can still settle for up to 30 days. - FAILED: terminal failure. Never fulfil an order on PENDING or FUNDED. Use SWEPT only. ## 5. Webhooks Events: - payment.funded: funds detected on-chain, settlement in progress. - payment.swept: payment settled 100% to the merchant wallet. Register an account webhook (HMAC): POST /api/v2/webhook Content-Type: application/json { "url": "https://shop.example/wp-json/zirogate/v1/webhook" } The response contains webhook_url, webhook_secret and events. Store the secret server-side. It is the HMAC key for outgoing webhooks. Payload: { "event": "payment.swept", "sent_at": "2026-01-01T00:00:00.000Z", "merchant_id": "", "payment": { "transaction_id": "", "status": "SWEPT", "amount": "49.000000", "invoice_amount": "49.000000", "invoice_currency": "USD", "amount_usd": "49.000000", "chain": "TRC20", "token_symbol": "USDT", "order_id": "ORDER-123", "deposit_address": "T...", "payout_address": "T...", "tx_hash": "...", "sweep_tx_hash": "...", "tx_url": "https://...", "sweep_tx_url": "https://...", "confirmations": 1, "funded_at": "...", "swept_at": "...", "expires_at": "...", "late": false, "metadata": {} } } Headers: x-zirogate-event: payment.swept x-zirogate-timestamp: unix seconds x-zirogate-signature: sha256= x-zirogate-webhook-id: x-zirogate-delivery: Signature: HMAC-SHA256(secret, "."). Verify against the raw body, reject timestamps older than 5 minutes, and deduplicate on transaction_id. Respond 2xx to acknowledge. Non-2xx is retried with exponential backoff (up to 8 attempts). payment.swept is the only event that should mark an order paid. ## 6. Errors Errors use: { "error": { "code": "INVALID_AMOUNT", "message": "..." } } Common codes: INVALID_INPUT (422), UNAUTHORIZED (401), INVALID_URL (422), PAYOUT_ADDRESS_NOT_CONFIGURED (409), CHAIN_NOT_ACTIVE (422), RATE_LIMITED (429), NOT_FOUND (404). ## 7. Constraints and good practice - Non-custodial: never ask the user for a private key or seed phrase. - Use the exact asset amount shown at checkout; do not convert it yourself. - Keep the API secret on the server. Never put it in browser code. - Do not create a new payment while another one for the same order is PENDING. - Fulfil only on SWEPT, or verify with the check API immediately before fulfilment. - Amounts are decimal strings with up to 6 decimals. - The invoice currency comes from the merchant profile (USD or EUR). - Do not cache the payment page; the address and countdown are dynamic. - Abandoned unpaid invoices are free. Billing is charged when a payment completes. ## 8. Useful links - OpenAPI: https://zirogate.com/openapi.json - WordPress plugin: https://zirogate.com/wordpress - WordPress plugin ZIP: https://zirogate.com/api/public/v2/plugin-download - Terms: https://zirogate.com/terms - Privacy: https://zirogate.com/privacy - Support: https://zirogate.com/v2/dashboard/support (merchant login)