> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# Go live with your paywall

> Switch the paywall to mainnet, move to the x402 SDK and a facilitator, and protect unpaid routes. Then pick where to go next.

<div className="sol-stepper not-prose" data-path="paywall-api">
<div className="sol-stepper-nav" role="navigation" aria-label="Paywall an endpoint · ~30 min">
<ol>
<li data-state="done"><a href="/developers/docs/payments/paywall-api/try-it"><span className="sol-stepper-n">Step 1<span className="sol-vh">, </span><span className="sol-stepper-done">Done</span><span className="sol-vh">: </span></span><span className="sol-stepper-t">Call a paid API</span></a></li>
<li data-state="done"><a href="/developers/docs/payments/paywall-api/browser"><span className="sol-stepper-n">Step 2<span className="sol-vh">, </span><span className="sol-stepper-done">Done</span><span className="sol-vh">: </span></span><span className="sol-stepper-t">Read the code</span></a></li>
<li data-state="done"><a href="/developers/docs/payments/paywall-api/server"><span className="sol-stepper-n">Step 3<span className="sol-vh">, </span><span className="sol-stepper-done">Done</span><span className="sol-vh">: </span></span><span className="sol-stepper-t">Add it to your server</span></a></li>
<li data-state="current"><a href="/developers/docs/payments/paywall-api/go-live" aria-current="step"><span className="sol-stepper-n">Step 4<span className="sol-vh">: </span></span><span className="sol-stepper-t">Go live</span></a></li>
</ol>
</div>
</div>

## Before you charge real money

1. **Move to the x402 SDK.** This tutorial uses x402 version 1 message shapes
   so you can read every check. New integrations should use version 2: the `@x402/express` (or `@x402/next`, `@x402/hono`) middleware on
   the server, `@x402/fetch` on the client, and `@x402/svm` for Solana. Version 2
   sends the price in a `PAYMENT-REQUIRED` header, and uses `PAYMENT-SIGNATURE`
   and `PAYMENT-RESPONSE` in place of `X-PAYMENT` and `X-PAYMENT-RESPONSE`.
   [x402 on Solana](/developers/docs/payments/agentic-payments/x402)
   has a server and a client built with these packages.
2. **Choose a facilitator.** With the SDK, a facilitator verifies and settles
   payments for your server, and on Solana it can pay the network fee for the
   client. Use a hosted facilitator, run your own, or settle inside your server
   as this tutorial does. See [x402 facilitators](/developers/docs/tools/x402-facilitator).
3. **Switch to mainnet values.** Set the environment variables from the table
   below. Use an RPC provider: public endpoints are rate-limited.
4. **Create your USDC token account first.** The client's transfer doesn't
   create the `payTo` wallet's USDC account, so create it before you publish
   the price, or every payment fails.
5. **Store accepted payment signatures.** The example keeps them in memory. Put
   them in your database so every server instance, and the server after a
   restart, refuses a payment that was already used.
6. **Log the signature with each paid request.** It is your receipt: anyone
   can look the transaction up on the network.
7. **Rate-limit unpaid requests.** A `402` is cheap to send, but each one still
   costs you a request.
8. **Limit what clients can spend.** Give every client and agent a
   `maxAmount`, and a wallet that holds only what it may spend.

<div className="sol-concept not-prose">
[<span className="sol-concept-name">Fee sponsorship</span> <span className="sol-concept-def">By default, the transaction's fee payer needs a little SOL to pay its fee.</span>](/developers/docs/core/fees/fee-sponsorship)
</div>

<div className="sol-concept not-prose">
[<span className="sol-concept-name">Rent (storage deposit)</span> <span className="sol-concept-def">Every account holds a small refundable deposit for the space it takes up.</span>](/developers/docs/core/rent)
</div>

## Devnet and mainnet values

| Variable                | Devnet (testing)                               | Mainnet (real money)                           |
| ----------------------- | ---------------------------------------------- | ---------------------------------------------- |
| `RPC_URL`               | `https://api.devnet.solana.com`                | Your RPC provider's HTTPS URL                  |
| `RPC_SUBSCRIPTIONS_URL` | `wss://api.devnet.solana.com`                  | Your RPC provider's WebSocket URL              |
| `USDC_MINT`             | `4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU` | `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` |
| `X402_NETWORK`          | `solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1`      | `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp`      |
| Money                   | Free test tokens                               | Real USDC                                      |

## You paywalled an API

You paid for an API as a client, read the server that takes the payment, and
ran both on your machine. From here:

<Columns cols={2}>
<Card title="Accept dollar payments" icon="shopping-cart" href="/developers/docs/payments/checkout">
Next tutorial: add a checkout for people next to your API.
</Card>
<Card title="Let an agent pay" icon="bot" href="/developers/docs/payments/pay-sh#let-an-agent-pay-x402">
Launch an AI agent with Pay and let it pay for an x402 API, approving each payment first.
</Card>
<Card title="Machine payments (MPP)" icon="zap" href="/developers/docs/payments/agentic-payments/mpp">
Session-based payments between machines.
</Card>
<Card title="Kora" icon="fuel" href="/developers/docs/tools/kora" arrow>
Run your own fee payer, so clients only hold USDC.
</Card>
</Columns>
