Generate your implementation prompt

Select your stack so the prompt, install command, and optional code template match your setup.

Stack

Install command

npm install @x402/express @x402/core @x402/evm @x402/extensions

Pass this prompt to your agent. It includes every bit of context the model needs to update your code: the protocol spec, a link to the full Bazaar docs, your endpoint's current 402 response, and exactly what the corrected response should look like.

I'm trying to get my x402 endpoint indexed in the CDP Bazaar discovery, but the Seller Tools Validator (https://agentic.market/validate) shows it has issues that need fixing. Help me update my code.

## What x402 + the Bazaar are
x402 v2 is an HTTP payment protocol where paid endpoints respond with `HTTP 402 Payment Required` plus a base64-encoded `payment-required` **header** carrying a JSON envelope: `{ x402Version: 2, accepts: [...], resource: {...}, extensions: {...} }`. (On v1 the same envelope was carried in the response **body** instead.) The CDP Bazaar is a discovery index that catalogs endpoints whose 402 responses include a properly-shaped `extensions.bazaar` object. An endpoint only gets cataloged after the CDP facilitator processes its first verify+settle. When the Bazaar probes a candidate resource it now uses the example request declared under `extensions.bazaar.info.input` (falling back to an empty request if none is provided), so servers can enforce request validation before payment validation without failing the probe — make sure your `info.input` example is representative.

Full spec: https://agentic.market/validate — please reference the **"Quickstart for Sellers"** section, which shows the exact `bazaarResourceServerExtension` registration + `declareDiscoveryExtension()` helper usage for Node.js / Go / Python.

## My endpoint
URL: GET https://api.example.com/
Stack: Node.js (Express, Fastify, etc.)

## What the corrected 402 response should look like
After your fix, the decoded `payment-required` envelope should match this shape (with my actual values, shown below):
```json
{
  "x402Version": 2,
  "error": "Payment required",
  "resource": {
    "url": "https://api.example.com/",
    "mimeType": "application/json"
  },
  "accepts": [
    {
      "scheme": "exact",
      "network": "eip155:8453",
      "amount": "1000",
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "payTo": "<your merchant wallet address>",
      "maxTimeoutSeconds": 300
    }
  ],
  "extensions": {
    "bazaar": {
      "info": {
        "input": {
          "type": "http",
          "method": "GET",
          "queryParams": {}
        },
        "output": {
          "type": "json",
          "example": "<example response>"
        }
      },
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object"
      }
    }
  }
}
```

## Please update my code to:
1. Make sure I'm using the **CDP facilitator** at `https://api.cdp.coinbase.com/platform/v2/x402/facilitator` (not `x402.org`) — only CDP-settled endpoints get cataloged in the CDP Bazaar.
2. Install/import `@x402/extensions/bazaar` (or the equivalent for my stack) and **register `bazaarResourceServerExtension`** on the resource server.
3. Use the **`declareDiscoveryExtension()`** helper in my route config so my route's `extensions.bazaar` block matches the corrected shape above. The helper auto-generates `info.input.{type, method}` and the JSON Schema, so I should pass it `output: { example, schema }` (and optionally `input: {...}`).
4. Make sure `accepts[0]` declares a supported `network` (Base, Base Sepolia, Polygon, Arbitrum, World, World Sepolia, Solana, or Solana Devnet), an `asset` set to the contract address (or Solana mint) of whatever token you want to be paid in (USDC is the most common choice but is not required), an `amount` ≥ 1000 atomic units ($0.001), and a `payTo` address.

If you need to see specific files (middleware, route handler, package.json, etc.), ask me to share them.
3 of 5
Agentic Market