AI tools · Updated
How a custom store works
A custom store, also called a headless store, uses your own design. Your server gets products and creates orders with the Switro API, and customers pay on Switro's checkout.
| You look after | Switro looks after |
|---|---|
| The design, pages and cart | Products, prices and stock |
| Hosting and customer sessions | Orders and the final total |
| Your policies and customer support | Checkout, and checking that each order is paid |
If you don't need your own design, a hosted store is quicker and needs no code. For a custom store, you need Claude Code, Node.js 22 or later, and some coding experience.
Build it on devnet
Install the Switro plugin
The plugin adds the Switro connection, and skills that help Claude run your account, build stores and add Switro to your code. In Claude Code, run these one at a time:
Claude Code: 1. Add Switro /plugin marketplace add https://www.switro.com/claude/marketplace.jsonClaude Code: 2. Install the plugin /plugin install switro@switroClaude Code: 3. Load it /reload-pluginsThen run
/mcp, choose the Switro server and sign in.Choose Devnet when you approve the connection. If your account is new, add your devnet wallet in the dashboard.
Add your products
Follow these steps to add your products and publish a devnet store. Your website will use the same products.
Get a key for your website
Claude's sign-in doesn't work on your website, which needs its own API key. Save connect.mjs in your project. Add
*.envto.gitignore, then run this yourself, in your own terminal:Terminal node connect.mjs store.env store:read orders:read orders:writeKeep the key private
Don't paste the key into Claude, and don't let Claude openstore.env. Never put the key in code that runs in a browser.Ask Claude to build the store
Ask Claude Code Build a custom Switro store in this project, using the switro-store skill. Use devnet only. Design: a simple, fast store that works on phones and with a keyboard. Pages: products, one product, cart, order details and order result. Start from the complete sample at https://www.switro.com/docs/online-store#custom and keep all of its safety checks. The key is in SWITRO_API_KEY, in store.env. Never open, print or copy that file. - Only the server can call Switro. Show only active products, and take no orders if the store is not published. - Let Switro work out the total. Send the total that the customer saw, so a higher price is refused. - Save one idempotency key for each checkout attempt. Use a new one if the cart or details change. - Save the order ID in the customer's private session. Nobody else can open their order. - Show an order as paid only when the API returns paid: true. - Ask for an address only if the order has a physical product. Show me your plan first. Add tests for these rules, then run them.Start it and place an order
Ask Claude which file starts the store, and use its name in place of
server.mjs:Terminal node --env-file=store.env server.mjsThen buy something with test USDC or SOL, from a second wallet.
Check it yourself
Don't rely only on Claude's tests. Try each of these:
| Try this | What should happen |
|---|---|
| Change a price in the browser | The order does not cost less |
| Press the checkout button twice | Only one order is created |
| Open the result page without paying | The order stays unpaid |
| Open the order in another browser | You cannot see the order or its downloads |
| Cancel the payment in your wallet | The order stays unpaid |
| Search the browser's code for your API key | It is not there |
Before you open it
- Keep sessions, orders and idempotency keys in a database.
- Use
https, and limit how often each visitor can start a checkout. - Keep the key in your host's secret settings.
- Check unpaid orders in a background job, because customers may not return to your website.
- Ask someone with security experience to review the code.
Create your mainnet store and a new mainnet key. Then follow the go-live checklist and make a small real payment.
Stay safe with AI
Check every change before you approve it
- An AI tool cannot move your money, change your wallet or send refunds.
- Never give it a password, 2FA code, API key, recovery phrase or private key. It does not need them.
- To disconnect it, open Apps and API keys in the Switro dashboard.

