> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usetendr.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript SDK

```ts theme={null}
import { TendrClient } from '@tendr/sdk';
import { verifyWebhookSignature } from '@tendr/sdk/webhook';

const client = new TendrClient({
  baseUrl: 'http://localhost:4000',
  apiKey: process.env.TENDR_SECRET_KEY, // tdr_test_… or tdr_live_…
});
```

The client currently handles authentication, `Idempotency-Key` headers, timeouts and typed errors (`TendrApiError`). Endpoint methods so far: `client.paymentLinks`, `client.themes`, `client.themeAssets` and `client.checkoutSessions.create` (below). Quotes and payments are coming in the checkout project.

## Payment links

```ts theme={null}
const link = await client.paymentLinks.create(
  { title: 'Logo deposit', amount_type: 'fixed', amount: '250.00', currency: 'USD', max_uses: 1 },
  { idempotencyKey: 'invoice-114' },
);
console.log(link.url, link.qr_url);

const page = await client.paymentLinks.list({ status: 'active', limit: 20 });
await client.paymentLinks.update(link.id, { status: 'inactive', max_uses: null }); // null clears
await client.paymentLinks.archive(link.id);
```

`create`, `list`, `retrieve`, `update` and `archive` map to the
[payment links API](https://docs.usetendr.tech/api-reference/payment-links.md) and throw `TendrApiError` with its error codes
(`LINK_NOT_SUPPORTED`, `AMOUNT_TOO_LOW`, and so on). The key needs `payment_links:read` or
`payment_links:write`.

## Checkout themes

```ts theme={null}
const theme = await client.themes.create({ name: 'Spring', from: { preset: 'fashion' } });

const logo = await client.themeAssets.upload({
  kind: 'logo',
  file: new Blob([await readFile('logo.png')], { type: 'image/png' }),
  filename: 'logo.png',
});

const { valid, problems } = await client.themes.validate(theme.draft);
const { url } = await client.themes.preview(theme.id, {
  sample: 'checkout',
  scheme: 'dark',
  viewport: 'phone',
});

await client.themes.publish(theme.id); // needs a live key
await client.themes.setDefault(theme.id);

await client.checkoutSessions.create({
  amount: '35.00',
  amount_currency: 'USD',
  external_ref: 'order-1042',
  success_url: 'https://shop.example/thanks',
  cancel_url: 'https://shop.example/cart',
  theme_id: theme.id,
  line_items: [{ name: 'Linen tee', quantity: 2, unit_amount: '12.50' }],
});
```

`client.themes` has `presets`, `list`, `create`, `retrieve`, `update`, `delete`, `publish`, `setDefault`, `validate`, `preview`, `fromWebsite` and `fromStore`. `client.themeAssets` has `upload` (multipart), `list` and `delete`. Errors such as `THEME_INVALID` carry `details.problems`. See the [themes API](https://docs.usetendr.tech/api-reference/themes.md). The key needs `themes:read` or `themes:write`.

## Webhooks

Webhook verification is Node-only — do not import `@tendr/sdk/webhook` into browser bundles.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.