Go SDK for the x402 payment protocol — client signing, server paywall middleware, and facilitator
x402-sdk-go is an early-stage Go project in the AI payments / x402 ecosystem, focused on bsc, gin, goframe, golang. It currently has 3 GitHub stars and 0 forks, and sits alongside related tools like x402-sdk-ts, x402-contracts, pay-kit.
Go SDK for the x402 payment protocol. Implements the full HTTP 402 Payment Required flow — client signing, server paywall middleware, and facilitator settlement.
x402 is an open standard for internet-native payments using the HTTP 402 status code. This SDK provides the Go implementation for integrating x402 into your services.
The SDK has three roles:
| Role | Description | Key Files |
|---|---|---|
| Client | Signs EIP-712 payment permits, handles 402 retry | client.go, http_client.go |
| Server | Protects endpoints with paywall middleware, returns 402 | server.go, middleware/ |
| Facilitator | Verifies signatures, settles on-chain via Permit402 contract | facilitator.go, facilitator_client.go |
Client Request → Server returns 402 + PaymentRequired
↓
Client signs EIP-712 permit → Retries with PAYMENT-SIGNATURE header
↓
Server → Facilitator verifies signature + calls Permit402.permitTransferFrom()
↓
Settlement confirmed → Server returns resource
go get github.com/springmint/x402-sdk-go
import (
x402 "github.com/springmint/x402-sdk-go"
"github.com/springmint/x402-sdk-go/middleware"
)
// Gin example
router.Use(ginmw.PaywallMiddleware(middleware.PaywallConfig{
Scheme: "permit402",
Network: x402.BSCMainnet,
PayToAddress: "0xYourAddress",
Amount: "1000000000000000000", // 1 USDT (18 decimals on BSC)
Asset: "USDT",
FacilitatorURL: "https://cppay.finance/api/x402/facilitator",
}))
import x402 "github.com/springmint/x402-sdk-go"
client := x402.NewX402HTTPClient(privateKey, rpcURL)
resp, err := client.Get("https://api.example.com/protected-resource")
| Network | Identifier | Permit402 Address |
|---|---|---|
| TRON Mainnet | tron:mainnet |
— |
| TRON Nile | tron:nile |
— |
| TRON Shasta | tron:shasta |
— |
| BSC Mainnet | eip155:56 |
0x105a6f4613a1d1c17ef35d4d5f053fa2e659a958 |
├── abi/ # Contract ABI definitions (Permit402, ERC-20, EIP-712)
├── mechanisms/ # Payment scheme implementations (permit402, transfer_auth)
├── middleware/ # HTTP paywall middleware (net/http, Gin, GoFrame)
├── signers/ # EIP-712 signing and verification
├── tokens/ # Token registry (symbol → address per chain)
├── utils/ # EIP-712 hashing, provider resolution
├── setup/ # Convenience setup helpers
├── client.go # X402Client — client-side payment orchestration
├── server.go # X402Server — server-side payment validation
├── facilitator.go # FacilitatorClient interface
├── config.go # Network configs (chain IDs, contract addresses, RPCs)
├── types.go # Core data structures
└── http_client.go # HTTP client with automatic 402 retry
TypeScript SDK for the x402 payment protocol — client signing, server paywall, and facilitator integration for EVM and TRON
Permit402 smart contract for the x402 payment protocol — gasless ERC20 payment authorization on EVM and TRON
Building blocks for Agentic payments (x402, MPP, AP2) for TypeScript, Rust, Go, Python, Ruby, PHP, Lua, Kotlin and Swift.
Your AI trading terminal assistant for US stocks, commodities, forex, and crypto.
Golang SDK for A2A Protocol
Publishes localhost services to the agentic web through self-hostable, trustless relays with x402 payments.
Building blocks for Agentic payments (x402, MPP, AP2) for TypeScript, Rust, Go, Python, Ruby, PHP, Lua, Kotlin and Swift.
Go implementation of the x402 payment protocol
URL shortener