# 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:

```go
import x402client "github.com/solana-foundation/pay-kit/go/protocols/x402/client"
```

<Snippet lang="go" name="charge.client" url="https://api.example.com/quote" />

## 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.

<Callout type="info">
  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.
</Callout>

## Or just use the CLI

For most cases the [`pay`](/docs/toolchain) CLI is the simplest client — it handles the wallet, signing, and the 402 retry against any pay-kit server:

```bash
pay curl http://127.0.0.1:4567/quote
```
