SDK Overview
The@zendfi/sdk package gives you a fully-typed TypeScript client for the ZendFi API. It handles authentication, retries, idempotency, and environment detection automatically — install it and start accepting payments in under a minute.
Installation
Quick Start
Zero-Config Design
The SDK reads configuration from multiple sources in this order:Environment Variables
ZENDFI_API_KEY, NEXT_PUBLIC_ZENDFI_API_KEY, and REACT_APP_ZENDFI_API_KEY are checked automatically.Auto-Detection
The SDK detects your environment and mode from context:| Signal | Detection |
|---|---|
zfi_test_ prefix | Test mode (Solana Devnet) |
zfi_live_ prefix | Live mode (Solana Mainnet) |
NODE_ENV=production | Production environment |
localhost hostname | Development environment |
Singleton vs Custom Instance
The SDK exports both a singleton and a constructor:ZENDFI_API_KEY is not set: