Skip to main content
The exact scheme is a fixed-price payment scheme. The seller advertises one amount, the buyer signs for that exact amount, and the facilitator settles that payment for the request. Use exact when the final charge is known before the response is generated, such as a fixed-price API call, file download, or gated page.

Server Setup

import { HTTPFacilitatorClient } from "@x402/core/server";
import { paymentMiddleware, x402ResourceServer } from "@x402/express";
import { ExactEvmScheme } from "@x402/evm/exact/server";
import { ExactSvmScheme } from "@x402/svm/exact/server";

const facilitatorClient = new HTTPFacilitatorClient({
  url: "https://x402.org/facilitator",
});

const resourceServer = new x402ResourceServer(facilitatorClient)
  .register("eip155:84532", new ExactEvmScheme())
  .register("solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1", new ExactSvmScheme());

app.use(
  paymentMiddleware(
    {
      "GET /weather": {
        accepts: [
          {
            scheme: "exact",
            price: "$0.001",
            network: "eip155:84532",
            payTo: "0xYourAddress",
          },
          {
            scheme: "exact",
            price: "$0.001",
            network: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
            payTo: "YourSolanaAddress",
          },
        ],
        description: "Weather data",
        mimeType: "application/json",
      },
    },
    resourceServer,
  ),
);

Client Setup

import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { ExactSvmScheme } from "@x402/svm/exact/client";
import { createKeyPairSignerFromBytes } from "@solana/kit";
import { base58 } from "@scure/base";
import { privateKeyToAccount } from "viem/accounts";

const evmSigner = privateKeyToAccount(process.env.EVM_PRIVATE_KEY as `0x${string}`);
const svmSigner = await createKeyPairSignerFromBytes(
  base58.decode(process.env.SVM_PRIVATE_KEY!),
);

const client = new x402Client();
client.register("eip155:*", new ExactEvmScheme(evmSigner));
client.register("solana:*", new ExactSvmScheme(svmSigner));

Network Implementations

The exact scheme has network specifications for EVM, SVM, AVM, Stellar, Aptos, Hedera, TON, Cardano, Keeta, and Sui.

SVM Smart Wallet Support

By default, the SVM facilitator only accepts transactions from standard (EOA) wallets using static instruction-layout validation. To also accept payments from Solana smart wallets (Squads, Swig, SPL Governance, etc.), enable simulation-based verification when constructing ExactSvmScheme on your facilitator:
import { ExactSvmScheme } from "@x402/svm/exact/facilitator";
import { toFacilitatorSvmSigner } from "@x402/svm";

const svmSigner = toFacilitatorSvmSigner(svmAccount);

facilitator.register(
  "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",
  new ExactSvmScheme(svmSigner, undefined, {
    enableSmartWalletVerification: true,
  }),
);
When enableSmartWalletVerification is enabled, transactions that fail static validation (because they contain smart wallet program instructions) are re-verified by simulating the transaction and inspecting CPI inner instructions for a valid TransferChecked. Only programs in the built-in allowlist (Squads Multisig v4, Squads Smart Account, Swig, SPL Governance, Metaplex Core, Lighthouse) can reach this path.
toFacilitatorSvmSigner() is required when enabling smart wallet verification — it provides the simulateTransactionWithInnerInstructions, getConfirmedTransactionInnerInstructions, getTokenAccountBalance, and fetchAddressLookupTables methods needed for simulation-based verification.
Additional options:
OptionTypeDefaultDescription
enableSmartWalletVerificationbooleanfalseEnable simulation-based verification for smart wallet transactions.
smartWalletMaxComputeUnitsnumber400000Maximum compute units allowed for smart wallet transactions.
smartWalletMaxPriorityFeeMicroLamportsnumber50000Maximum priority fee in microlamports for smart wallet transactions.
smartWalletAllowedProgramsstring[]Built-in listAllowed smart wallet program addresses. Only transactions invoking a program in this list reach simulation-based verification.

EVM Transfer Methods

The EVM implementation supports two transfer methods:
MethodDescription
eip3009Uses token-native transferWithAuthorization, commonly for USDC. This is the default when supported.
permit2Uses Uniswap Permit2 plus the x402 exact proxy, so it can support ERC-20 tokens without EIP-3009.
Permit2 may require a one-time approval. The gas sponsoring extensions can let the facilitator handle that approval path for compatible tokens.

Examples

Specs

See Also