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 anHTTPFacilitatorClient 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: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 moreaccepts entries. A client picks the first entry it supports.
| Field | Description |
|---|---|
scheme | "exact" for a fixed price. |
price | USD-style string (for example "$0.01") or an atomic token amount as a string. |
network | CAIP-2 network ID — sui:mainnet or sui:testnet. |
payTo | Sui address that receives the payment. |
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:
Using another framework
The only Tentacle Pay-specific wiring is theExactSuiScheme 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.