Developers & APIs

REST API Crypto Payment Gateway: Build Checkout on Your Terms

Short answer: A REST API crypto payment gateway lets your backend create a payment with one authenticated call, then tells your server by signed webhook when the customer has paid in USDC, USDT or another coin. Payzum is non-custodial: each payment settles to a wallet you control, minus a 0.5% fee, with no chargebacks.

Key takeaways

  • One server-side POST /v1/payment with an x-api-key header returns a payment_id and a hosted invoice_url, and that is the whole create step.
  • Release goods on the signed IPN (HMAC-SHA-512 in the x-nowpayments-sig header), never on a browser redirect or a widget callback.
  • Funds land in your own wallet, so your order model needs no "awaiting payout" state. Payzum keeps 0.5% of each sale and the network takes its gas.
  • A separate staging stack with its own keys lets you run the full flow in tests before a real coin moves.

Why a custom checkout needs a crypto payment API

Plugins work when the store runs on WooCommerce or Shopify. A marketplace with its own cart, a SaaS with in-house billing or a headless storefront has nowhere to install one. Those teams need a REST API crypto payment gateway: an endpoint their backend calls to open a payment, and a callback that proves when the money has arrived.

Most teams already work in that shape. Postman's 2025 State of the API Report surveyed more than 5,700 developers and API leaders and found REST in use at 93% of teams, with webhooks at 50%. A crypto gateway that speaks plain REST and signed webhooks fits the tooling and test suites a team already runs.

Search for a "crypto payment gateway API", though, and the results split into two groups. Custodial gateways put an API on top of their own ledger. Every payment lands in the provider's balance and reaches you after a payout schedule, a risk review or a withdrawal threshold. The other group is raw chain tooling: node providers, wallet libraries and tutorials on watching the mempool. With those, you end up building the gateway yourself.

The build-it-yourself bill for a $40,000-a-month marketplace

An in-house gateway looks cheap because the transfers cost cents. The expense is the code around them. A team that watches chains on its own has to build and keep running all of this:

  • Address handling: a fresh deposit address per order, or one shared address with amount matching, and each approach breaks differently.
  • A confirmation policy for every network. Ethereum.org puts full finality on Ethereum mainnet at about 15 minutes, while Solana and Base confirm in seconds.
  • Short payments, double payments, payments after the deadline and tokens sent on the wrong network.
  • Price quotes that expire, so a $250 order is still $250 when the coins arrive.
  • Signed callbacks into your own order service, with retries and a replay guard.
  • Monitoring, RPC plans or nodes for each chain, and someone on call for all of it.

Take a marketplace expecting $40,000 a month in stablecoin checkout, or $480,000 a year. The US Bureau of Labor Statistics puts the median software developer wage at $135,980 for May 2025. Over 2,080 working hours that is about $65.38 an hour. The time estimates in the table are assumptions made for this example.

Cost line, year oneBuild it in-housePayzum REST API
Initial engineering10 weeks: 400 h × $65.38 = $26,1521 week: 40 h × $65.38 = $2,615
Upkeep after launchA quarter of one engineer: $33,995 a yearYour webhook handler, maintained with the rest of the app
Processing fee on $480,000$00.5% = $2,400
On-chain gasYours, plus sweeping costs if you use per-order addressesCents per payment on Base, Polygon or Solana
Nodes, RPC and monitoringYours to buy and run (not priced here)Nothing to run on your side

On salary alone, before benefits and infrastructure, the in-house route costs about $26,000 up front and $34,000 a year to keep alive. The fee at this volume is $2,400 a year. With these assumptions, the upkeep line only falls below the fee once crypto volume passes about $6.8 million a year ($33,995 ÷ 0.005).

Where card APIs and custodial crypto APIs leave the same gap

A card processor's API can be well designed and still inherit the card network under it. Money reaches the bank in one to three days. A cardholder can dispute the sale months after you shipped, and the acquirer's risk team can hold the account.

Custodial crypto gateways replace the card rail and recreate the problem one layer up. The transfer on-chain is final, yet until the payout runs, what you own is a balance in the provider's database. A compliance flag, a policy change or the provider's own banking trouble can freeze it. If the company closes, you queue with its other creditors, as we covered in what happens when a crypto payment provider shuts down.

