Ax402Docs
SDKS

Go

Core automation + buyer for CI/CD

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

The Go import path follows the GitHub repo (AxLabs/ax402-sdks), not the npm scope (@ax402).

Install

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

Buyer

Pay gateway URLs with EVM exact and batch-settlement. See Buyer clients.

import "github.com/AxLabs/ax402-sdks/go/buyer"

c, err := buyer.NewFromPrivateKey(os.Getenv("AX402_EVM_PRIVATE_KEY"))
resp, err := c.Get(ctx, "https://my-api.ax402.io/v1/foo")
defer resp.Body.Close()
settle, _ := c.SettleResponseFrom(resp)

Batch endpoints: pass buyer.BatchOptions{DepositMultiplier: 5} to buyer.New / NewFromPrivateKey.

Also: PayURL(ctx, method, url, body), Do(ctx, req), HTTPClient().

Protocol: github.com/x402-foundation/x402/go.

Control plane

import ax402 "github.com/AxLabs/ax402-sdks/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{...})

Flat methods: auth, keys, APIs, endpoints, domains, OpenAPI import, stats, settlements, billing, income, exchange rates, and config. Includes CheckSlugAvailability and ProbeUpstream.

JWT-only routes (MFA, passkeys) are TypeScript-only today.

Package helpers

  • ax402.GatewayURL — build gateway URLs
    • ax402.BuildUsdcAccept — USDC accept options
    • ax402.ScopePresets — API key scope presets
    • ax402.SetupAPIWithDefaultDomain, ax402.WrapOpenAPI

On this page