Test and Live Modes
ZendFi uses a dual-mode architecture. Your API key prefix determines which Solana network processes the transaction. The code is identical in both modes — you only change the key.How Modes Work
| Test Mode | Live Mode | |
|---|---|---|
| Key prefix | zfi_test_ | zfi_live_ |
| Network | Solana Devnet | Solana Mainnet |
| Tokens | Devnet USDC/SOL | Real USDC/USDT/SOL |
| Transactions | Free (no real value) | Real funds |
| Webhooks | Fully functional | Fully functional |
| Rate limits | Same as live | Same as test |
| API base URL | https://api.zendfi.tech | https://api.zendfi.tech |
Both modes use the same API base URL. The backend inspects your API key to route the request to the correct network. You never need to change URLs when going live.
SDK Mode Detection
The SDK automatically detects the mode from your API key:ZENDFI_API_KEY from the environment:
Response Headers
Every API response includes a mode header so you can confirm which network processed the request:Development Workflow
A typical workflow:Develop with test keys
Use
zfi_test_ keys during development. All transactions happen on Solana devnet with no real funds at risk.Test webhooks locally
Use
zendfi webhooks --port 3000 to tunnel webhooks to your local machine. Webhook payloads are identical between modes.Deploy to staging
Deploy your app with test keys to a staging environment. Verify the full flow end-to-end.
Environment Variable Patterns
- Single Key
- Dual Keys
Use a single environment variable and swap it per environment:
.env.development
.env.production
Safety Warnings
The SDK includes built-in safety checks:- Using a live key in development logs a warning: real mainnet transactions will occur.
- Using a test key in production logs a warning: only devnet transactions will be created.
Testing with Devnet Funds
To complete test payments, you need devnet tokens:- Devnet SOL: Use the Solana faucet to airdrop devnet SOL to your wallet.
- Devnet USDC: Swap devnet SOL for USDC using a devnet-compatible DEX, or use the devnet USDC faucet if available.
- Wallet setup: Configure Phantom, Solflare, or Backpack to use Solana devnet in settings.