import { type Client } from '../core.js'; import { type RequestOptions } from '../lib/types.js'; import type { CreateCustomerRequest, CreateCustomerResponse, GetCustomerRequest, GetCustomerResponse, ListCustomersRequest, ListCustomersResponse, UpsertCustomerRequest, UpsertCustomerResponse, DeleteCustomerRequest, DeleteCustomerResponse, GetCustomerBillingRequest, GetCustomerBillingResponse, UpdateCustomerBillingRequest, UpdateCustomerBillingResponse, UpdateCustomerBillingAppDataRequest, UpdateCustomerBillingAppDataResponse, CreateCustomerStripeCheckoutSessionRequest, CreateCustomerStripeCheckoutSessionResponse, CreateCustomerStripePortalSessionRequest, CreateCustomerStripePortalSessionResponse, CreateCustomerEntitlementRequest, CreateCustomerEntitlementResponse, OverrideCustomerEntitlementRequest, OverrideCustomerEntitlementResponse, GetCustomerEntitlementHistoryRequest, GetCustomerEntitlementHistoryResponse, GetCustomerEntitlementRequest, GetCustomerEntitlementResponse, ListCustomerEntitlementsRequest, ListCustomerEntitlementsResponse, ResetCustomerEntitlementUsageRequest, ResetCustomerEntitlementUsageResponse, DeleteCustomerEntitlementRequest, DeleteCustomerEntitlementResponse, CreateCustomerEntitlementGrantRequest, CreateCustomerEntitlementGrantResponse, ListCustomerEntitlementGrantsRequest, ListCustomerEntitlementGrantsResponse, CreateCreditGrantRequest, CreateCreditGrantResponse, GetCreditGrantRequest, GetCreditGrantResponse, ListCreditGrantsRequest, ListCreditGrantsResponse, GetCustomerCreditBalanceRequest, GetCustomerCreditBalanceResponse, CreateCreditAdjustmentRequest, CreateCreditAdjustmentResponse, VoidCreditGrantRequest, VoidCreditGrantResponse, UpdateCreditGrantExternalSettlementRequest, UpdateCreditGrantExternalSettlementResponse, ListCreditTransactionsRequest, ListCreditTransactionsResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.js'; import type { Charge, CreditGrant, CreditTransaction, Customer, Entitlement, EntitlementGrant } from '../models/types.js'; export declare class Customers { private readonly _client; constructor(_client: Client); /** * Create customer * * POST /openmeter/customers */ create(request: CreateCustomerRequest, options?: RequestOptions): Promise; /** * Get customer * * GET /openmeter/customers/{customerId} */ get(request: GetCustomerRequest, options?: RequestOptions): Promise; /** * List customers * * GET /openmeter/customers */ list(request?: ListCustomersRequest, options?: RequestOptions): Promise; /** * List customers * * Iterates every item across all pages, fetching more as the returned iterable is consumed. * * GET /openmeter/customers */ listAll(request?: ListCustomersRequest, options?: RequestOptions): AsyncIterable; /** * Upsert customer * * PUT /openmeter/customers/{customerId} */ upsert(request: UpsertCustomerRequest, options?: RequestOptions): Promise; /** * Delete customer * * DELETE /openmeter/customers/{customerId} */ delete(request: DeleteCustomerRequest, options?: RequestOptions): Promise; private _billing?; get billing(): CustomersBilling; private _entitlements?; get entitlements(): CustomersEntitlements; private _credits?; get credits(): CustomersCredits; private _charges?; get charges(): CustomersCharges; } export declare class CustomersBilling { private readonly _client; constructor(_client: Client); /** * Get customer billing data * * GET /openmeter/customers/{customerId}/billing */ get(request: GetCustomerBillingRequest, options?: RequestOptions): Promise; /** * Update customer billing data * * PUT /openmeter/customers/{customerId}/billing */ update(request: UpdateCustomerBillingRequest, options?: RequestOptions): Promise; /** * Update customer billing app data * * PUT /openmeter/customers/{customerId}/billing/app-data */ updateAppData(request: UpdateCustomerBillingAppDataRequest, options?: RequestOptions): Promise; /** * Create Stripe Checkout Session * * Create a [Stripe Checkout Session](https://docs.stripe.com/payments/checkout) * 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 /openmeter/customers/{customerId}/billing/stripe/checkout-sessions */ createStripeCheckoutSession(request: CreateCustomerStripeCheckoutSessionRequest, options?: RequestOptions): Promise; /** * 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 /openmeter/customers/{customerId}/billing/stripe/portal-sessions */ createStripePortalSession(request: CreateCustomerStripePortalSessionRequest, options?: RequestOptions): Promise; } export declare class CustomersEntitlements { private readonly _client; constructor(_client: Client); /** * Create customer entitlement * * Create an entitlement for the customer. * * A customer can have only one active entitlement per feature. The feature must be * compatible with the entitlement type. Entitlements cannot be modified after * creation, only deleted. * * POST /openmeter/customers/{customerId}/entitlements */ create(request: CreateCustomerEntitlementRequest, options?: RequestOptions): Promise; /** * Override customer entitlement * * Override an entitlement of the customer with a new one. * * The referenced entitlement ends and the new one starts at the same instant, so * access continues without a gap. Both must belong to the same feature. Use this * for upgrades and downgrades. * * Fails if the referenced entitlement does not exist, is deleted, or is no longer * active. * * PUT /openmeter/customers/{customerId}/entitlements/{entitlementId}/override */ override(request: OverrideCustomerEntitlementRequest, options?: RequestOptions): Promise; /** * Get customer entitlement history * * Get the balance and usage history of a metered entitlement. The queried range * may span multiple usage periods. * * `windowed_history` groups usage into windows of the requested size and reports * the balance at the start of each window. `burndown_history` lists the periods in * which grants were consumed in a fixed order, together with the usage taken from * each grant. * * GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/history */ getHistory(request: GetCustomerEntitlementHistoryRequest, options?: RequestOptions): Promise; /** * Get customer entitlement * * Get an entitlement of the customer by ID. For checking entitlement access, use * the entitlement access endpoints instead. * * GET /openmeter/customers/{customerId}/entitlements/{entitlementId} */ get(request: GetCustomerEntitlementRequest, options?: RequestOptions): Promise; /** * List customer entitlements * * List the entitlements of the customer that are active at the time of the * request. For checking entitlement access, use the entitlement access endpoints * instead. * * GET /openmeter/customers/{customerId}/entitlements */ list(request: ListCustomerEntitlementsRequest, options?: RequestOptions): Promise; /** * List customer entitlements * * List the entitlements of the customer that are active at the time of the * request. For checking entitlement access, use the entitlement access endpoints * instead. * * Iterates every item across all pages, fetching more as the returned iterable is consumed. * * GET /openmeter/customers/{customerId}/entitlements */ listAll(request: ListCustomerEntitlementsRequest, options?: RequestOptions): AsyncIterable; /** * Reset customer entitlement usage * * Reset the usage of a metered entitlement. The reset starts a new usage period: * usage is zeroed and grants roll over according to their rollover settings. * * Usage is reset automatically at the end of each usage period. Use this operation * to reset it earlier, for example to align the entitlement with the customer's * billing period. The usage period anchor can be moved at the same time. * * POST /openmeter/customers/{customerId}/entitlements/{entitlementId}/reset */ resetUsage(request: ResetCustomerEntitlementUsageRequest, options?: RequestOptions): Promise; /** * Delete customer entitlement * * Deletes the entitlement and revokes access to its feature. A customer can hold * only one active entitlement per feature, so migrating a feature requires * deleting the previous entitlement first. * * Deletion sets the `deleted_at` timestamp instead of removing history. Access and * status queries for earlier points in time still treat the entitlement as active, * so access changes are never retroactive. * * DELETE /openmeter/customers/{customerId}/entitlements/{entitlementId} */ delete(request: DeleteCustomerEntitlementRequest, options?: RequestOptions): Promise; private _grants?; get grants(): CustomersEntitlementsGrants; } export declare class CustomersEntitlementsGrants { private readonly _client; constructor(_client: Client); /** * Create customer entitlement grant * * Issue a grant for a metered entitlement of the customer. Boolean and static * entitlements cannot have grants, so the request is rejected for them. * * Grants are immutable. The amount is added to the balance from `effective_at`, * which cannot be earlier than the start of the current usage period. * * POST /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants */ create(request: CreateCustomerEntitlementGrantRequest, options?: RequestOptions): Promise; /** * List customer entitlement grants * * List the grants issued for an entitlement of the customer. Grants only exist for * metered entitlements, so the list is empty for boolean and static entitlements. * * Deleted grants are excluded unless `include_deleted` is set. Voided and expired * grants are always included, as they are part of the balance history. * * GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants */ list(request: ListCustomerEntitlementGrantsRequest, options?: RequestOptions): Promise; /** * List customer entitlement grants * * List the grants issued for an entitlement of the customer. Grants only exist for * metered entitlements, so the list is empty for boolean and static entitlements. * * Deleted grants are excluded unless `include_deleted` is set. Voided and expired * grants are always included, as they are part of the balance history. * * Iterates every item across all pages, fetching more as the returned iterable is consumed. * * GET /openmeter/customers/{customerId}/entitlements/{entitlementId}/grants */ listAll(request: ListCustomerEntitlementGrantsRequest, options?: RequestOptions): AsyncIterable; } export declare class CustomersCredits { private readonly _client; constructor(_client: Client); private _grants?; get grants(): CustomersCreditsGrants; private _balance?; get balance(): CustomersCreditsBalance; private _adjustments?; get adjustments(): CustomersCreditsAdjustments; private _transactions?; get transactions(): CustomersCreditsTransactions; } export declare class CustomersCreditsGrants { private readonly _client; constructor(_client: Client); /** * Create a new credit grant * * Create a new credit grant. A credit grant represents an allocation of prepaid * credits to a customer. * * POST /openmeter/customers/{customerId}/credits/grants */ create(request: CreateCreditGrantRequest, options?: RequestOptions): Promise; /** * Get a credit grant * * Get a credit grant. * * GET /openmeter/customers/{customerId}/credits/grants/{creditGrantId} */ get(request: GetCreditGrantRequest, options?: RequestOptions): Promise; /** * List credit grants * * List credit grants. * * GET /openmeter/customers/{customerId}/credits/grants */ list(request: ListCreditGrantsRequest, options?: RequestOptions): Promise; /** * List credit grants * * List credit grants. * * Iterates every item across all pages, fetching more as the returned iterable is consumed. * * GET /openmeter/customers/{customerId}/credits/grants */ listAll(request: ListCreditGrantsRequest, options?: RequestOptions): AsyncIterable; /** * Void credit grant * * Void a credit grant, forfeiting the remaining unused balance. * * Voiding is a forward-looking, irreversible operation. Credits already consumed * by usage remain unaffected — only the remaining balance is forfeited. The grant * reads as `voided` status afterwards. Payment state is not adjusted when * `payment_adjustment` is `none`, so invoice-backed or externally collected * payments may still collect the original amount. Only `active` grants can be * voided; voiding a pending, expired, or fully consumed grant returns a conflict. * Retrying a successful void is an idempotent success. * * POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/void */ void(request: VoidCreditGrantRequest, options?: RequestOptions): Promise; /** * Update credit grant external settlement status * * Update the payment settlement status of an externally funded credit grant. * * Use this endpoint to synchronize the payment state of an external payment with * the system so that revenue recognition and credit availability work as expected. * * POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/settlement/external */ updateExternalSettlement(request: UpdateCreditGrantExternalSettlementRequest, options?: RequestOptions): Promise; } export declare class CustomersCreditsBalance { private readonly _client; constructor(_client: Client); /** * Get a customer's credit balance * * Get a credit balance. * * GET /openmeter/customers/{customerId}/credits/balance */ get(request: GetCustomerCreditBalanceRequest, options?: RequestOptions): Promise; } export declare class CustomersCreditsAdjustments { private readonly _client; constructor(_client: Client); /** * Create a credit adjustment * * A credit adjustment can be used to make manual adjustments to a customer's * credit balance. * * Supported use-cases: * * - Usage correction * * POST /openmeter/customers/{customerId}/credits/adjustments */ create(request: CreateCreditAdjustmentRequest, options?: RequestOptions): Promise; } export declare class CustomersCreditsTransactions { private readonly _client; constructor(_client: Client); /** * List credit transactions * * List credit transactions for a customer. * * Returns an immutable, chronological record of credit movements: funded credits * and consumed credits. Transactions are returned in reverse chronological order * by default. * * GET /openmeter/customers/{customerId}/credits/transactions */ list(request: ListCreditTransactionsRequest, options?: RequestOptions): Promise; /** * List credit transactions * * List credit transactions for a customer. * * Returns an immutable, chronological record of credit movements: funded credits * and consumed credits. Transactions are returned in reverse chronological order * by default. * * Iterates every item across all pages, fetching more as the returned iterable is consumed. * * GET /openmeter/customers/{customerId}/credits/transactions */ listAll(request: ListCreditTransactionsRequest, options?: RequestOptions): AsyncIterable; } export declare class CustomersCharges { private readonly _client; constructor(_client: Client); /** * List customer charges * * List customer charges. * * Returns the customer's charges that are represented as either flat fee or * usage-based charges. * * GET /openmeter/customers/{customerId}/charges */ list(request: ListCustomerChargesRequest, options?: RequestOptions): Promise; /** * List customer charges * * List customer charges. * * Returns the customer's charges that are represented as either flat fee or * usage-based charges. * * Iterates every item across all pages, fetching more as the returned iterable is consumed. * * GET /openmeter/customers/{customerId}/charges */ listAll(request: ListCustomerChargesRequest, options?: RequestOptions): AsyncIterable; /** * Create customer charge * * Create customer charge. * * POST /openmeter/customers/{customerId}/charges */ create(request: CreateCustomerChargesRequest, options?: RequestOptions): Promise; }