Ax402Docs
SDKS

Go

Core automation + exact buyer

Go client for the Ax402 control plane and buyer helpers. Module: github.com/AxLabs/ax402-sdk/go (source in packages/golang/).

Install

go get github.com/AxLabs/ax402-sdk/go

Buyer

Pay gateway URLs with EVM exact scheme. See Buyer clients .

import "github.com/AxLabs/ax402-sdk/go/buyer"
c, err := buyer.NewFromPrivateKey(os.Getenv("AX402_EVM_PRIVATE_KEY"))
resp, err := c.Get(ctx, "https://echo.staging.ax402.io/echo/get?test=1")
defer resp.Body.Close()
settle, _ := c.SettleResponseFrom(resp)
  • PayURL(ctx, method, url, body) — non-GET methods
    • Do(ctx, req) — custom requests
    • HTTPClient() — underlying payment-wrapped client Batch-settlement is not registered in Go buyer — use TypeScript buyer or React paywall . Protocol: github.com/x402-foundation/x402/go.

Control plane

import ax402 "github.com/AxLabs/ax402-sdk/go"
client := ax402.NewClient(baseURL, ax402.Credentials{
    APIKey: os.Getenv("AX402_API_KEY"),
})
apis, err := client.ListAPIs(ctx)
api, err := client.CreateAPI(ctx, ax402.CreateAPIInput{...})
eps, err := client.ListEndpoints(ctx, apiID)

Flat methods: auth, keys, APIs, endpoints, domains, OpenAPI import, stats, settlements, platform config. Core seller automation — JWT-only routes (MFA, billing, income) are TypeScript-only today.

Package helpers

  • ax402.GatewayURL — build gateway URLs
    • ax402.BuildUsdcAccept — USDC accept options
    • ax402.ScopePresets — API key scope presets setupApiWithDefaultDomain and wrapOpenAPI are TypeScript-only — use OpenAPI import via REST or CLI from Go CI.

Tests

cd packages/golang && go test ./...

On this page