The answer is to split the two jobs. The API handles checkout mechanics: amounts, quotes, deadlines, confirmations and callbacks. Settlement goes straight to an address the merchant controls. That split defines a non-custodial crypto payment processor, and Payzum's REST API is built around it. If you are still weighing providers, our comparison of eight crypto payment processors sets the custody models side by side.

What Payzum's REST API exposes to your backend

Payzum is a non-custodial, crypto-only processor. Its merchant API follows the request and response habits of the card APIs your team already knows. The difference is that Payzum never holds a balance for you.

One call creates the payment

Your server sends POST /v1/payment with the x-api-key header. Three fields are required: price_amount, price_currency and pay_currency. Set pay_currency to "all" and the buyer picks the coin and network at checkout. Optional fields include your order_id, return URLs and the ipn_callback_url for webhooks.

The response carries a payment_id (prefixed pzi_) and an invoice_url for the hosted checkout. Store the payment_id on your order, because every later event points back to it. An optional Idempotency-Key header makes a retried create return the original response for 24 hours. The docs call that deduplication best-effort, so also refuse a second payment for the same order_id on your side.

Field names and the default webhook format follow the NOWPayments convention, so a team that has integrated NOWPayments will recognize the payload. Our Payzum vs NOWPayments comparison covers what else differs.

A signed IPN tells you when to ship

When an invoice is paid or expires, Payzum POSTs the payment object to your ipn_callback_url. The body is signed with HMAC-SHA-512 and your webhook secret, the construction defined in RFC 2104. The hex signature arrives in the x-nowpayments-sig header, and your handler recomputes it over the raw bytes before parsing any JSON.

Each delivery also carries an event_id that stays the same across retries, which makes duplicates easy to drop. An event_at timestamp supports a replay window; the docs suggest 10 minutes. Failed deliveries are retried up to 5 times, 30 seconds apart, with a 10-second timeout per attempt. After that they wait in a dead-letter queue in the dashboard, where you can send them again. Our guide to signed webhooks for crypto payments walks through the verification code.

API keys stored as hashes

Broken authentication ranks second on the OWASP API Security Top 10 (2023). Payzum stores only a SHA-256 hash of each API key plus its last four characters, so the full key is shown once, at creation. Rotating it kills the old key on the next request. Staging and production are separate stacks, and a key only works on the host that issued it.

Settlement that never passes through Payzum

The API runs the checkout, but the coins move on-chain to a wallet whose keys you hold. Payzum watches the chain and moves the invoice to its final status, so your code never decides how many confirmations each network needs. With auto-convert on, whatever the buyer pays settles as USDC or USDT. Payzum's 0.5% comes out of the amount received: a $250.00 order puts $248.75 in your wallet, and on-chain gas is extra. Confirmation takes about 0.4 seconds on Solana and about 2 seconds on Base and Polygon.

Other ways to take payment on the same account

If you would rather not render payment UI, send the buyer to invoice_url, or let the widget open the same checkout as a modal (Payzum.open()) or inline (Payzum.openInline()). The account also issues no-code payment links, recurring crypto subscriptions, donations and POS invoices. If you sell an API, the dashboard can publish an x402 endpoint in front of it so AI agents pay per call in USDC on Base. The integration page shows each surface with screenshots, and our SDK guide covers the Node.js, PHP, Python and Rust libraries.

Wiring the API into your order service in four steps

  1. Get a staging key. Register on the staging dashboard, create a merchant and copy the API key from the reveal page into your secrets manager, since it will not be shown again.
  2. Point settlement at your wallet. Any address you control works: a hardware wallet, a multisig or a team treasury. Turn on auto-convert to USDC or USDT for dollar-stable receipts. The production account also goes through KYC and supports 2FA.
  3. Create the payment at checkout. Call POST /v1/payment from your server with the order's amount and order_id, save the payment_id, then redirect to invoice_url or mount the widget.
  4. Ship on the webhook. Verify the signature on the raw body, discard repeated event_ids, route on payment_status and answer with a 2xx quickly. Once the tests pass, swap the base URL and key for production ones.

