> ## Documentation Index
> Fetch the complete documentation index at: https://docs.shopsniffer.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# x402 payment protocol

Pay per request with USDC on Base — no account required. The x402 protocol for machine-to-machine API payments.

## Overview

ShopSniffer supports the [x402 payment protocol](https://www.x402.org) for pay-per-request API access. Send a request without any auth headers, and the server responds with `402 Payment Required` and on-chain payment details. Pay the quoted amount in USDC on Base, attach the payment proof to a retry, and your job is created. No account, no API key, no browser session — ideal for autonomous AI agents and one-shot integrations.

## At a glance

| | |
| --- | --- |
| **Protocol** | [x402](https://www.x402.org) (HTTP 402 revival) |
| **Network** |  |
| **Token** | USDC () |
| **Recipient** |  |
| **Price** | $9.99 per `POST /api/jobs` call |
| **Auth required** | None |

## How the flow works

**Send request without auth**

Send a normal `POST /api/jobs` request. Do **not** include `X-API-Key` or `Authorization` headers — if you do, the server will use that auth method instead and skip x402 entirely.
  **Receive 402 Payment Required**

The server responds with HTTP 402 and an `x402` object in the body describing what to pay, where, and in which token:

    ```json
    {
      "error": "Payment Required",
      "x402": {
        "version": "1",
        "accepts": [{
          "scheme": "exact",
          "network": "base",
          "maxAmountRequired": "9990000",
          "resource": "https://shopsniffer.com/api/jobs",
          "payTo": "0x767131d92c41D56546eC72fecD0F1d63900fa9D9",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
        }]
      }
    }
    ```

    `asset` is the USDC contract address on Base. `maxAmountRequired` is in the token's smallest unit (USDC has 6 decimals, so `9990000` = $9.99).
  **Make the USDC payment**

Use a wallet with USDC on Base. Transfer $9.99 to the `payTo` address. The x402 spec defines a signed message format you'll construct from the payment details — the `x402/client` library handles this for you.
  **Retry with the payment proof**

Set the `X-PAYMENT` header with the signed payment proof and repeat the original request. The server verifies the payment on-chain and, if valid, accepts the job.
  **Job created**

You receive a normal `201` response with the job object. From here it's identical to any other authenticated job — poll status, subscribe to the WebSocket, fetch the report.

## Payment details

All payments settle on . You don't need to hold any specific token as long as you can get USDC onto Base — bridge from Ethereum, Arbitrum, Optimism, or any other L2 if needed.

**Token contract:** 

**Recipient:** 

**Amount:**  per job

## Code example

Using the official [`x402/client`](https://www.x402.org) helper, the whole flow collapses to a single function call:

```typescript
import { withX402Payment } from "x402/client";

const response = await withX402Payment(
  "https://shopsniffer.com/api/jobs",
  {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      domain: "allbirds.com",
      webhook_url: "https://your-server.com/callback"
    }),
  },
  wallet, // EVM wallet with USDC on Base
);

const { job } = await response.json();
console.log(`Job ${job.id} created`);
```

The helper handles the 402 response, builds the signed payment, sends it on-chain, and retries with `X-PAYMENT`. Your code doesn't need to see any of the wire protocol.

For a full end-to-end walkthrough including wallet setup and debugging failed settlements, see the [x402 tutorial](/guides/pay-with-x402).

## Only `POST /api/jobs` accepts x402

x402 is wired on the job creation endpoint only — read endpoints are free and don't need payment. Specifically:

- ✅ `POST /api/jobs` — accepts x402
- ❌ `POST /api/shops`, `POST /api/api-keys`, `PATCH /store-detail/:slug/frequency` — require a Better Auth session; no x402 path

If you need persistent identity (tracked shops, saved API keys), use an API key or sign up with Better Auth instead.

## Next steps

**[x402 tutorial](/guides/pay-with-x402)**

End-to-end walkthrough: wallet funding, first 402, paying, debugging.
  **[Authentication](/authentication)**

Compare x402 with API keys and Better Auth sessions.
  **[Jobs API](/api/jobs)**

Full `POST /api/jobs` reference including the 402 response shape.
  **[Buying a report](/buying-a-report)**

Stripe and AnySpend alternatives for one-off purchases.