Merchant Top-ups
Create Top-up
Pay with x402 and credit the merchant-side balance
POST
Creates (or resumes) a top-up. Unpaid requests receive
402 Payment Required with the exact payment requirements to sign; paid requests settle the payment and perform the merchant deposit. Replaying the same X-PAYMENT returns the existing top-up idempotently.
Path
Merchant id. Currently
antseed. Unknown merchants return 404 unknown_merchant.Headers
Must be
application/json.Base64-encoded signed x402 payment payload. Omit on the first request to
receive the payment requirements via a 402 response.
Body
Address to credit on the merchant contract. Defaults to the payment signer.
Must equal the signer (
authorization.from) — anything else is rejected with
400 buyer_mismatch.Gross amount in USDC base units (6 decimals, e.g.
"5000000" = 5 USDC).
Must match authorization.value when paying. Must be within the bounds
returned by the 402 challenge / quote endpoint.Responses
| Status | Meaning |
|---|---|
200 | Deposited. Body is the public top-up row (state: "deposited", grossAmount, netAmount, source settlementTx, optional Base fillTx, and Base depositTx); settlement details are echoed base64-encoded in the X-PAYMENT-RESPONSE header. |
402 | No/invalid payment (fresh multi-source challenge in accepts[] + topup.sources[] bounds), or settlement failed (fresh challenge — retry with a new payment). |
400 | Rejected before settlement: buyer_mismatch, wrong_network, wrong_recipient, invalid_signature, authorization_expired, amount_mismatch, amount_too_low, amount_too_high, … (errorReason names the cause). |
409 | authorization_reused (payment already used), credit_limit_reached, or deposit_failed (deposit impossible after settlement — the settled amount was refunded, see refundTx). |
503 | Settlement is still unknown or a cross-chain payment is bridging. Poll the returned topupId or retry with the same X-PAYMENT after Retry-After seconds — do not sign a new payment. |
500 | needs_review — an inconsistent, expired, or timed-out bridge state that requires operator attention. |