Get started

Quickstart

From a new account to a paid test request in about ten minutes, on a free test network.

  1. Create a site. In the dashboard, add a site with your domain and the wallet address that should receive payments.
  2. Start in test mode. Under tokens, select Base Sepolia EURC (or USDC). A site with only test tokens is in test mode: settlements are free and need no credits.
  3. Set a price. Add a price rule, for example /premium/** at 0.01. Paths without a rule use the site's default price; set it to 0 to keep them free.
  4. Create an API key. On the site page, create a key and copy it together with the site ID. The key is shown once.
  5. Connect your server. Install the integration for your stack:
npm install @pennipay/x402

Then set the two values as environment variables on your server:

.env
PENNI_SITE_ID=site_...
PENNI_API_KEY=x402_sk_...

Check it

Request a priced path without paying. You get a 402 with a PAYMENT-REQUIRED header that holds the price:

Terminal
curl -si https://your-site.example/premium/report | grep -i -E '^HTTP|^payment-required'

Now pay it. On the site page in the dashboard, press Pay with test tokens to pay the path from a browser wallet (MetaMask, Phantom, Lace) exactly as an agent would. Test EURC and USDC come free from Circle's faucet. The paid request returns 200 with a PAYMENT-RESPONSE header, and the payment shows up on the Test tab of the site's analytics.

Ready for real money? Selecting mainnet tokens and topping up credits is all it takes; your code stays the same. See going live.