Dexter
Dexter
Docs

Merchant Quickstart

Quickstart
From endpoint to paid traffic

This is the shortest credible production path: protect a route with @dexterai/x402, settle through the public facilitator, and then expand into pricing, discovery, and operations.

The core merchant flow is:

  1. Protect an endpoint with @dexterai/x402
  2. Point settlement at the Dexter facilitator
  3. Accept x402 requests from compatible clients and OpenDexter-driven flows
  4. Expand into pricing, access control, and discovery once the basic flow works

Minimal Path

1. Install the SDK

npm install @dexterai/x402

2. Protect an endpoint

The simplest server path is x402Middleware:

import express from 'express';
import { x402Middleware } from '@dexterai/x402/server';
 
const app = express();
 
app.get(
  '/api/protected',
  x402Middleware({
    payTo: 'YourSolanaAddress...',
    amount: '0.01',
    facilitatorUrl: 'https://x402.dexter.cash',
  }),
  (req, res) => {
    res.json({ data: 'protected content' });
  },
);

That gives you the shortest route to:

  • returning 402 Payment Required
  • delegating settlement to the Dexter facilitator
  • accepting payment before your handler runs

3. Verify the network and facilitator assumptions

Before hard-coding network behavior, check:

4. Test the buyer path

The client-side path can be as short as:

import { wrapFetch } from '@dexterai/x402/client';
 
const x402Fetch = wrapFetch(fetch, {
  walletPrivateKey: process.env.SOLANA_PRIVATE_KEY,
});
 
const response = await x402Fetch('https://api.example.com/api/protected');

For browser clients, use createX402Client. For React apps, use useX402Payment.

5. Expand from there

After the endpoint works, the next steps are usually:

  • dynamic pricing
  • access-pass style access models
  • discovery and listing strategy
  • seller operations and monitoring

For most merchants, the easiest first production path is:

  • @dexterai/x402
  • Dexter facilitator at https://x402.dexter.cash
  • Solana or Base as the first network target
  • OpenDexter-compatible discovery assumptions

Why This Is The Right Starting Point

The SDK already covers:

  • client fetch wrappers
  • browser and React flows
  • Express middleware
  • manual server control
  • Access Pass
  • dynamic pricing
  • token pricing

The facilitator already covers:

  • /supported
  • /verify
  • /settle
  • multi-chain settlement across Solana and EVM support surfaces

What Happens After First Success

Add discovery

One of Dexter's strongest merchant advantages is that successful paid traffic can flow into OpenDexter marketplace discovery instead of staying invisible.

Add access models

If per-request payment is too granular for your use case, move next to Access Pass style access.

Add dynamic pricing

If cost varies by prompt, token count, or payload size, move next to dynamic pricing and token pricing.

When To Use The Lower-Level Server API

Use createX402Server() instead of x402Middleware() when you need:

  • manual control over the payment flow
  • custom route handling around 402 responses
  • more precise quote validation or settlement handling
  • an integration that does not fit the one-middleware pattern

Merchant Checklist

Before you call the integration done, verify:

  1. the route returns a correct 402 before payment
  2. the route settles successfully through https://x402.dexter.cash
  3. the correct payTo wallet receives funds
  4. your chosen network appears in the supported-network story
  5. your endpoint is ready for discovery and quality evaluation