Sandbox
Complete guide to testing in the TransX402 sandbox environment — fund wallets, make test payments, and validate your integration.
What is the Sandbox?
The sandbox is a testing environment that lets you test your TransX402 integration without using real money. By default it targets CAMP Testnet — a public testnet chain (https://testnet-rpc.onchainfolio.com/rpc) with test IDRX and Permit2. The facilitator sponsors settle gas; merchants fund wallets with test IDRX and ETH via the treasury faucet (/sandbox/fund).
Optional: run a local Anvil Base fork with SANDBOX_FUNDING_MODE=anvil and docker compose --profile anvil up (developer tooling only — not the default).
Sandbox vs Production
| Aspect | Sandbox (CAMP Testnet) | Production |
|---|---|---|
| API key prefix | ipk_sandbox_ | ipk_live_ |
| Chain | CAMP Testnet | Base mainnet |
| IDRX | Test IDRX on CAMP | Real IDRX |
| Gas (settle) | Sponsored by facilitator | Sponsored by facilitator |
| Funding | Treasury faucet | Real deposits |
| Dashboard | Shows sandbox transactions | Shows real transactions |
| Webhooks | Fires to merchant's webhook URL | Same |
| Facilitator (hosted) | api.transx402.com | api.transx402.com |
Getting Started
1. Get a Sandbox API Key
When you register at dashboard.transx402.com, a sandbox API key is automatically created. You can also create additional sandbox keys on the API Keys page:
2. Fund a Test Wallet
Before making test payments, fund a wallet with test IDRX (and optionally ETH for gas on browser Path 4). There are two ways:
Via API
IDRX:
ETH (optional token — omit for IDRX):
Response:
Via Dashboard
Go to the Sandbox page in the dashboard. Use the Fund IDRX and Fund ETH cards (amounts go to your registered merchant wallet), then click the fund button on each card.
On CAMP Testnet (treasury funding), the faucet can transfer both test IDRX and native ETH. The first browser payment may prompt a MetaMask Spending Cap (approve Permit2); later payments are signature-only.
3. Use Built-in Test Wallets
The sandbox provides pre-funded test wallets. Get the wallet list:
Response:
These are Anvil's deterministic accounts with 10,000 ETH and plenty of test IDRX. The private keys are safe to use in sandbox since they only work on the Anvil chain.
Testing Payments
Basic Testing Flow
- Install integration — Use a sandbox API key in the JS library or WordPress plugin
- Fund wallet — Fill a test wallet with IDRX (and ETH if needed) via
/sandbox/fundor the Dashboard Sandbox page - Access content — Open a paywalled page
- Pay — Click "Pay with IDRX", connect wallet, and sign
- Verify — Check the payment in the dashboard or via the
/paymentsAPI
Testing with the JS Library
environment | Facilitator | Notes |
|---|---|---|
local | http://localhost:3402 | Docker / local API |
camp | https://api.transx402.com | Hosted CAMP testnet sandbox |
base | https://api.transx402.com | Requires ipk_live_... |
camp and base use the same hosted facilitator; your API key selects sandbox vs production chain config from GET /config.
Browser wallets use Path 4: one-time on-chain Permit2 approve (user pays gas), then signature-only payments. Agents use Path 3 (createAgentClient) with sponsored approve via signTransaction.
CDN / WordPress can still use TransX402.create({ apiKey, environment }) from the browser bundle.
Testing with cURL
Resetting the Sandbox
If you need to start fresh (e.g., after intensive testing), you can reset the sandbox state:
This will re-fork the Anvil chain from the latest Base mainnet block. All previous sandbox transactions will be lost, but the IDRX and Permit2 contracts remain available.
Differences from Production
Your integration code is exactly the same for sandbox and production. The only difference:
Pick environment or facilitatorUrl (never both). Chain params come only from GET /config.
Local Development with Anvil (optional)
Anvil is not the default sandbox. Use it only when you want an offline Base fork:
Anvil listens on port 8546 locally. /sandbox/wallets and /sandbox/reset work only in Anvil mode.
Why Anvil Fork (optional)?
| Anvil Fork | CAMP Testnet (default) | |
|---|---|---|
| Real IDRX contract | Yes (forked Base state) | Deployed test IDRX |
| Real Permit2 contract | Yes | Prefer canonical 0x0000…BA3 |
| Shared with team | No (local) | Yes |
| Funding | anvil_deal + auto Permit2 approve | Treasury ERC-20 transfer |
| CI / offline | Good after fork | Needs RPC reachability |
Testing Tips
- Always test in sandbox first before switching to production
- Use webhooks to verify payment notifications are sent correctly
- Test error scenarios — try paying with insufficient balance, expired deadline, etc.
- Check the dashboard — make sure payments appear on the Payments page
- Test across wallets — MetaMask, Coinbase Wallet, etc.