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:1
Explicit Options
Values passed directly to the
ZendFiClient constructor take highest priority.2
Environment Variables
ZENDFI_API_KEY, NEXT_PUBLIC_ZENDFI_API_KEY, and REACT_APP_ZENDFI_API_KEY are checked automatically.3
CLI Credentials
If you ran
zendfi init, your key is stored in ~/.zendfi/credentials.json and loaded automatically.Auto-Detection
The SDK detects your environment and mode from context:Singleton vs Custom Instance
The SDK exports both a singleton and a constructor:ZENDFI_API_KEY is not set:
Package Exports
The SDK exports everything you need from a single entry point:What’s Next
Client Reference
Full method reference for ZendFiClient.
Sub Accounts
Sub-account lifecycle, delegation tokens, programmable controls, and scoped transfer methods.
Types
All type definitions and branded IDs.
Errors
Error classes and handling patterns.
Embedded Checkout
Drop-in payment UI component.