What you provide
A marketplace tenant is configured by three things:- A backend URL. The address of your existing API. The proxy forwards paid requests here.
- An OpenAPI spec with
x-faremeter-pricingextensions. This declares the pricing rules and any response fields the proxy should capture for usage-based billing. - A wallet to receive funds. Settlement deposits into this address.
The OpenAPI spec
The gateway SDK readsx-faremeter-pricing extensions from your spec to generate the proxy config. The extension lives at the operation level (and can also be declared at the path or document level) with rules describing what to charge for and, for usage-based pricing, rates mapping captured fields to per-unit prices.
A minimal example with a fixed-price endpoint and a usage-priced endpoint:
@faremeter/gateway-nginx README.
Restricting payment with x-faremeter-policy
x-faremeter-pricing decides what a route costs. x-faremeter-policy decides how it may be paid: which payment schemes may serve the route, and whether a given scheme is forced to one-phase or two-phase capture. It is a separate extension because the concerns are separate — you can price a route without constraining it, but when you do want to constrain it, the constraint lives next to the price.
Why this matters: the x402 exact scheme has no escrow. In two-phase mode (authorize now, capture later) the payer can move the authorized funds before capture lands, so the operator carries a rug-pull window. On a low-value route that window is a fine trade for the deferred-capture flow; on a high-value route it is not. A policy lets the operator close it per route — either by pinning exact to one-phase (capture happens immediately, so there is no window) or by disallowing it entirely in favor of a scheme that escrows. See Payment Schemes for one-phase versus two-phase capture and what each scheme guarantees.
The extension carries two optional fields:
allow— the set of schemes and methods that may serve this route, each written as"<protocol>:<id>"(for example"x402:exact"or"mpp:solana"). The protocol prefix is case-sensitive and lowercase.- Omitting
allowpermits every scheme and method registered on the gateway. allow: ["x402:exact"]restricts the route to only theexactscheme.allow: []is the deny-all sentinel — it denies everything.
- Omitting
pin— maps a"<protocol>:<id>"key to{ capturesAt: "request" | "response" }, forcing that scheme to one-phase ("request") or two-phase ("response") capture regardless of what the matched handler is otherwise capable of.
exact scheme to one-phase so there is no authorize-then-capture window:
- Operation-level only. Unlike
x-faremeter-pricing, which can also be declared at the path or document level,x-faremeter-policyis read only on individual operations. Declaring it on a path item or on the document is rejected loudly at parse time — it does not silently inherit downward. - Pinning to two-phase has prerequisites. Pinning a scheme to
capturesAt: "response"requires both that the matched handler can authorize and that every pricing rule on the operation definesauthorize. Pinning tocapturesAt: "request"(one-phase) is always safe. - Validated at construction. The policy is cross-checked against the registered handler set when the gateway handler is built, so a misconfigured spec never starts serving requests. Caught at construction: an
alloworpinentry naming a scheme or method the gateway does not serve; apinentry that is not also listed inallow; and a"response"pin against a handler that cannot authorize or a route whose rules lackauthorize. Each error names the operation, the offending entry, and the schemes the gateway actually supports.
The publishing flow
Operate your backend
Your API runs wherever it already runs. The marketplace does not host your code.
Submit a tenant to the marketplace
Through the operator’s control plane (UI or API), register a tenant with your backend URL, your OpenAPI spec, and your settlement wallet address. The control plane stores the configuration and pushes it to API nodes.
Get a proxy URL
The marketplace assigns your tenant a routable URL (for example,
your-tenant.example-marketplace.dev). All public traffic goes there; the proxy validates payment and forwards to your backend.List on the discovery service (optional but expected)
The discovery service is what makes your API findable. Once your tenant is active, list it so the OpenAPI spec, pricing, and proxy URL appear in search results. Consumers query the discovery API to find you.
Where to publish
| Goal | Where |
|---|---|
| Get listed quickly with no operations work | Use a hosted marketplace. Sign-up flow, dashboard, hosted facilitator. |
| Run a marketplace with full control | Deploy the marketplace OSS. See self-hosting. |
| Charge for a single API on your own server | Skip the marketplace entirely — use @faremeter/middleware. |
Specific tenant-onboarding steps (UI flows, request payloads, listing requirements) depend on which marketplace you publish to. Consult the operator’s documentation for exact procedures. The Faremeter docs describe the OSS pieces; the operator describes their product.
What’s next
Gateway SDK
The pricing extensions and config the API nodes generate from your spec.
Payment Schemes
What
exact, charge, and flex mean when you pick a pricing scheme.Facilitators
How the marketplace settles your paid requests on-chain.
Self-hosting
Run the marketplace stack yourself.