@ai-billing/stripe / StripeDestinationOptions
Interface: StripeDestinationOptions<TTags>
Defined in: stripe-destination.ts:23 Options for createStripeDestination. Stripe Meters ingest usage viabilling.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?
Defined in: stripe-destination.ts:29 Optional pre-configured Stripe SDK client. When omitted, a client is constructed fromoptionalclient?:Stripe
apiKey.
apiKey?
Defined in: stripe-destination.ts:35 Stripe secret key used when creating a Stripe SDK client (e.g.optionalapiKey?:string
sk_live_...).
Only used when client is not provided.
meterName
meterName:Defined in: stripe-destination.ts:39 Stripe meter event name (string| ((event) =>string)
event_name), or a function that derives it from the billing event.
mapMetadata?
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:optionalmapMetadata?: (event) =>Record<string,string>
- always includes
value(cost in nanos; requires a defined BillingEvent.cost on each event) andstripe_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>