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

# TypeScript SDK

> Use the Crosspoint TypeScript SDK, @crossdev/sdk

## Installation

**npm**

```bash Terminal theme={null}
npm install @crossdev/sdk
```

**pnpm**

```bash Terminal theme={null}
pnpm add @crossdev/sdk
```

**yarn**

```bash Terminal theme={null}
yarn add @crossdev/sdk
```

**bun**

```bash Terminal theme={null}
bun add @crossdev/sdk
```

## Quickstart

Create an organization access token (**Settings > Developers**) and store it in `CROSSPOINT_ACCESS_TOKEN`. The client reads it from there:

```ts index.ts theme={null}
import { createCrosspoint } from "@crossdev/sdk";

const crosspoint = createCrosspoint();

for await (const product of crosspoint.products.iterList({ limit: 10 })) {
  console.log(product);
}
```

You can also pass the token yourself: `createCrosspoint({ accessToken: "cxp_oat_..." })`.

Requests wait up to 30 seconds (Polar's SDK waits 5). Change it with `createCrosspoint({ timeout: 60 })`, in seconds.

## API versions

`@crossdev/sdk` uses API version 2026-10. Pin a version with its import path:

```ts theme={null}
import { createCrosspoint } from "@crossdev/sdk/2027-01";
```

Versions 2026-04, 2026-10 and 2027-01 are available.

## Creating a checkout

```ts theme={null}
const checkout = await crosspoint.checkouts.create({
  products: ["<PRODUCT_ID>"],
  success_url: "https://your-app.com/success?checkout_id={CHECKOUT_ID}",
});

// send your customer to checkout.url
```

## Transaction splits

`crosspoint.splits` and `crosspoint.splitRecipients` are Crosspoint's own: they share each sale with partners or vendors. See [Transaction splits](https://staging-docs.crosspoint.finance/africa/splits.md).

```ts theme={null}
const recipients = await crosspoint.splitRecipients.list({ status: "pending" });
```

Like the rest of the SDK, they use the API's field names (`fee_bearer`, `product_ids`) and take IDs as plain arguments (`crosspoint.splits.update(id, { is_default: true })`). Errors from these come as `CrosspointAPIError`, with `statusCode` and `body`.

## Verifying webhooks

```ts theme={null}
import { webhooks } from "@crossdev/sdk";

try {
  const event = await webhooks.validateEvent(body, headers, process.env.CROSSPOINT_WEBHOOK_SECRET!);
  // handle event.type
} catch (error) {
  if (error instanceof webhooks.WebhookVerificationError) {
    // not from Crosspoint: reject it with a 403
  }
}
```

## Sandbox

Use the [sandbox](https://staging-docs.crosspoint.finance/africa/sandbox.md) while you build: set `CROSSPOINT_ENVIRONMENT=sandbox` with a sandbox access token, or pass the environment:

```ts theme={null}
const crosspoint = createCrosspoint({ environment: "sandbox" });
```

## Local development

Point the client at a local API with `baseUrl`:

```ts theme={null}
const crosspoint = createCrosspoint({ baseUrl: "http://127.0.0.1:8000" });
```

## Next steps

* [Webhook delivery](https://staging-docs.crosspoint.finance/integrate/webhooks/delivery.md): a full webhook handler
* [API reference](https://staging-docs.crosspoint.finance/api-reference): every endpoint, with TypeScript examples


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