pay.sh docs
SDKGo

Client

Pay 402-gated APIs from Go — protocol client transports that settle a 402 in one retry, wrapping a standard *http.Client.

The paykit umbrella is server-side, but Go also ships the paying side as protocol client transports. Each wraps an http.RoundTripper, so any *http.Client call settles a 402 transparently in one retry.

x402

x402client.NewClient returns an *http.Client that settles x402 exact against your signer:

import x402client "github.com/solana-foundation/pay-kit/go/protocols/x402/client"
// The returned *http.Client settles a 402 transparently on any call.httpClient := x402client.NewClient(signer, rpc)resp, err := httpClient.Get("https://api.example.com/quote")if err != nil {	panic(err)}defer resp.Body.Close()body, _ := io.ReadAll(resp.Body)fmt.Println(string(body))

MPP

The sibling protocols/mpp/client does the same for MPP, sending an Authorization: Payment credential. Both transports are drop-in: construct the client once and use ordinary Get / Do calls.

The generic x402client.NewClient transport settles the exact scheme. The usage-based upto flow is driven client-side through the protocol helper used by the conformance harness rather than this transport.

Or just use the CLI

For most cases the pay CLI is the simplest client — it handles the wallet, signing, and the 402 retry against any pay-kit server:

pay curl http://127.0.0.1:4567/quote

On this page