For sellers: moving to the Allotr facilitator
If your API charges with x402 (HTTP 402 → the agent sends a signed payment → you settle it), the Allotr facilitator can do the settling. Agent payments go straight to your wallet; we send the transaction on-chain and pay its gas. Your server needs no crypto infrastructure (RPC, gas wallet, nonce management).
Testnet only for now: Base Sepolia (
eip155:84532) and Circle test USDC (0x036CbD53842c5426634e7929541eC2318f3dCF7e). Mainnet follows an independent security audit.
| Facilitator URL | https://facilitator.allotr.xyz |
| Panel | https://app.allotr.xyz/app/ → Facilitator section |
| Protocol | x402 v2, exact scheme (EIP-3009 transferWithAuthorization) |
| Fee | per successful settlement: real gas cost × 1.25, at least 0.001 USDC; verification is free |
Contents: How it works · Setup (panel) · Connect your server · Fees and credit · Error codes · Webhooks · Security · FAQ
How it works
agent ──(1) GET /api/data───────────────▶ your server ──▶ 402 + payment requirements (price, payTo = your wallet)
agent ──(2) signed payment (PAYMENT-SIGNATURE)▶ your server ──(3) POST /verify ─▶ Allotr facilitator
your server: does the work
your server ──(4) POST /settle + API key ─▶ Allotr facilitator ──▶ chain
agent ◀──(5) data + receipt (PAYMENT-RESPONSE)── your server
(later, optional) Allotr ──webhook──▶ your server
- The agent doesn’t know about Allotr and doesn’t need to; it pays with any x402 client.
- Money moves from the agent directly to your
payToaddress; Allotr never holds it. - Our fee is not deducted from the payment: if the agent pays 0.01, you receive 0.01. Fees are recorded as a debt and collected in batches from the fee permission you grant (below).
1. Setup (in the panel, once)
Go to https://app.allotr.xyz/app/.
- Sign in: with an email code, Google or a wallet (SIWE).
- Link your wallet: link the wallet that receives payments (signature). Every action that moves money or changes settings requires this wallet’s signature; an email session alone is not enough.
- Grant a fee permission: Facilitator → “Grant Allotr a fee permission”. You give Allotr’s fee collector a limited
permission (on-chain, in the SpendController contract) to withdraw only accrued facilitator fees from your wallet.
- You choose the limits when you grant it. The values pre-filled in the panel (at most 1 USDC per day, 5 USDC in total, 90 days) are only a suggestion; adjust them to your sales volume (there’s a rough formula below). A grant can’t be edited on-chain later: for different limits, grant a new one and revoke the old one.
- If the grant runs out, settlements stop: when the daily or total limit is used up, the grant expires, or your
wallet runs low on USDC, new settlements are rejected with 402 (
fee_credit_insufficient) until you grant a new one. Thefee_grant.lowwebhook warns you before that happens. You can revoke the grant from the panel at any time (revoking it also stops your settlements). - You sign twice (USDC
permit+ the grant); no ETH needed, Allotr sends the transaction. The grant is free, but your wallet must hold at least 0.10 USDC (against spam with empty keys). - Tip: grant it from the wallet that receives payments; every sale brings money to that wallet and fees are paid from there.
- Create an API key: Facilitator → “Create key” (signature). The key (
alk_test_…) is shown once; store it in your server’s secrets (for example theALLOTR_FACILITATOR_KEYenvironment variable). You can open a separate key per server and revoke them one by one. - Allowed payout addresses (payTo): settlements only go to addresses on this list. When you create your first key, your account’s linked wallets are added automatically; adding or removing another address requires a signature.
If any of these steps is missing, you’ll see a warning at the top of the Facilitator section.
2. Connect your server
The only things that change on your server are the facilitator URL and the API key header added to /settle
requests. Prices, payTo, paid endpoints and the agent side stay the same.
Official x402 packages (@x402/hono) — tested
Verified live with @x402/core 2.31.0, @x402/hono 2.31.0 and @x402/evm 2.31.0:
import { Hono } from "hono";
import { paymentMiddleware, x402ResourceServer } from "@x402/hono";
import { ExactEvmScheme } from "@x402/evm/exact/server";
import { HTTPFacilitatorClient } from "@x402/core/server";
const facilitator = new HTTPFacilitatorClient({
url: "https://facilitator.allotr.xyz",
// /settle needs a key; /verify and /supported are open.
createAuthHeaders: async () => ({
settle: { Authorization: `Bearer ${process.env.ALLOTR_FACILITATOR_KEY}` },
}),
});
const resourceServer = new x402ResourceServer(facilitator).register("eip155:84532", new ExactEvmScheme());
const app = new Hono();
app.use(
paymentMiddleware(
{
"GET /api/data": {
accepts: [{ scheme: "exact", price: "$0.01", network: "eip155:84532", payTo: "0xYOUR_WALLET" }],
description: "Example paid data",
},
},
resourceServer,
),
);
app.get("/api/data", (c) => c.json({ ok: true }));
The payTo address must be on your allowed payout addresses list in the panel, otherwise settlement returns 403.
Other official packages (@x402/express, @x402/next …) — not tested
These packages also talk to the facilitator through HTTPFacilitatorClient from @x402/core; passing url and
createAuthHeaders as above should be enough. We haven’t tested them yet; if you run into trouble, let us know.
Another language / your own x402 code
The facilitator exposes the standard x402 v2 HTTP interface:
| Endpoint | Key | Description |
|---|---|---|
GET /supported |
no | supported schemes/networks and the signer address |
POST /verify |
no | { x402Version, paymentPayload, paymentRequirements } → { isValid, invalidReason?, invalidMessage?, payer? } |
POST /settle |
yes | same body → { success, transaction, network, payer?, amount?, errorReason?, errorMessage? } |
GET /pricing |
no | current pricing and the average fee over the last 24 hours |
Add the Authorization: Bearer alk_test_… header to /settle requests. Example:
curl https://facilitator.allotr.xyz/supported
curl https://facilitator.allotr.xyz/pricing
Recommended order (the default x402 flow): verify → do the work → settle on success. Don’t settle a failed request.
@allotr/server (coming soon)
Our own Hono middleware (httpFacilitator(url, { apiKey })) is not published on npm yet.
Fees and credit
Fee: for every successful settlement, that transaction’s real gas cost (L2 execution + L1 data fee, from the
receipt) × ETH/USD (Chainlink) × 1.25, at least 0.001 USDC. Verification (/verify), failed settlements and
rejected requests are free. There is no free quota. Current values: GET /pricing.
The 25% on top of gas is Allotr’s margin. Example with a measured settlement (about 86k gas, about 0.00128 USDC of gas each): 1,000 settlements cost you about 1.60 USDC, of which 1.28 USDC is gas paid to the network and 0.32 USDC stays with Allotr. Gas prices change, so these numbers will too; when gas costs less than 0.0008 USDC, the 0.001 minimum applies and 1,000 settlements cost 1 USDC.
Collection: fees first accrue as a debt; when the debt passes the collection threshold (at least 0.10 USDC, more if gas rises) or the oldest fee turns 24 hours old, the fee collector withdraws it from your fee permission in a single transaction. Allotr sends the withdrawal with its own gas. Example: a seller with 1000 settlements a day sees ~11 withdrawals a day; one with 20 settlements a day sees one.
Credit check: before every /settle, we check that your unpaid debt + the largest possible fee for this settlement
fits within the smallest of:
- the amount currently withdrawable from your fee permissions (grant limit, USDC in your wallet, the allowance you gave the contract),
- the debt cap: 1.25 × the threshold for a new account; at least 1 USDC (3 × the threshold) for an account that has paid at least 1 USDC, is 7 days old and whose last withdrawal didn’t fail.
If it doesn’t fit, the settlement is not sent at all and 402 is returned (below). In other words, if your fee
grant runs out or expires, your sales stop; keep the limit comfortably above your volume and listen for fee_grant.low. Don’t keep the grant limit tight:
the limit is a ceiling, not an invoice; only real accrued fees are withdrawn. Roughly: daily limit ≈ settlements per
day × average fee (/pricing) × 3, at least 1 USDC (for example 1000 settlements a day × ~0.0015 → ~5 USDC).
Error codes
For /settle and /verify, an invalid payment is not an HTTP error: the response is 200 and the result is in the
body’s isValid / success and invalidReason / errorReason fields. HTTP errors are about the request itself:
| Code | error |
Meaning | What to do |
|---|---|---|---|
| 400 | — | malformed body (missing x402Version, paymentPayload or paymentRequirements) |
fix the request |
| 401 | api_key_required |
no key on /settle, or the key is invalid or revoked |
create / check a key in the panel |
| 402 | fee_credit_insufficient |
not enough fee credit: no fee permission, not enough left on it, or at the debt cap | read the message field; grant a permission / raise the limit in the panel; at the debt cap it clears after the next withdrawal |
| 403 | pay_to_not_allowed |
payTo is not an allowed address |
add the address in the panel |
| 413 | — | body larger than 16 KB | — |
| 429 | rate_limited |
rate limited; wait for the Retry-After header |
— |
| 500 | internal_error |
unexpected error | retry; if it persists, let us know |
Rate limits: 120 requests per minute per IP (/verify, /supported, /pricing); 10 settlements per second and
300 per minute per key; 30 attempts per minute per IP with an invalid key.
Webhooks
Optional. When an event happens, Allotr POSTs a signed JSON body to the https URL you set in the panel. Webhooks
don’t affect the agent’s payment flow: your server already learns the settlement result instantly from the /settle
response; webhooks are for accounting, order records and alerts.
Panel → Facilitator → Webhooks → URL + events → “Add URL (signature)”. The signing secret (whsec_…) is shown
once. “Send test” delivers a ping event.
| Event | When | data |
|---|---|---|
settlement.succeeded |
settlement is on-chain; sent once the fee is computed (a few seconds). If the fee can’t be computed within 2 minutes, fee: null |
transaction, payer, payTo, amount, fee, settledAt |
settlement.failed |
/settle returned a failure (invalid payment, no balance…) |
payer, payTo, amount, reason, transaction |
settlement.rejected |
settlement not attempted because credit was insufficient (402); at most once per 10 minutes per account | payTo, amount, reason |
fees.collected |
accrued fees were withdrawn from your fee permission | collection, grantId, amount, transaction, charges |
fee_grant.low |
the amount withdrawable from your fee permissions is running low (below 2 × the debt cap; once) | collectable, debtCap, grants |
ping |
test from the panel | message |
Amounts are µUSDC (6 decimals) strings: "1000" = 0.001 USDC.
Body:
{
"id": "evt_…",
"type": "settlement.succeeded",
"created": 1795948688,
"network": "eip155:84532",
"data": { "transaction": "0x…", "payer": "0x…", "payTo": "0x…", "amount": "1000", "fee": "1824", "settledAt": 1795948687 }
}
Headers: Allotr-Signature: t=<unix seconds>,v1=<hex>, Allotr-Event-Id, Allotr-Event-Type.
Verify the signature (v1 = HMAC-SHA256(secret, "<t>.<raw body>")). Verify against the raw text before
parsing it as JSON; reject if t is older than 5 minutes (against replays):
import { createHmac, timingSafeEqual } from "node:crypto";
export function allotrVerify(rawBody, signatureHeader, secret) {
const { t, v1 } = Object.fromEntries(signatureHeader.split(",").map((p) => p.split("=")));
if (!t || !v1 || Math.abs(Date.now() / 1000 - Number(t)) > 300) return false;
const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest();
const given = Buffer.from(v1, "hex");
return expected.length === given.length && timingSafeEqual(expected, given);
}
Delivery rules:
- Return 2xx = delivered. Anything else (10 s timeout, including 3xx; redirects are not followed) is retried: 30 s, 2 min, 10 min, 30 min, 1 h, 3 h, 6 h, 12 h (8 attempts, ~1 day).
- At least once: the same event may arrive more than once; deduplicate by
id. Order is not guaranteed. - A URL that receives nothing for 3 days is disabled; you can re-enable it in the panel. The panel shows recent deliveries and failure reasons.
- The URL must be a public https address (local/private network addresses are rejected). At most 5 URLs per account.
Security
- An API key can’t move money: it only authorizes “settle this payment”. Even if it leaks, settlements can only go to your allowed addresses; a thief can’t settle to their own address and bill the fee to you. Revoke it in the panel when you notice. Allotr stores only the key’s SHA-256 hash.
- The fee permission is limited: the collector withdraws at most the daily and total limit of the grant, and only as much as the accrued fees. The grant is on-chain; revoke it from the panel or directly on the contract.
- Signed panel actions: key, payTo and webhook URL changes require a signature from a wallet linked to your account. Even if your email is compromised, these can’t be changed.
- The agent’s risk: in the worst case an agent loses the amount it signed, once; the real trust question is your delivery. The default flow (verify → work → settle) never makes an agent pay for a failed request.
FAQ
Does Allotr hold the money? No. The payment moves from the agent directly to your payTo address.
Is the fee deducted from the payment? No. You receive the full payment; fees are withdrawn separately, in batches, from your fee permission.
Why a fee permission instead of an invoice? Because we pay settlement gas up front, the permission caps the risk of non-payment at a small, known amount (the debt cap). No card or invoice; opening an account takes minutes.
Do agents need to use Allotr? No. An agent pays with any x402 client and doesn’t know who the facilitator is.
Can I switch back to another facilitator? Yes: change the facilitator URL on your server. Before revoking your fee permission, wait for the last fees to be withdrawn (at most 24 hours; when “unpaid fees” in the panel is zero), then revoke it from the panel.
When is mainnet? After an independent security audit. For now it runs on testnet (test USDC, no real money).