Dodo Payments

Dodo Payments

Server-side TypeScript/JavaScript API client for secure Dodo Payments REST API access.

33
Stars
4
Forks
20
Releases

Overview

The DodoPayments TypeScript API Library is a server-side client that provides convenient access to the Dodo Payments REST API from TypeScript or JavaScript. Generated with Stainless, it ships with a typed API surface, including TypeScript definitions for all request params and response fields. Install via npm and use a simple client initializer with an optional bearer token and environment toggle (live_mode or test_mode). The library supports common payment workflows (e.g., checkout sessions) and exposes full API coverage described in the docs. Error handling is centralized through APIError subclasses mapped to HTTP status codes (BadRequestError, AuthenticationError, NotFoundError, etc.). Requests can be retried by default (2 retries) with exponential backoff, configurable globally or per request. Timeouts default to 1 minute and can be customized; APIConnectionTimeoutError is thrown on timeout, and timeouts are retried. List endpoints are paginated with for await…of support, and helper methods exist to fetch pages incrementally. Advanced usage enables access to raw Response data via asResponse() or withResponse(). Logging is configurable via logLevel and supports custom loggers, and custom fetch implementations and fetchOptions are supported (including proxies for Node, Bun, and Deno).

Details

Owner
dodopayments
Language
TypeScript
License
Apache License 2.0
Updated
2025-12-07

Features

Typed API surface

TypeScript definitions for all request params and response fields, enabling strong typing and editor hover docs.

Robust error handling

Custom APIError subclasses mapped to HTTP status codes (BadRequestError, AuthenticationError, NotFoundError, etc.).

Automatic retries

Automatic retries for select errors (default 2) with exponential backoff; configurable maxRetries globally or per request.

Request timeouts

Default 1 minute timeout with configurable timeout option; On timeout, APIConnectionTimeoutError is thrown; timeouts are retried by default.

Auto-pagination

Paginated list endpoints; iterate with for await…of across pages; or fetch single pages; hasNextPage/getNextPage helpers.

Raw response access

Access raw Response data via asResponse() or withResponse(); separate raw data from parsed data.

Logging support

Configurable logLevel via environment variable or client option; supports custom logger; debug mode logs HTTP traffic with header redactions.

Custom fetch and proxies

Default fetch is global; you can provide your own fetch or fetchOptions to support proxies (Node with ProxyAgent, Bun, Deno); examples included.

Audience

DevelopersBuild server-side applications that securely access Dodo Payments REST API using the provided TypeScript/JavaScript client.
Backend teamsLeverage the TS/JS client to implement payment workflows, error handling, retries, and pagination against the Dodo Payments API.

Tags

Dodo PaymentsTypeScriptJavaScriptAPI LibraryREST APIPaymentsCheckout SessionsSDKServer-sidePaginationError HandlingRetriesTimeoutsLoggingFetchProxiesUndocumented Endpoints