Testing in Development
How to test your paid APIs locally and on testnet before going to production.
Atomic Rail provides several ways to test your integration, ranging from zero-cost simulations to real testnet payments.
1. Zero-Cost: Simulation Mode
The fastest way to test is using the Interactive Playground in your dashboard.
How it works
The Playground sends a special X-Atomic-Simulation: true header to your API. The AtomicGate recognizes this header and:
- Bypasses the 402 Payment Required block.
- Populates a mock payer address (
0xSIMULATED_WALLET_ADDRESS). - Emits a "Simulated" event to your dashboard.
Why use it?
It allows you to test your Middleware logic, HMAC Signing, and Ingestion pipeline without needing a wallet extension or testnet funds.
2. Low-Cost: Base Sepolia Testnet
For testing the actual user payment experience (MetaMask, wallet signing), use the Base Sepolia testnet.
Setup
- In the Action Registry, set the Expected Network to
base-sepolia(or CAIP-2eip155:84532). - Use a testnet wallet with Base Sepolia ETH.
- The
AtomicGatewill automatically communicate with the x402 resource server to verify the testnet signature.
Why use it?
It verifies that your client-side implementation (viem, wagmi, or @x402/fetch) is correctly signing Typed Data and that your user has enough funds for the micro-payment.
3. Local Debugging
Enable debug: true in your AtomicGate initialization to see verbose logs in your terminal.
const gate = new AtomicGate({
// ...
debug: true,
});You will see logs for:
- Registry config fetching.
- Payment header extraction.
- HMAC signature generation.
- Metering event emission.
4. Testing Checklist
- Simulation successful in Playground.
- Event appears in Activity Logs with "Sim" badge.
-
payerAddresscorrectly personalizes your API response. - Kill Switch toggled OFF in Registry correctly blocks requests.