Skip to main content
This guide puts an x402 paywall in front of an HTTP endpoint using the Tentacle Pay facilitator. The example uses Hono, but the same pattern works with any x402 server adapter (Express, Next.js, Fastify, and others).
Want your coding agent to add the paywall for you? Install the sui-x402-integration skill and it follows these steps from a plain-language request.

Full example on GitHub

The complete, runnable version of this guide — examples/x402/exact/server.ts.

Prerequisites

  • A Sui address to receive payments
  • Node.js 24+ (or any runtime with WebCrypto and fetch)
  • A server framework supported by x402 — this guide uses Hono

1. Install dependencies

2. Point at the facilitator

Create an HTTPFacilitatorClient targeting https://facilitator.tentaclepay.com. This client handles the /verify and /settle round trips on your behalf.
server.ts

3. Register the Sui scheme and protect a route

@tentaclepay/sui-x402/exact/server exports ExactSuiScheme, pre-configured for Sui’s default stablecoin. It resolves USD-style prices (for example "$0.01") to the correct token amount automatically.
server.ts
Use "sui:mainnet" instead of "sui:testnet" to charge on Sui Mainnet. Register the matching network on the x402ResourceServer too.

4. Test it

Start your server and hit the protected route without a payment:
You should see a 402 Payment Required response with the accepts list in the body. Any x402-compatible client can now pay this endpoint — see Quickstart for agents.

Route configuration reference

Each protected route declares one or more accepts entries. A client picks the first entry it supports.

Pricing in a specific token

By default, ExactSuiScheme prices routes in USDC. To charge in another token or with an exact atomic amount, pass an AssetAmount as the price instead of a USD string:
See Supported networks for coin types and decimals.

Using another framework

The only Tentacle Pay-specific wiring is the ExactSuiScheme import and the HTTPFacilitatorClient URL. The rest is standard x402 — swap @x402/hono for @x402/express, @x402/next, or another adapter and keep the same middleware contract.