Update customer billing app data

put

Path Parameters

customerIdstringrequired

ULID (Universally Unique Lexicographically Sortable Identifier).

Match pattern:^[0-7][0-9A-HJKMNP-TV-Z]{25}$

Example:01G65Z755AFWAKHE12NY0CQ9FH

Body

application/json

UpsertAppCustomerDataRequest

AppCustomerData upsert request.

stripeobject

Used if the customer has a linked Stripe app.

Show Child Parameters
external_invoicingobject

Used if the customer has a linked external invoicing app.

Show Child Parameters

Response

application/json

AppCustomerData upsert response.

BillingAppCustomerData

App customer data.

stripeobject

Used if the customer has a linked Stripe app.

Show Child Parameters
external_invoicingobject

Used if the customer has a linked external invoicing app.

Show Child Parameters
put/openmeter/customers/{customerId}/billing/app-data

Body

{}
 
application/json

Create Stripe Checkout Session

Create a Stripe Checkout Session for the customer.

Creates a Checkout Session for collecting payment method information from customers.
The session operates in “setup” mode, which collects payment details without charging
the customer immediately. The collected payment method can be used for future
subscription billing.

For hosted checkout sessions, redirect customers to the returned URL. For embedded
sessions, use the client_secret to initialize Stripe.js in your application.

post

Path Parameters

customerIdstringrequired

ULID (Universally Unique Lexicographically Sortable Identifier).

Match pattern:^[0-7][0-9A-HJKMNP-TV-Z]{25}$

Example:01G65Z755AFWAKHE12NY0CQ9FH

Body

application/json

BillingCustomerStripeCreateCheckoutSessionRequest

Request to create a Stripe Checkout Session for the customer.

Checkout Sessions are used to collect payment method information from customers
in a secure, Stripe-hosted interface. This integration uses setup mode to collect
payment methods that can be charged later for subscription billing.

stripe_optionsobjectrequired

Options for configuring the Stripe Checkout Session.

These options are passed directly to Stripe’s checkout session creation API.

Show Child Parameters

Response

application/json

CreateStripeCheckoutSessionResult created response.

BillingAppStripeCreateCheckoutSessionResult

Result of creating a Stripe Checkout Session.

Contains all the information needed to redirect customers to the checkout
or initialize an embedded checkout flow.

customer_idstringrequired

The customer ID in the billing system.

Match pattern:^[0-7][0-9A-HJKMNP-TV-Z]{25}$

Example:01G65Z755AFWAKHE12NY0CQ9FH

stripe_customer_idstringrequired

The Stripe customer ID.

session_idstringrequired

The Stripe checkout session ID.

setup_intent_idstringrequired

The setup intent ID created for collecting the payment method.

client_secretstring

Client secret for initializing Stripe.js on the client side.

Required for embedded checkout sessions.
See: https://docs.stripe.com/payments/checkout/custom-success-page

client_reference_idstring

The client reference ID provided in the request.

Useful for reconciling the session with your internal systems.

customer_emailstring

Customer’s email address if provided to Stripe.

currencystring

Currency code for the checkout session.

Match pattern:^[A-Z]{3}$

>= 3 characters<= 3 characters

Example:USD

created_atstring(date-time)required

Timestamp when the checkout session was created.

Example:2023-01-01T01:01:01.001Z

expires_atstring(date-time)

Timestamp when the checkout session will expire.

Example:2023-01-01T01:01:01.001Z

metadataobject

Metadata attached to the checkout session.

urlstring

URL to redirect customers to the checkout page (for hosted mode).

modestringrequired

Mode of the checkout session.

Currently only “setup” mode is supported for collecting payment methods.

Allowed values:setup

cancel_urlstring

The cancel URL where customers are redirected if they cancel.

success_urlstring

The success URL where customers are redirected after completion.

return_urlstring

The return URL for embedded sessions after authentication.

post/openmeter/customers/{customerId}/billing/stripe/checkout-sessions

Body

{ "stripe_options": {} }
 
application/json

Create Stripe customer portal session

Create Stripe Customer Portal Session.

Useful to redirect the customer to the Stripe Customer Portal to manage their payment methods,
change their billing address and access their invoice history.
Only returns URL if the customer billing profile is linked to a stripe app and customer.

post

Path Parameters

customerIdstringrequired

ULID (Universally Unique Lexicographically Sortable Identifier).

Match pattern:^[0-7][0-9A-HJKMNP-TV-Z]{25}$

Example:01G65Z755AFWAKHE12NY0CQ9FH

Body

application/json

BillingCustomerStripeCreateCustomerPortalSessionRequest

Request to create a Stripe Customer Portal Session for the customer.

Useful to redirect the customer to the Stripe Customer Portal to manage their payment methods,
change their billing address and access their invoice history.
Only returns URL if the customer billing profile is linked to a stripe app and customer.

stripe_optionsobjectrequired

Options for configuring the Stripe Customer Portal Session.

Show Child Parameters

Response

application/json

CreateStripeCustomerPortalSessionResult created response.

BillingAppStripeCreateCustomerPortalSessionResult

Result of creating a Stripe Customer Portal Session.

Contains all the information needed to redirect the customer to the Stripe Customer Portal.

idstringrequired
stripe_customer_idstringrequired

The ID of the stripe customer.

configuration_idstringrequired
created_atstring(date-time)required

Example:2023-01-01T01:01:01.001Z

localestringrequired

The IETF language tag of the locale customer portal is displayed in.

See: https://docs.stripe.com/api/customer_portal/sessions/object#portal_session_object-locale

urlstringrequired

The URL to redirect the customer to after they have completed
their requested actions.

post/openmeter/customers/{customerId}/billing/stripe/portal-sessions

Body

{ "stripe_options": {} }
 
application/json

Metering Events

Metering events are used to track usage of your product or service. Events are processed asynchronously by the meters, so they may not be immediately available for querying.

Ingest metering events

Ingests an event or batch of events following the CloudEvents specification.

post

Body

Metering Event

Metering event following the CloudEvents specification.

idstringrequired

Identifies the event.

>= 1 characters

Example:5c10fade-1c9e-4d6c-8275-c52c36731d3c

sourcestring(uri-reference)required

Identifies the context in which an event happened.

>= 1 characters

Example:service-name

specversionstringrequired

The version of the CloudEvents specification which the event uses.

Default:1.0

>= 1 characters

Example:1.0

typestringrequired

Contains a value describing the type of event related to the originating occurrence.

>= 1 characters

Example:com.example.someevent

datacontenttypestring | null

Content type of the CloudEvents data value. Only the value “application/json” is allowed over HTTP.

Allowed values:application/json

Example:application/json

dataschemastring | null(uri)

Identifies the schema that data adheres to.

>= 1 characters

subjectstringrequired

Describes the subject of the event in the context of the event producer (identified by source).

>= 1 characters

Example:customer-id

timestring | null(date-time)

Timestamp of when the occurrence happened. Must adhere to RFC 3339.

Example:2023-01-01T01:01:01.001Z

dataobject | null

The event payload.
Optional, if present it must be a JSON object.

Response

The events have been ingested and are being processed asynchronously.

post/openmeter/events

Body

{ "specversion": "1.0", "id": "5c10fade-1c9e-4d6c-8275-c52c36731d3c", "source": "service-name", "type": "prompt", "subject": "customer-id", "time": "2023-01-01T01:01:01.001Z", "data": { "prompt": "Hello, world!", "tokens": 100, "model": "gpt-4o", "type": "input" } }