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

# CreatePolarDestination

[**@ai-billing/polar**](../index)

***

[@ai-billing/polar](/docs/sdk/ai-billing/reference/polar/typedoc/index) / createPolarDestination

# Function: createPolarDestination()

> **createPolarDestination**\<`TTags`>(`options`): `Destination`\<`TTags`>

Defined in: [polar-destination.ts:72](https://github.com/narevai/ai-billing/blob/main/packages/polar/src/destination/polar-destination.ts#L72)

Creates a Destination that ingests billing events into Polar.

**Identity:** When `internalId` is present, sends `EventCreateCustomer` with `customerId`. When only
`externalId` is present, sends `EventCreateExternalCustomer` with `externalCustomerId`. When both are
missing, logs a warning and skips the event.

## Type Parameters

### TTags

`TTags` *extends* `JSONObject` = `JSONObject`

The shape of the tags object, extending DefaultTags.

## Parameters

### options

[`PolarDestinationOptions`](/docs/sdk/ai-billing/reference/polar/typedoc/interfaces/PolarDestinationOptions)\<`TTags`>

Destination configuration; see [PolarDestinationOptions](/docs/sdk/ai-billing/reference/polar/typedoc/interfaces/PolarDestinationOptions).

## Returns

`Destination`\<`TTags`>

A destination function that sends events to Polar.
