Skip to main content
@ai-billing/stripe
@ai-billing/stripe / StripeDestinationOptions

Interface: StripeDestinationOptions<TTags>

Defined in: stripe-destination.ts:23 Options for createStripeDestination. Stripe Meters ingest usage via billing.meterEvents.create, keyed by an event name plus a payload map. This destination reads the Stripe customer identity from event tags, derives an event_name, and maps billing metadata into a payload (with Stripe’s payload size constraints in mind).

Type Parameters

TTags

TTags extends DefaultTags = DefaultTags The shape of the tags object, extending DefaultTags.

Properties

client?

optional client?: Stripe
Defined in: stripe-destination.ts:29 Optional pre-configured Stripe SDK client. When omitted, a client is constructed from apiKey.

apiKey?

optional apiKey?: string
Defined in: stripe-destination.ts:35 Stripe secret key used when creating a Stripe SDK client (e.g. sk_live_...). Only used when client is not provided.

meterName

meterName: string | ((event) => string)
Defined in: stripe-destination.ts:39 Stripe meter event name (event_name), or a function that derives it from the billing event.

mapMetadata?

optional mapMetadata?: (event) => Record<string, string>
Defined in: stripe-destination.ts:49 Optional override for the metadata included in the Stripe meter event payload. When omitted, metadata is built from buildMeterMetadata. This destination then:
  • always includes value (cost in nanos; requires a defined BillingEvent.cost on each event) and stripe_customer_id (from tags; see createStripeDestination for missing-tag behavior)
  • prioritizes a small set of commonly useful fields first
  • hard-stops at 10 payload keys (Stripe constraint)

Parameters

event
BillingEvent<TTags>

Returns

Record<string, string>