The round trip, with the real field names:

# 1) Create the payment from your backend (never from the browser)
curl -X POST "$PAYZUM_BASE/v1/payment" \
  -H "x-api-key: $PAYZUM_API_KEY" \
  -H "Idempotency-Key: checkout-order_1842" \
  -H "content-type: application/json" \
  -d '{ "price_amount": 250, "price_currency": "usd", "pay_currency": "all",
        "order_id": "order_1842",
        "ipn_callback_url": "https://yourapp.com/payzum/ipn" }'

# 201 → { "payment_id": "pzi_…", "payment_status": "waiting",
#         "invoice_url": "https://merchant.payzum.com/pay/pzi_…", … }
#   Save payment_id on order_1842 and send the buyer to invoice_url.

# 2) The buyer pays from any wallet. Payzum tracks the confirmations.

# 3) Payzum POSTs the payment object to your ipn_callback_url
#    x-nowpayments-sig: hex HMAC-SHA-512 of the raw body, keyed with your webhook secret
#    { "payment_id": "pzi_…", "order_id": "order_1842",
#      "payment_status": "finished", "event_id": "…", "event_at": … }

# 4) Verify the signature, skip a seen event_id, mark the order paid, fulfill.
#    The money is already in your wallet. Nothing is left to withdraw.

Step 4 is where card habits mislead people. No state in this lifecycle waits for a payout, because settlement happened when the customer paid.

Every payment_status your webhook handler has to route

The merchant API reports five statuses. Two of them reach you by webhook today. You see the others by reading GET /v1/payment/:id, which accepts either the payment_id or your own order_id. Payzum's invoice lifecycle reference has the full mapping.

payment_statusHow your server learns itWhat the order service should do
waitingThe create response, or a pollKeep the order pending and hold stock until the deadline
partially_paidNo webhook yet; poll GET /v1/payment/:idHold the shipment and ask for the rest before the timer ends
finishedSigned IPNMark paid and fulfill. If actually_paid exceeds pay_amount, return or credit the excess
expiredSigned IPNRelease the stock, close the order and ship nothing
failedNo webhook (a cancellation); pollClose the order and let the buyer start again

Three informational deliveries share the same payload shape: wrong_token_received, suspicious_token_received and late_deposit_received. Send them to a review queue; none of them should trigger fulfillment. A deposit that lands after expiry, for example, calls for a new invoice at today's price or a refund. Our guides to the underpaid crypto invoice and to refunding a crypto payment cover both step by step.

Plan your polling too. Authenticated endpoints allow 60 requests a minute per merchant, so let the webhook carry the normal path and poll only for the partial and cancelled cases.

