Pay for an API call with one signature
This page is a real x402 buyer and the Arclight API is a real x402 seller. The payment settles on Arc through the same facilitator any server can point at. Read how to use it.
Running a seller? Sponsored settlements are rationed per seller address per day. Lock ARCLIGHT to raise your allowance.
Arcloak (arcloak.net) sells per-token inference through this facilitator with the upto scheme.
SETTLED ON ARC MAINNET
Every claim on this page has a transaction behind it.
A signed authorization straight to the facilitator.
0x39ef37ab…e6279f31The browser flow above, end to end through the Arclight API.
0x835fb119…09d6d8ffA NEAR account paid, signing through the MPC network.
0xe47a93d1…66536619Same payment, no browser.
The page above is one buyer. Any process with a key can be another: it reads the 402, signs one USDC authorization and asks again. The facilitator settles it on Arc and pays the gas.
- An EVM key holding USDC, or EURC, on Arc (chain id 5042, RPC https://rpc.mainnet.arc.io). Nothing else: no native gas, no approval, no deposit.
- A seller whose 402 lists network eip155:5042. The Arclight API demo above is one, priced at 0.001 USDC per call.
- Nothing from us. A buyer needs no key, no signup and no allowlist; the seller points at the facilitator, you never call it.
Full reference, limits and what the facilitator never does: docs / x402 facilitator. Machine-readable capabilities: x402.arclight.finance/supported.
import { wrapFetchWithPayment, x402Client } from '@x402/fetch'
import { ExactEvmScheme } from '@x402/evm/exact/client'
import { privateKeyToAccount } from 'viem/accounts'
# 1. Ask. The seller answers 402 with the price in a header.
curl -si https://api.arclight.finance/v1/x402/demo | grep -i payment-required
# PAYMENT-REQUIRED: base64 JSON { x402Version: 2, accepts: [ { scheme, network, asset, amount, payTo, maxTimeoutSeconds, extra } ] }
import { HTTPFacilitatorClient } from '@x402/core/server'
import { ExactEvmScheme } from '@x402/evm/exact/server'
import { paymentMiddlewareFromConfig } from '@x402/hono'
An agent on NEAR can pay too.
NEAR's MPC network controls one root key and signs for a derived key only when the call comes from the NEAR account that derives it. So a NEAR account can spend USDC at an Arc address that no private key anywhere corresponds to. The facilitator sees an ordinary signature and settles it, and still pays the Arc gas.
- A NEAR account with a little NEAR for the signing call. Mainnet or testnet both work; only the derived address differs.
- USDC on Arc at the derived address. No Arc private key is involved, and no native gas: Arclight still pays it.
- Nothing registered anywhere. The address is derived offline, so you can show a user where to deposit before the first NEAR call.
Worked out in your browser, with no request to us and none to NEAR. Fund the address it gives you and that NEAR account can spend it through the facilitator.
import { Account, JsonRpcProvider, KeyPairSigner } from 'near-api-js'
import { secp256k1 } from '@noble/curves/secp256k1'
import { sha3_256 } from '@noble/hashes/sha3'
import { hashTypedData, keccak256 } from 'viem'