@openmeter/client 1.0.0-beta-8f93b11ab8cd → 1.0.0-beta-52bb0a888f9a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -508,6 +508,13 @@ export interface AppCustomerDataExternalInvoicing {
508
508
  /** Labels for this external invoicing integration on the customer. */
509
509
  labels?: Labels;
510
510
  }
511
+ /** Cost basis resolved at the charge's full service period start. */
512
+ export interface ChargeCostBasisDynamic {
513
+ /** Discriminator selecting the cost basis mode. */
514
+ type: 'dynamic';
515
+ /** The fiat currency the charge amount is converted into for invoicing. */
516
+ fiatCurrency: string;
517
+ }
511
518
  /** Currency describes a currency supported by the billing system. */
512
519
  export interface CurrencyFiat {
513
520
  /** The type of the currency. */
@@ -615,6 +622,15 @@ export interface RateCardDiscounts {
615
622
  */
616
623
  usage?: string;
617
624
  }
625
+ /** Cost basis with an explicit conversion rate supplied with the charge. */
626
+ export interface ChargeCostBasisManual {
627
+ /** Discriminator selecting the cost basis mode. */
628
+ type: 'manual';
629
+ /** The fiat currency the charge amount is converted into for invoicing. */
630
+ fiatCurrency: string;
631
+ /** Fiat amount per one unit of the custom currency. */
632
+ rate: string;
633
+ }
618
634
  /** Totals contains the summaries of all calculations for a billing resource. */
619
635
  export interface Totals {
620
636
  /** The total value of the resource before taxes, discounts and commitments. */
@@ -680,11 +696,6 @@ export interface FeatureLlmUnitCostPricing {
680
696
  /** Cost per cache write token in USD. */
681
697
  cacheWritePerToken?: string;
682
698
  }
683
- /** Monetary amount in a specific currency. */
684
- export interface CurrencyAmount {
685
- amount: string;
686
- currency: string;
687
- }
688
699
  /** A credit allocation applied to an invoice line item. */
689
700
  export interface InvoiceLineCreditsApplied {
690
701
  /** The monetary amount credited. */
@@ -751,6 +762,11 @@ export interface LlmCostModelPricing {
751
762
  /** Reasoning output price per token (USD). */
752
763
  reasoningPerToken?: string;
753
764
  }
765
+ /** Monetary amount in a specific fiat currency. */
766
+ export interface FiatCurrencyAmount {
767
+ amount: string;
768
+ currency: string;
769
+ }
754
770
  /**
755
771
  * A query filter for a numeric attribute. Operators are mutually exclusive, only
756
772
  * one operator is allowed at a time.
@@ -863,6 +879,15 @@ export interface SubscriptionReference {
863
879
  };
864
880
  };
865
881
  }
882
+ /** Cost basis pinned to a specific cost basis resource of the custom currency. */
883
+ export interface ChargeCostBasisPinned {
884
+ /** Discriminator selecting the cost basis mode. */
885
+ type: 'pinned';
886
+ /** The fiat currency the charge amount is converted into for invoicing. */
887
+ fiatCurrency: string;
888
+ /** ID of the custom currency's cost basis resource to pin. */
889
+ costBasisId: string;
890
+ }
866
891
  /** App reference. */
867
892
  export interface AppReference {
868
893
  /** The ID of the app. */
@@ -1041,6 +1066,24 @@ export interface ClosedPeriod {
1041
1066
  */
1042
1067
  to: Date;
1043
1068
  }
1069
+ /**
1070
+ * Fiat conversion rate a custom-currency charge is invoiced at. Present once the
1071
+ * cost basis is resolved; dynamic cost bases are exposed only after the service
1072
+ * period has started.
1073
+ */
1074
+ export interface ChargeResolvedCostBasis {
1075
+ /** The fiat currency the charge amount is converted into for invoicing. */
1076
+ fiatCurrency: string;
1077
+ /** Fiat amount per one unit of the custom currency. */
1078
+ rate: string;
1079
+ /**
1080
+ * ID of the custom currency's cost basis resource the rate was taken from. Absent
1081
+ * for manual cost bases.
1082
+ */
1083
+ costBasisId?: string;
1084
+ /** When the rate was resolved. */
1085
+ resolvedAt: Date;
1086
+ }
1044
1087
  /** A subscription add-on event. */
1045
1088
  export interface SubscriptionAddonTimelineSegment {
1046
1089
  /** An ISO-8601 timestamp representation of the cadence start of the resource. */
@@ -2300,6 +2343,13 @@ export interface CreditTransaction {
2300
2343
  after: string;
2301
2344
  };
2302
2345
  }
2346
+ /** Monetary amount in a fiat or custom currency. */
2347
+ export interface CurrencyAmount {
2348
+ /** The amount as an arbitrary-precision decimal string. */
2349
+ amount: string;
2350
+ /** The fiat or custom currency code of the amount. */
2351
+ currency: BillingCurrencyCode;
2352
+ }
2303
2353
  /**
2304
2354
  * A price tier used in graduated and volume pricing.
2305
2355
  *
@@ -3074,46 +3124,6 @@ export interface WorkflowCollectionAlignmentAnchored {
3074
3124
  /** The recurring period for the alignment. */
3075
3125
  recurringPeriod: RecurringPeriod;
3076
3126
  }
3077
- /**
3078
- * Flat fee intent fields from the system lifecycle controller shadowed by a manual
3079
- * override.
3080
- */
3081
- export interface ChargeFlatFeeSystemIntent {
3082
- /**
3083
- * Display name of the resource.
3084
- *
3085
- * Between 1 and 256 characters.
3086
- */
3087
- name: string;
3088
- /**
3089
- * Optional description of the resource.
3090
- *
3091
- * Maximum 1024 characters.
3092
- */
3093
- description?: string;
3094
- labels?: Labels;
3095
- /** The timestamp when the charge is intended to be invoiced. */
3096
- invoiceAt: Date;
3097
- /** The effective service period covered by the charge. */
3098
- servicePeriod: ClosedPeriod;
3099
- /** The full, unprorated service period of the charge. */
3100
- fullServicePeriod: ClosedPeriod;
3101
- /** The billing period the charge belongs to. */
3102
- billingPeriod: ClosedPeriod;
3103
- /** Payment term of the flat fee charge. */
3104
- paymentTerm: PricePaymentTerm;
3105
- /** The discounts applied to the charge. */
3106
- discounts?: ChargeFlatFeeDiscounts;
3107
- /** The proration configuration of the charge. */
3108
- prorationConfiguration: RateCardProrationConfiguration;
3109
- /** The amount before proration of the system lifecycle controller flat fee intent. */
3110
- amountBeforeProration: CurrencyAmount;
3111
- /**
3112
- * The timestamp when the system lifecycle controller intent was deleted. The
3113
- * effective charge can remain visible while a manual override is active.
3114
- */
3115
- deletedAt?: Date;
3116
- }
3117
3127
  /** Detailed status information for a standard invoice. */
3118
3128
  export interface InvoiceStatusDetails {
3119
3129
  /** Whether the invoice is immutable (i.e. cannot be modified or deleted). */
@@ -3357,6 +3367,46 @@ export interface CreditTransactionPaginatedResponse {
3357
3367
  data: CreditTransaction[];
3358
3368
  meta: CursorMeta;
3359
3369
  }
3370
+ /**
3371
+ * Flat fee intent fields from the system lifecycle controller shadowed by a manual
3372
+ * override.
3373
+ */
3374
+ export interface ChargeFlatFeeSystemIntent {
3375
+ /**
3376
+ * Display name of the resource.
3377
+ *
3378
+ * Between 1 and 256 characters.
3379
+ */
3380
+ name: string;
3381
+ /**
3382
+ * Optional description of the resource.
3383
+ *
3384
+ * Maximum 1024 characters.
3385
+ */
3386
+ description?: string;
3387
+ labels?: Labels;
3388
+ /** The timestamp when the charge is intended to be invoiced. */
3389
+ invoiceAt: Date;
3390
+ /** The effective service period covered by the charge. */
3391
+ servicePeriod: ClosedPeriod;
3392
+ /** The full, unprorated service period of the charge. */
3393
+ fullServicePeriod: ClosedPeriod;
3394
+ /** The billing period the charge belongs to. */
3395
+ billingPeriod: ClosedPeriod;
3396
+ /** Payment term of the flat fee charge. */
3397
+ paymentTerm: PricePaymentTerm;
3398
+ /** The discounts applied to the charge. */
3399
+ discounts?: ChargeFlatFeeDiscounts;
3400
+ /** The proration configuration of the charge. */
3401
+ prorationConfiguration: RateCardProrationConfiguration;
3402
+ /** The amount before proration of the system lifecycle controller flat fee intent. */
3403
+ amountBeforeProration: CurrencyAmount;
3404
+ /**
3405
+ * The timestamp when the system lifecycle controller intent was deleted. The
3406
+ * effective charge can remain visible while a manual override is active.
3407
+ */
3408
+ deletedAt?: Date;
3409
+ }
3360
3410
  /**
3361
3411
  * Graduated tiered price.
3362
3412
  *
@@ -3552,6 +3602,30 @@ export interface CreditGrant {
3552
3602
  /** Current lifecycle status of the grant. */
3553
3603
  status: 'pending' | 'active' | 'expired' | 'voided';
3554
3604
  }
3605
+ /** Tax settings for a billing workflow. */
3606
+ export interface WorkflowTaxSettings {
3607
+ /**
3608
+ * Enable automatic tax calculation when tax is supported by the app. For example,
3609
+ * with Stripe Invoicing when enabled, tax is calculated via Stripe Tax.
3610
+ */
3611
+ enabled: boolean;
3612
+ /**
3613
+ * Enforce tax calculation when tax is supported by the app. When enabled, the
3614
+ * billing system will not allow to create an invoice without tax calculation.
3615
+ * Enforcement is different per apps, for example, Stripe app requires customer to
3616
+ * have a tax location when starting a paid subscription.
3617
+ */
3618
+ enforced: boolean;
3619
+ /**
3620
+ * Default tax configuration to apply to the invoices for line items.
3621
+ *
3622
+ * Setting a tax code (`stripe.code` / `taxCodeId`) on a profile's default tax
3623
+ * config is deprecated and can no longer be added or changed: the organization
3624
+ * default tax code is used instead. Existing tax-code values may still be removed,
3625
+ * and `behavior` remains fully supported.
3626
+ */
3627
+ defaultTaxConfig?: TaxConfig;
3628
+ }
3555
3629
  /** Flat fee charge create request. */
3556
3630
  export interface CreateChargeFlatFeeRequest {
3557
3631
  /**
@@ -3570,7 +3644,14 @@ export interface CreateChargeFlatFeeRequest {
3570
3644
  /** The type of the charge. */
3571
3645
  type: 'flat_fee';
3572
3646
  /** The currency of the charge. */
3573
- currency: string;
3647
+ currency: BillingCurrencyCode;
3648
+ /**
3649
+ * Defines how a custom-currency charge is converted into its fiat invoice
3650
+ * currency; the resolved rate is exposed through `resolved_cost_basis`. Required
3651
+ * when `currency` is custom and the charge settles as `credit_then_invoice`; must
3652
+ * be omitted otherwise.
3653
+ */
3654
+ costBasis?: ChargeCostBasis;
3574
3655
  /** The timestamp when the charge is intended to be invoiced. */
3575
3656
  invoiceAt: Date;
3576
3657
  /** The effective service period covered by the charge. */
@@ -3596,30 +3677,6 @@ export interface CreateChargeFlatFeeRequest {
3596
3677
  /** The billing period the charge belongs to. */
3597
3678
  billingPeriod?: ClosedPeriod;
3598
3679
  }
3599
- /** Tax settings for a billing workflow. */
3600
- export interface WorkflowTaxSettings {
3601
- /**
3602
- * Enable automatic tax calculation when tax is supported by the app. For example,
3603
- * with Stripe Invoicing when enabled, tax is calculated via Stripe Tax.
3604
- */
3605
- enabled: boolean;
3606
- /**
3607
- * Enforce tax calculation when tax is supported by the app. When enabled, the
3608
- * billing system will not allow to create an invoice without tax calculation.
3609
- * Enforcement is different per apps, for example, Stripe app requires customer to
3610
- * have a tax location when starting a paid subscription.
3611
- */
3612
- enforced: boolean;
3613
- /**
3614
- * Default tax configuration to apply to the invoices for line items.
3615
- *
3616
- * Setting a tax code (`stripe.code` / `taxCodeId`) on a profile's default tax
3617
- * config is deprecated and can no longer be added or changed: the organization
3618
- * default tax code is used instead. Existing tax-code values may still be removed,
3619
- * and `behavior` remains fully supported.
3620
- */
3621
- defaultTaxConfig?: TaxConfig;
3622
- }
3623
3680
  /** Page paginated response. */
3624
3681
  export interface PlanAddonPagePaginatedResponse {
3625
3682
  data: PlanAddon[];
@@ -4586,7 +4643,14 @@ export interface CreateChargeUsageBasedRequest {
4586
4643
  /** The type of the charge. */
4587
4644
  type: 'usage_based';
4588
4645
  /** The currency of the charge. */
4589
- currency: string;
4646
+ currency: BillingCurrencyCode;
4647
+ /**
4648
+ * Defines how a custom-currency charge is converted into its fiat invoice
4649
+ * currency; the resolved rate is exposed through `resolved_cost_basis`. Required
4650
+ * when `currency` is custom and the charge settles as `credit_then_invoice`; must
4651
+ * be omitted otherwise.
4652
+ */
4653
+ costBasis?: ChargeCostBasis;
4590
4654
  /** The timestamp when the charge is intended to be invoiced. */
4591
4655
  invoiceAt: Date;
4592
4656
  /** The effective service period covered by the charge. */
@@ -5583,7 +5647,13 @@ export interface ChargeFlatFee {
5583
5647
  */
5584
5648
  subscription?: SubscriptionOrReference;
5585
5649
  /** The currency of the charge. */
5586
- currency: string;
5650
+ currency: BillingCurrencyCode;
5651
+ /**
5652
+ * The resolved fiat conversion rate of a custom-currency charge. Resolution
5653
+ * depends on costbasis type: dynamic is resolved when charge becomes active, all
5654
+ * other types resolved on creation.
5655
+ */
5656
+ resolvedCostBasis?: ChargeResolvedCostBasis;
5587
5657
  /** The lifecycle status of the charge. */
5588
5658
  status: 'created' | 'active' | 'final' | 'deleted';
5589
5659
  /** The timestamp when the charge is intended to be invoiced. */
@@ -5671,7 +5741,13 @@ export interface ChargeUsageBased {
5671
5741
  */
5672
5742
  subscription?: SubscriptionOrReference;
5673
5743
  /** The currency of the charge. */
5674
- currency: string;
5744
+ currency: BillingCurrencyCode;
5745
+ /**
5746
+ * The resolved fiat conversion rate of a custom-currency charge. Resolution
5747
+ * depends on costbasis type: dynamic is resolved when charge becomes active, all
5748
+ * other types resolved on creation.
5749
+ */
5750
+ resolvedCostBasis?: ChargeResolvedCostBasis;
5675
5751
  /** The lifecycle status of the charge. */
5676
5752
  status: 'created' | 'active' | 'final' | 'deleted';
5677
5753
  /** The timestamp when the charge is intended to be invoiced. */
@@ -5815,6 +5891,11 @@ export type SubscriptionEditTiming = 'immediate' | 'next_billing_cycle' | Date;
5815
5891
  export type InstallAppRequest = InstallAppStripeWithApiKey | InstallAppSandbox | InstallAppExternalInvoicing;
5816
5892
  /** Payment settings for a billing workflow. */
5817
5893
  export type UpdateBillingWorkflowPaymentSettings = UpdateBillingWorkflowPaymentChargeAutomaticallySettings | UpdateBillingWorkflowPaymentSendInvoiceSettings;
5894
+ /**
5895
+ * Cost basis selection for a custom-currency charge. The variant chosen fixes when
5896
+ * and how the conversion rate is determined.
5897
+ */
5898
+ export type ChargeCostBasis = ChargeCostBasisDynamic | ChargeCostBasisPinned | ChargeCostBasisManual;
5818
5899
  /** A parameter that failed validation. */
5819
5900
  export type InvalidParameter = InvalidParameterStandard | InvalidParameterMinimumLength | InvalidParameterMaximumLength | InvalidParameterChoiceItem | InvalidParameterDependentItem;
5820
5901
  /**
@@ -6993,7 +7074,14 @@ export interface CreateChargeUsageBasedRequestInput {
6993
7074
  /** The type of the charge. */
6994
7075
  type: 'usage_based';
6995
7076
  /** The currency of the charge. */
6996
- currency: string;
7077
+ currency: BillingCurrencyCode;
7078
+ /**
7079
+ * Defines how a custom-currency charge is converted into its fiat invoice
7080
+ * currency; the resolved rate is exposed through `resolved_cost_basis`. Required
7081
+ * when `currency` is custom and the charge settles as `credit_then_invoice`; must
7082
+ * be omitted otherwise.
7083
+ */
7084
+ costBasis?: ChargeCostBasis;
6997
7085
  /** The timestamp when the charge is intended to be invoiced. */
6998
7086
  invoiceAt: Date;
6999
7087
  /** The effective service period covered by the charge. */
@@ -7918,7 +8006,13 @@ export interface ChargeFlatFeeInput {
7918
8006
  */
7919
8007
  subscription?: SubscriptionOrReferenceInput;
7920
8008
  /** The currency of the charge. */
7921
- currency: string;
8009
+ currency: BillingCurrencyCode;
8010
+ /**
8011
+ * The resolved fiat conversion rate of a custom-currency charge. Resolution
8012
+ * depends on costbasis type: dynamic is resolved when charge becomes active, all
8013
+ * other types resolved on creation.
8014
+ */
8015
+ resolvedCostBasis?: ChargeResolvedCostBasis;
7922
8016
  /** The lifecycle status of the charge. */
7923
8017
  status: 'created' | 'active' | 'final' | 'deleted';
7924
8018
  /** The timestamp when the charge is intended to be invoiced. */
@@ -8006,7 +8100,13 @@ export interface ChargeUsageBasedInput {
8006
8100
  */
8007
8101
  subscription?: SubscriptionOrReferenceInput;
8008
8102
  /** The currency of the charge. */
8009
- currency: string;
8103
+ currency: BillingCurrencyCode;
8104
+ /**
8105
+ * The resolved fiat conversion rate of a custom-currency charge. Resolution
8106
+ * depends on costbasis type: dynamic is resolved when charge becomes active, all
8107
+ * other types resolved on creation.
8108
+ */
8109
+ resolvedCostBasis?: ChargeResolvedCostBasis;
8010
8110
  /** The lifecycle status of the charge. */
8011
8111
  status: 'created' | 'active' | 'final' | 'deleted';
8012
8112
  /** The timestamp when the charge is intended to be invoiced. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmeter/client",
3
- "version": "1.0.0-beta-8f93b11ab8cd",
3
+ "version": "1.0.0-beta-52bb0a888f9a",
4
4
  "description": "Official TypeScript SDK for the OpenMeter API — usage metering and billing",
5
5
  "keywords": [
6
6
  "openmeter",