x402 payments

What Is an x402 Payment Gateway for AI Agents?

How an x402 payment gateway lets AI agents pay for API calls with USDC, how the HTTP 402 flow works, what it costs, and how European sellers settle agent revenue to euros.

Articles
5 min read

AI agents are starting to buy things on their own — data lookups, model calls, geocoding, document parsing, any API a workflow needs. But agents do not check out the way people do. They will not fill in a card form, confirm an email, or wait for a subscription to be approved. They send a request, and they need a way to pay for that request the moment it is made.

An x402 payment gateway is the layer that makes this possible. It turns "pay for this API call" into part of the HTTP request itself, using the long-dormant `402 Payment Required` status code as the handshake. This guide explains what that gateway does, how a single paid call flows end to end, and what a business actually needs to collect and keep that revenue.

What an x402 payment gateway does

Think of it as a tollgate in front of your API. When a request arrives without payment, the gateway does not return the data. Instead it replies with an HTTP 402 response that spells out, in a format a machine can read, exactly what payment is required: the amount, the token, the network, and where to send it.

The client — usually an AI agent — reads those terms, signs a payment authorization, and sends the request again with the proof attached. The gateway verifies that proof, and only if it checks out does it forward the request to the real endpoint behind it. Your API never has to think about money; it just receives requests that have already been paid for.

Three jobs sit inside that gateway:

  • Stating the price for an endpoint in a machine-readable way.
  • Verifying the payment proof a client attaches before any work is done.
  • Recording each paid call so revenue can be reconciled later.

How a single paid request flows

The whole exchange takes two round trips and finishes in seconds:

  • The agent calls a priced endpoint with no payment attached.
  • The gateway answers with `HTTP 402`, including the price, the accepted token (commonly USDC), the network (commonly Base), and the recipient address.
  • The agent signs a payment authorization for that exact amount and resends the request with the proof in the headers.
  • The gateway verifies the proof, settles the payment, and forwards the request to the protected API.
  • The API returns its normal response, and the seller gets a settlement record for the call.

No account creation, no stored credentials, no invoice at the end of the month. The agent pays for precisely what it uses, and access is granted the instant payment clears.

Why agent payments break the old model

Subscriptions and API keys were designed for a human who signs up once and uses a service for months. Agents flip every assumption behind that.

An agent may call your API once and never return. It may spin up, do a job, and disappear before a free trial would even finish. It compares prices across providers in milliseconds and routes to whichever endpoint answers its need most cheaply. Asking it to register an account or hold an API key adds friction that, at machine speed, simply means it picks a competitor.

That is why pay-per-call matters for agent traffic: it matches how agents actually behave. They are willing to pay, often more readily than humans, as long as the price is clear and the payment is instant.

Pricing API calls for agents

Per-call pricing only works if the price reflects the value of one request. A few practical guidelines:

  • Price each endpoint by the value it delivers, not by a flat blanket rate — a heavy data query and a simple status check should not cost the same.
  • Keep individual prices small enough that an agent does not need to deliberate, but large enough to cover the work plus any settlement overhead.
  • Use a stable, low-fee network so transaction costs do not swallow the margin on a cheap call.
  • Be consistent, because agents will learn your pricing and route accordingly.

The goal is a price an agent treats as a non-decision: cheap enough to pay automatically, fair enough that it keeps coming back.

The gap between getting paid and keeping the money

Accepting a stablecoin payment is the easy part. The harder part — and the reason a raw gateway is not enough for most businesses — is everything that happens after the payment lands.

A busy API can take thousands of tiny payments a day. On their own, those are an operational headache: a flood of micro-transactions, balances sitting in stablecoins, and no clean line from "agent paid" to "this appears in our books in euros." European businesses in particular still need to run on euros, keep auditable records, and stay in control of when and how funds move.

This is the seller side of the agent economy, and it is where Apiosk focuses:

  • Accept agent payments in stablecoins without custodial lock-in.
  • Bundle many micro-payments instead of processing each one separately.
  • Convert to euros under rules the seller approves, on the seller's schedule.
  • Produce settlement records that reconcile cleanly for accounting.

Getting started

If you sell data, API access, workflows, or any digital service an AI agent might call, x402 lets payment become part of the request itself — no signup wall, no key management, no monthly billing cycle to chase.

The protocol gets an agent to pay. A settlement layer like Apiosk is what turns that stream of stablecoin micro-payments into euro revenue you can actually account for. Together they let you serve agent traffic the same way you would serve any paying customer: price the work, collect on each request, and reconcile the result.

Frequently asked questions

What is an x402 payment gateway?

An x402 payment gateway sits in front of a paid API. It returns an HTTP 402 challenge that states the price and payment details, verifies the signed payment proof a client attaches, and only then forwards the request to the protected endpoint.

Can AI agents pay for APIs without an API key or subscription?

Yes. With x402 the payment itself is the access credential. An agent pays for the specific request it is making, so it does not need to register an account, store a long-lived API key, or commit to a monthly plan before it can call the endpoint.

Which currency do agents pay in, and what does the seller receive?

Agents typically pay in a dollar stablecoin such as USDC on a low-fee network like Base. The seller can keep the stablecoin or, with a service like Apiosk, have many small payments bundled and converted to euros under rules the seller sets.

How is x402 different from a normal payment gateway like Stripe?

A traditional gateway is built around human checkout - cards, sessions, and recurring billing. An x402 gateway is built around a single machine request: it prices one API call, settles it in stablecoins in seconds, and needs no human in the loop.

How does Apiosk help European sellers?

Apiosk handles the seller side of agent payments - accepting stablecoins, bundling thousands of micro-payments, converting to euros under seller-approved rules, and producing settlement records that reconcile cleanly for accounting.

AI is going to pay. Can you take the money?With Apiosk you can.

Connect once. We bundle the stablecoins AI pays you, turn them into euros, and your books are done. Crypto in, euros out. Europe first.