Skip to main content
@openx402/bazaar-sdk is the seller-side package. It compiles readable configuration into the official x402 Bazaar extension. It does not sign, settle, hold keys, or replace the facilitator.

Declare a complete HTTP resource

Configure server defaults once, then declare the route, payment, and discovery metadata together:
Wire the returned payment config into the official middleware:
The route object includes path, routeKey, resourceUrl, paymentConfig, compiled resource, extensions, and compile(). The keyed payment config is important: a bare route config can accidentally payment-gate every route in an Express application.

HTTP metadata inputs

Descriptions are not decorative. They are the source text used by catalog search, so keep them specific and truthful. The facilitator never uses a model to invent missing parameters, prices, or capabilities.

Reuse Zod schemas

The adapter is optional, so the core package stays lightweight:

Declare an MCP tool

Reuse the MCP tool’s existing inputSchema. MCP identity is the tuple (resource.url, input.toolName), not just the URL:

Stellar assets

Use the verified asset registry rather than copying contract strings into every route:
The amount is an atomic-unit string. A seller that accepts an issued asset must ensure the recipient account has the required trustline and issuer approval. The SDK validates aliases, paths, amounts, public URLs, duplicate routes, and required payment defaults at startup.

Low-level helper

Use bazaar.http() or bazaar.mcp() when you need to assemble a custom PaymentRequired response. Both helpers delegate to the upstream @x402/extensions/bazaar builder. The output remains the official wire shape.

What the SDK does not do

  • It does not run a facilitator.
  • It does not store or access buyer or seller secret keys.
  • It does not decide whether a payment is valid.
  • It does not create trustlines.
  • It does not add proprietary x402 fields.
See HTTP seller, MCP seller, and Bazaar concepts for the runtime integration.
Last modified on August 10, 2026