Client Reference
TheZendFiClient class is the core of the SDK. It provides methods for every ZendFi API operation with built-in retries, idempotency, and typed responses.
Constructor
Configuration Options
string
Your ZendFi API key. Falls back to
ZENDFI_API_KEY env var.string
default:"https://api.zendfi.tech"
API base URL. Override for self-hosted or proxy setups.
string
default:"auto-detected"
development, staging, or production. Auto-detected from NODE_ENV.string
default:"auto-detected"
test or live. Auto-detected from API key prefix.number
default:"30000"
Request timeout in milliseconds.
number
default:"3"
Number of retry attempts for failed requests (5xx and network errors).
boolean
default:"true"
Automatically generate idempotency keys for POST requests.
boolean
default:"false"
Log all requests and responses to the console.
Payments
createPayment
Creates a new payment and returns a checkout URL.Payment
Payment object with
id, status, payment_url, checkout_url, qr_code, expires_at, and more.getPayment
Retrieves a payment by ID.Payment Links
createPaymentLink
Creates a shareable checkout URL.With payment splits (wallet recipients)
Automatically distribute payments across multiple wallets:With payment splits (bank account recipients)
Enable NGN bank deposits via PAJ bank account integration:recipient_bank_id plus aliases recipient_bank, bank_identifier, and bank_code.
For wallet recipients, you can target a sub-account directly with sub_account_id (or alias recipient_sub_account) instead of recipient_wallet.
With a pre-filled customer object
When you supply acustomer object the checkout page skips the email / info
collection step entirely and shows a single “Continue to Pay” button instead.
The customer data is passed directly into the payment flow (including the onramp
initiation). The link is automatically locked to max_uses = 1.
listPaymentLinks
Sub Accounts
Sub-account methods are documented in detail on SDK Sub Accounts.createSubAccount
listSubAccounts
getSubAccount / getSubAccountBalance
mintSubAccountDelegationToken
freezeSubAccount / closeSubAccount
drainSubAccount / withdrawFromSubAccount
Subscriptions
createSubscriptionPlan
Defines a recurring billing plan.getSubscriptionPlan
createSubscription
Subscribes a customer to a plan.getSubscription
cancelSubscription
Installment Plans
createInstallmentPlan
Splits a purchase into scheduled payments.getInstallmentPlan
listInstallmentPlans
listCustomerInstallmentPlans
cancelInstallmentPlan
Invoices
createInvoice
Creates a professional invoice.With onramp enabled
Whenonramp: true, the payment link generated by sendInvoice() will use the
PAJ onramp flow (NGN bank transfer → USDC settlement) instead of a direct
crypto payment.
getInvoice
listInvoices
sendInvoice
Sends the invoice to the customer via email.Webhooks
verifyWebhook
Verifies the HMAC-SHA256 signature of an incoming webhook.Always pass the raw request body as the payload, not the parsed JSON. Parsing and re-serializing can alter whitespace and break the signature.
Retry and Idempotency
The client automatically retries failed requests:- 5xx errors: Retried up to
retriestimes with exponential backoff ( seconds) - Network errors: Retried with the same backoff logic
- 4xx errors: Never retried (these indicate client-side issues)
idempotencyEnabled is true (the default). This prevents duplicate charges from retried requests.