Four products teams ship on the same payment endpoint

  • A Latin American marketplace with its own cart opens one payment per cart with pay_currency: "all", so buyers in Chile or Mexico can choose USDC on Polygon or Solana. The cart ID goes in order_id, and finance matches each settlement to an order without waiting for a bank statement.
  • A B2B SaaS puts "pay in stablecoins" next to cards in its own billing screen. Renewals run as Payzum subscriptions, and each renewal IPN carries invoice_type: "subscription" and next_renewal_at. The billing service extends the plan from the webhook alone, and no renewal can come back later as a chargeback.
  • A DTC brand on a headless stack mounts Payzum.openInline() inside its own checkout step. Order creation, receipts and status pages stay in the brand's code, driven by the API and the IPN.
  • A market-data company already billing human customers through the API adds machine customers. In the dashboard it enters its endpoint, its upstream API key and a per-call price. Payzum publishes an x402 URL, returns the 402, settles through an external facilitator (Coinbase's, today) and proxies each paid call to the real endpoint. Agents pay USDC on Base straight into the company wallet.
The Payzum inline widget rendering the crypto checkout inside a page, with amount, order reference, expiry countdown and the embed snippet
Inside Payzum: the inline checkout widget, with amount, order reference and expiry countdown.

Custodial gateway API vs Payzum REST API, row by row

QuestionCustodial gateway APIPayzum REST API
Where the money sits after paymentIn the provider's balance until you withdrawIn your wallet, at confirmation
When you can use itAfter the payout schedule or thresholdSeconds after confirmation on fast networks
Account riskHolds, reviews and frozen balances can happenNo Payzum balance exists to freeze
Webhook trustSigning schemes vary by providerHMAC-SHA-512 over the raw body, fixed header, event_id for dedup
API key storageVariesSHA-256 hash only, shown once, instant rotation
Late, short and long paymentsOften left to your codeDefined statuses, overpayment detection and a deadline per invoice
TestingSandbox quality variesSeparate staging stack with its own keys and widget host
Agent paymentsRarely offeredx402 endpoint per API, USDC on Base per call
FeeVaries by provider0.5% per sale, deducted from the amount received, plus gas

What engineering leads ask before they sign off

"We don't want to run blockchain infrastructure."

You won't have to. Payzum handles deposit addresses, payment detection and confirmation tracking on Bitcoin, Ethereum, Solana, Polygon, Base, Arbitrum, Optimism, BNB Chain and Avalanche. Your servers make HTTPS calls and check HMACs. No nodes, RPC contracts or private keys live in your stack, and the settlement wallet stays wherever your treasury keeps it today.

"If payments are final, how do refunds work?"

Finality removes the reversals you never agreed to, so no issuer can pull back a settled sale months later. A refund you do agree to is a new transfer from your wallet, sent under your own policy to an address the customer confirms. You keep the decision, and you stop paying for disputes and "item not received" claims on goods that arrived.

"We already have a card processor. Is this a migration?"

No. Crypto runs beside cards as one more payment method inside the same order lifecycle, and the card flow stays as it is. The first buyers to use it tend to be the ones cards were losing: cross-border customers whose cards decline, and people who already hold stablecoins.

"What does each transaction cost?"

Payzum takes 0.5% of each sale from the amount received, so a $1,000 invoice leaves $995 in your wallet. On-chain gas is extra and runs to cents on Base, Polygon and Solana. Nothing is held back as a reserve, because Payzum never holds the funds in the first place.

Frequently asked questions

What is a REST API crypto payment gateway?

It is a payment processor you integrate over HTTPS. Your backend creates a payment with an authenticated call, the customer pays in USDC, USDT or another coin, and the gateway notifies your server by signed webhook. A non-custodial gateway such as Payzum settles each payment to your own wallet instead of a provider balance.

How do I verify a Payzum payment webhook?

Compute an HMAC-SHA-512 of the raw request body with your webhook secret and compare it, in constant time, with the hex value in the x-nowpayments-sig header. Do this before parsing the JSON. Then drop any event_id you have already processed and reject deliveries whose event_at falls outside your replay window.

Which networks can I accept through the API?

Bitcoin, Ethereum, Solana, Polygon, Base, Arbitrum, Optimism, BNB Chain and Avalanche, including USDC and USDT. Send pay_currency "all" to let the buyer choose, and turn on auto-convert if you want everything to settle in one stablecoin.

Does Payzum send a webhook for every payment status?

No. Signed IPNs fire when an invoice is paid (finished) or expires, plus informational events such as late_deposit_received. Partial payments and cancellations send no webhook today, so read them with GET /v1/payment/:id.

Can I test the integration before going live?

Yes. Payzum runs a full staging stack with its own dashboard, API keys and widget host, and the dashboard includes an integration playground for building requests. Staging can offer testnets, so read its currency list instead of hardcoding one. When the flow passes, switch the base URL and key to production.

Can AI agents pay my API through the same account?

Yes. Enter your existing endpoint, its API key and a price in the dashboard, and Payzum publishes an x402 URL in front of it. Agents pay USDC on Base per call, the payment settles through an external facilitator to your wallet, and Payzum forwards each paid request to your real endpoint.

Design your API integration with us

Every custom checkout has its own order model and webhook setup. Book 20 minutes with our team and we'll map your integration: the payment call, IPN handling, staging tests and non-custodial settlement to your own wallet. You leave with a technical plan for your stack.

Prefer not to use the embed? Book directly here · [email protected]