Testing in Development

How to test your paid APIs locally and on testnet before going to production.

Last updated: December 23, 2025

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:

  1. Bypasses the 402 Payment Required block.
  2. Populates a mock payer address (0xSIMULATED_WALLET_ADDRESS).
  3. 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

  1. In the Action Registry, set the Expected Network to base-sepolia (or CAIP-2 eip155:84532).
  2. Use a testnet wallet with Base Sepolia ETH.
  3. The AtomicGate will 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.

typescript
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.
  • payerAddress correctly personalizes your API response.
  • Kill Switch toggled OFF in Registry correctly blocks requests.