Skip to main content
Protect an Express route with Stellar exact, advertise official Bazaar metadata, and settle through an openx402 facilitator.

Install

From your seller project:
Use Node.js 22 or newer. The repository’s complete runnable version is examples/rock-paper-scissors/index.ts.

Complete POST seller

The following is the same payment integration used by the included example; only the application handler is shortened.
From the seller project:

How the integration fits together

Do not hand-write Bazaar JSON. Use metadata.resource and metadata.extensions so the official extension shape stays aligned with the x402 SDK.

Payment and resource fields

accepts

Each entry is one payment option. This example offers one option: Stellar testnet, exact, 1,000 atomic units of native XLM SAC, paid to SELLER_PAY_TO. Amounts are decimal strings in the token’s atomic units. Do not use floating point and do not assume every Stellar token has seven decimals. Read decimals from the asset configuration or token interface. maxTimeoutSeconds limits how long the signed authorization may remain valid. The facilitator also applies an operator maximum; the seller cannot extend it indefinitely. extra.areFeesSponsored: true tells the buyer that the facilitator pays the Stellar transaction fee. It does not make the facilitator the payer. The buyer still owns and supplies the payment asset.

payTo and the four addresses

The seller receives the asset. The facilitator is never the recipient, payer, or custodian of seller funds.

resource

resource is the externally reachable identity of the paid route. It must be the URL the buyer calls, including the actual path. For hosted discovery use a public HTTPS URL. Do not advertise the local listener, a different TLS origin, or a logical name that clients cannot reach. The hosted catalog rejects loopback/private hosts and plain-HTTP public origins. SELLER_PUBLIC_URL=https://your-tunnel.example and resource=https://your-tunnel.example/play keep the challenge, buyer request, and catalog identity consistent.

extensions

Pass metadata.extensions unchanged. The Bazaar SDK delegates to @x402/extensions/bazaar; it does not create a proprietary extension. Invalid metadata is reported through EXTENSION-RESPONSES and soft-fails without changing a valid payment result.

GET and query endpoints

Use query for a GET endpoint. The helper compiles parameter examples and descriptions into both Bazaar info.input.queryParams and JSON Schema.
Place weather.resource fields and weather.extensions in the route’s x402 configuration exactly as in the POST example. The canonical standalone helper is packages/bazaar-sdk/examples/weather-http.ts.

Next steps

Last modified on August 3, 2026