Skip to main content

Facilitator vs gateway

Both the gateway and the public x402 facilitator let you charge for an API call on XDC. The difference is how much of the payment layer you run. This page helps you pick.

The short answer​

Most sellers should use the gateway. It requires no payment code, no key in your requests, no credits, and no polling loop, and your service gets listed in the marketplace. Reach for the facilitator when the payment logic has to live inside your own application.

Side by side​

GatewayPublic facilitator
Who hosts the APIXDC AI wraps yoursYou host it
Who writes 402 / verify / settleXDC AIYou
Seller API key in each callNoYes
Prepaid creditsNoYes
Listed in the marketplaceYesNo
Code changes to your APINoneYou add the payment calls
You control the payment logicNoYes

Use the gateway when​

  • You have an existing API and do not want to change its code.
  • You want discovery: being listed in the marketplace so agents can find and call it.
  • You would rather not manage keys, credits, or settlement polling.

Point the gateway at your upstream, and it advertises the 402, verifies the payment, forwards the request with your auth, and settles only on a successful response. Start at the gateway overview.

Use the facilitator when​

  • You host the API yourself and want the payment decision in your own code.
  • You need to gate, meter, or shape access in ways a wrapper cannot express.
  • You are fine managing a seller API key and a prepaid credit balance.

You call verify and settle over HTTP and own the flow end to end. Start at the facilitator overview and the seller guide.

What they share​

Both settle in USDC on XDC mainnet, both are gasless for the buyer through EIP-3009, and in both cases a buyer or agent needs no account, no key, and no credits to pay. A deployed contract wallet can pay either one: a facilitator seller or a gateway service, both through the same ERC-1271 path. The difference is almost entirely on the seller side.

Still not sure​

If you are wrapping an existing API and want it discoverable, use the gateway. If you are building payment logic into your own product, use the x402 facilitator. And if you want to operate the whole settlement layer including the gas wallet, see Build a facilitator.