Skip to main content

Installation

The SDK can be installed with either npm, pnpm, bun, or yarn package managers.
Requires Node.js 18+ or any runtime with native fetch support. Zero dependencies.

Quick Start

Configuration

Resources

Example: Affiliates CRUD

Pagination

The SDK supports both offset and cursor-based pagination, depending on the resource.

Offset Pagination

Used by affiliates, commissions, coupons, and payouts.

Cursor Pagination

Used by referrals.

Auto-Pagination

Both pagination types support iterating through all pages automatically:

Expandable Fields

Some resources support expanding related data. Pass expand fields as comma-separated strings:

Error Handling

The SDK provides typed error classes for each error type:

Error Types

All errors extend AffonsoError and include status, code, message, headers, and optional field and details.