Documentation Index
Fetch the complete documentation index at: https://yanhgming.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
@marlin/sdk is the official TypeScript and Node.js client for the Marlin API. It gives you typed access to every Marlin resource — invoices, plans, subscriptions, and customers — and includes a standalone webhook verification helper and React bindings so you can add stablecoin billing to any project without writing raw HTTP calls. The SDK runs in Node.js 18+ and in any environment that supports the fetch and crypto globals.
Resources
Each resource lives as a property on theMarlin instance and maps directly to a Marlin API surface.
| Property | Methods |
|---|---|
marlin.invoices | create, retrieve, list, void, send |
marlin.plans | create, retrieve, list, update |
marlin.subscriptions | list, retrieve, pause, resume, cancel |
marlin.customers | create, retrieve, list, update |
Standalone functions
| Function | Description |
|---|---|
verifyWebhook | Verifies the marlin-signature header and returns the parsed WebhookEvent. Throws MarlinWebhookVerificationError on failure. |
Error classes
| Class | Extends | When thrown |
|---|---|---|
MarlinError | Error | Base class for all Marlin errors. |
MarlinAPIError | MarlinError | An HTTP request to the API returned a non-2xx status. Includes .statusCode, .code, and .details. |
MarlinWebhookVerificationError | MarlinError | Webhook signature verification fails (bad signature, expired timestamp, malformed header). |
Constructor options
Pass aMarlinConfig object to new Marlin().
Your Marlin secret API key. Retrieve it from the Marlin dashboard. Never expose this key in client-side code.
Override the API base URL. Useful when pointing at a staging environment.
Request timeout in milliseconds. Requests that exceed this value are aborted and retried according to
maxRetries.Maximum number of retry attempts on
500, 502, 503, and 504 responses. Retries use exponential backoff capped at 5 seconds.Hello World
The snippet below creates an invoice and logs the hosted payment URL your customer uses to complete the transaction.Next steps
- Install and configure @marlin/sdk — package manager setup, all resource methods with examples, error handling, and pagination.
- Use Marlin in React —
MarlinProvider,MarlinCheckoutButton, and theuseMarlinCheckouthook.