Skip to content

Integrations

s402 is a wire format — three HTTP headers with base64 JSON payloads. Anything that can send HTTP can speak it. This page maps the official adapters and framework integrations maintained by Swee Group.

Language SDKs

LanguagePackageStatusWhat it ships
TypeScript / JavaScripts402✅ ProductionFull protocol: types, headers, schemes, errors, compat layer. Zero runtime deps.
Pythons402✅ ProductionFull protocol parity with TS. decode_payment_required, encode_payment_payload.
Gos402-go🟡 BetaServer-side decode + net/http middleware. Client signing planned.
Rusts402-rs📋 PlannedTracked for v0.4. Target: axum + reqwest integration.

All official SDKs ship the same wire format and pass the same 161-vector conformance suite.

bash
# TypeScript
npm install s402
pnpm add s402

# Python
uv pip install s402
pip install s402

# Go
go get github.com/s402-protocol/s402-go

Chain Adapters

s402 is chain-agnostic. The protocol layer contains no chain-specific logic (see S7 invariant). Chain integration lives in separate packages that provide PTB builders, signers, and RPC helpers.

ChainPackageStatusSchemes supported
Sui@sweefi/sui✅ ProductionAll six (Exact, Upto, Prepaid, Escrow, Stream, Unlock)
EVM (via compat)s402/compat✅ ProductionExact, Upto — reads x402 V1/V2 payloads natively
Tempo (via compat)s402/compat-mpp📋 v0.3 roadmapCharge ↔ Exact, Session ↔ Prepaid
Solana📋 CommunityOpen for contributions
Aptos📋 CommunityOpen for contributions

Sui is the most expressive chain. It's the only chain today where all six schemes land natively — Unlock requires SEAL threshold crypto + Walrus storage, Stream and Prepaid benefit from PTB atomic settlement, and Escrow leverages Sui's object ownership model. EVM chains can run Exact and Upto today via the compat layer.

Server Framework Integrations

Drop-in middleware for popular HTTP frameworks.

FrameworkPackageStatusPattern
Hono@sweefi/server✅ Productions402Gate({ ... }) middleware over c.req.raw
Next.js Route Handlers@sweefi/server✅ ProductionNative Web Fetch — use s402Gate as the handler
Bun / Deno / Cloudflare Workers@sweefi/server✅ ProductionNative Web Fetch — fetch: s402Gate(...)
Express@sweefi/server🟡 BetaUse .check() escape hatch (Node IncomingMessage adapter planned)
Fastify@sweefi/server🟡 BetaUse .check() escape hatch (plugin planned)
FastAPI (Python)s402[fastapi]🟡 BetaDependency injection pattern
Flask (Python)s402[flask]🟡 Beta@require_payment decorator
net/http (Go)s402-go🟡 BetaStandard http.Handler wrapper
Axum (Rust)📋 PlannedTracked with Rust SDK

Client Framework Integrations

For building wallet UIs, payment modals, and agent-facing clients.

FrameworkPackageStatusWhat it provides
Vue 3@sweefi/vue✅ ProductionuseSweefiPayment() composable + Pinia plugin
React@sweefi/react✅ ProductionuseSweefiPayment() hook + context provider
Vanilla JS@sweefi/ui-core✅ ProductionState machine + PaymentAdapter interface
Svelte📋 CommunityBuilt on @sweefi/ui-core — contributions welcome
Solid📋 CommunityBuilt on @sweefi/ui-core

Agent Runtime Integrations

RuntimePackageStatusPattern
MCP (Model Context Protocol)s402-mcp✅ ProductionMCP server exposing s402.pay and s402.buy tools
LangChain (TS)📋 PlannedTool wrapper, tracked for v0.4
LangGraph📋 PlannedCheckpointed agent budgets
CrewAI📋 CommunityPython s402 core is the building block

The MCP integration is the production path for AI coding assistants (Claude Code, Cursor, Windsurf) and general-purpose agents using MCP-compatible runtimes.

Compat Layers

The compat layers let existing x402 and MPP traffic flow through an s402 server unchanged.

Source protocols402 moduleStatusWhat it handles
x402 V1s402/compat✅ Productionx-payment header, base64 JSON, exact scheme
x402 V2s402/compat✅ ProductionMulti-chain extensions, new error shapes
MPP Charge (read)s402/compat-mpp🟡 v0.3Challenge parsing + fromMppChargeChallenge for blockchain methods (tempo/evm/solana/lightning/stellar)
MPP Charge (write)s402/compat-mpp📋 v0.4 roadmapEmit MPP-shaped WWW-Authenticate: Payment challenges
MPP Sessions402/compat-mpp📋 v0.4 roadmapCumulative voucher ↔ Prepaid translation
MPP Accept-Payments402/compat-mpp✅ ProductionparseMppAcceptPayment — method/intent pairs with wildcards + q-values
s402 Accept-Paymentcore s402✅ ProductionFlat scheme token negotiation (DAN-341)

See Migrating from x402 and Migrating from MPP for code.

Facilitator Implementations

Facilitators are verify+settle services. s402 servers can either run their own or use a hosted one.

FacilitatorOperatorStatusChainsEndpoint
Swee HostedSwee Group✅ ProductionSui mainnet, testnethttps://facilitator.swee.inc
Self-hosted (reference)You✅ ProductionSuiCode in @sweefi/sui
x402 compat proxySwee Hosted📋 BetaSui + EVM readBridges x402 inputs to s402 schemes

The Swee hosted facilitator is the default endpoint in the s402 SDK — drop-in for agent builders who don't want to run infra.

Conformance & Testing

Every official adapter passes the 161-vector conformance suite. The vectors are language-agnostic JSON files in spec/vectors/ — run them against any new adapter to verify compliance.

bash
# Run the TS conformance suite
cd typescript && pnpm test conformance

# Run the Python conformance suite
cd python && uv run pytest tests/conformance

Contributing a New Adapter

Want to add Solana, Aptos, Svelte, or LangChain support?

  1. Read the Wire Format Spec and Canonicalization rules.
  2. Run the conformance suite against your adapter.
  3. Open an issue on s402-protocol/core with the adapter plan.
  4. PR — we review within a week.

The bar for "official" status: pass all 161 vectors, document the public API, include at least one end-to-end example. Community adapters are listed here once they meet the bar.

Next Steps

Released under the Apache 2.0 License.