@openmeter/sdk 1.0.0-beta.232 → 1.0.0-beta.233

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.
@@ -2188,9 +2188,17 @@ export interface paths {
2188
2188
  put?: never;
2189
2189
  /**
2190
2190
  * Migrate subscription
2191
- * @description Migrates the subscripiton to the provided version of the current plan.
2192
- * If possible, the migration will be done immediately.
2193
- * If not, the migration will be scheduled to the end of the current billing period.
2191
+ * @description Migrates a running subscription to a later version of its current plan.
2192
+ * If startingPhase is omitted and billingAnchor is omitted or unchanged, the subscription is amended in place.
2193
+ * Unchanged items retain their service periods. Changed or removed items end at
2194
+ * the effective time; replacements and additions start from that time.
2195
+ * For in-place migrations, existing addons must be compatible with the target plan version.
2196
+ * The phase timeline, billing anchor, and subscription-level billing settings
2197
+ * are preserved. Both response entries refer to the same subscription:
2198
+ * current is the before snapshot and next is the amended view.
2199
+ * Providing startingPhase or a different billingAnchor uses subscription change: the current subscription
2200
+ * ends and a replacement starts at the effective time. This resets the phase timeline
2201
+ * and can produce billing adjustments. Addons are not transferred to the replacement.
2194
2202
  */
2195
2203
  post: operations['migrateSubscription'];
2196
2204
  delete?: never;
@@ -3788,6 +3796,8 @@ export interface components {
3788
3796
  * @example USD
3789
3797
  */
3790
3798
  CurrencyCode: string;
3799
+ /** @description Fiat or managed custom currency code. */
3800
+ CurrencyCodeOrCustom: string;
3791
3801
  /**
3792
3802
  * @description Custom Invoicing app can be used for interface with any invoicing or payment system.
3793
3803
  *
@@ -4087,6 +4097,11 @@ export interface components {
4087
4097
  * @example 2023-01-01T01:01:01.001Z
4088
4098
  */
4089
4099
  billingAnchor?: Date;
4100
+ /**
4101
+ * @description Controls how custom-currency cost bases are selected for the new subscription.
4102
+ * @default dynamic
4103
+ */
4104
+ costBasisMode?: components['schemas']['SubscriptionCostBasisMode'];
4090
4105
  /** @description The custom plan description which defines the Subscription. */
4091
4106
  customPlan: components['schemas']['CustomPlanInput'];
4092
4107
  };
@@ -4095,6 +4110,11 @@ export interface components {
4095
4110
  * @description Create a custom subscription.
4096
4111
  */
4097
4112
  CustomSubscriptionCreate: {
4113
+ /**
4114
+ * @description Controls how custom-currency cost bases are selected for the new subscription.
4115
+ * @default dynamic
4116
+ */
4117
+ costBasisMode?: components['schemas']['SubscriptionCostBasisMode'];
4098
4118
  /** @description The custom plan description which defines the Subscription. */
4099
4119
  customPlan: components['schemas']['CustomPlanInput'];
4100
4120
  /**
@@ -9795,6 +9815,11 @@ export interface components {
9795
9815
  billingAnchor?: Date;
9796
9816
  /** @description The settlement mode of the subscription. */
9797
9817
  settlementMode?: components['schemas']['BillingSettlementMode'];
9818
+ /**
9819
+ * @description Controls how custom-currency cost bases are selected for the new subscription.
9820
+ * @default dynamic
9821
+ */
9822
+ costBasisMode?: components['schemas']['SubscriptionCostBasisMode'];
9798
9823
  };
9799
9824
  /**
9800
9825
  * Create from plan
@@ -9818,6 +9843,11 @@ export interface components {
9818
9843
  description?: string;
9819
9844
  /** @description The settlement mode of the subscription. */
9820
9845
  settlementMode?: components['schemas']['BillingSettlementMode'];
9846
+ /**
9847
+ * @description Controls how custom-currency cost bases are selected for the new subscription.
9848
+ * @default dynamic
9849
+ */
9850
+ costBasisMode?: components['schemas']['SubscriptionCostBasisMode'];
9821
9851
  /**
9822
9852
  * @description Timing configuration for the change, when the change should take effect.
9823
9853
  * The default is immediate.
@@ -10893,11 +10923,22 @@ export interface components {
10893
10923
  plan?: components['schemas']['PlanReference'];
10894
10924
  /**
10895
10925
  * Currency
10896
- * @description The currency code of the subscription.
10897
- * Will be revised once we add multi currency support.
10926
+ * @description The fiat currency in which the subscription is invoiced.
10898
10927
  * @default USD
10899
10928
  */
10900
10929
  currency: components['schemas']['CurrencyCode'];
10930
+ /**
10931
+ * Cost basis mode
10932
+ * @description Controls whether custom-currency cost bases are resolved dynamically or pinned
10933
+ * when their currency pair is introduced to the subscription.
10934
+ * @default dynamic
10935
+ */
10936
+ readonly costBasisMode: components['schemas']['SubscriptionCostBasisMode'];
10937
+ /**
10938
+ * Pinned cost bases
10939
+ * @description Cost bases pinned to custom-currency pairs for this subscription.
10940
+ */
10941
+ readonly costBasisPins: components['schemas']['SubscriptionCostBasisPin'][];
10901
10942
  /**
10902
10943
  * Billing cadence
10903
10944
  * Format: duration
@@ -11263,6 +11304,26 @@ export interface components {
11263
11304
  /** @description Additional properties specific to the problem type may be present. */
11264
11305
  extensions?: components['schemas']['SubscriptionErrorExtensions'];
11265
11306
  };
11307
+ /**
11308
+ * @description Controls how custom-currency cost bases are selected for the subscription.
11309
+ * @enum {string}
11310
+ */
11311
+ SubscriptionCostBasisMode: 'dynamic' | 'pinned';
11312
+ /** @description A cost basis pinned to a custom-currency pair for the subscription. */
11313
+ SubscriptionCostBasisPin: {
11314
+ /**
11315
+ * @description The managed custom currency ID.
11316
+ * @example 01G65Z755AFWAKHE12NY0CQ9FH
11317
+ */
11318
+ readonly customCurrencyId: string;
11319
+ /** @description The fiat currency in which the subscription is invoiced. */
11320
+ readonly invoiceCurrency: components['schemas']['CurrencyCode'];
11321
+ /**
11322
+ * @description The pinned cost basis resource ID.
11323
+ * @example 01G65Z755AFWAKHE12NY0CQ9FH
11324
+ */
11325
+ readonly costBasisId: string;
11326
+ };
11266
11327
  /** @description Create a subscription. */
11267
11328
  SubscriptionCreate: components['schemas']['PlanSubscriptionCreate'] | components['schemas']['CustomSubscriptionCreate'];
11268
11329
  /** @description Subscription edit input. */
@@ -11353,11 +11414,22 @@ export interface components {
11353
11414
  plan?: components['schemas']['PlanReference'];
11354
11415
  /**
11355
11416
  * Currency
11356
- * @description The currency code of the subscription.
11357
- * Will be revised once we add multi currency support.
11417
+ * @description The fiat currency in which the subscription is invoiced.
11358
11418
  * @default USD
11359
11419
  */
11360
11420
  currency: components['schemas']['CurrencyCode'];
11421
+ /**
11422
+ * Cost basis mode
11423
+ * @description Controls whether custom-currency cost bases are resolved dynamically or pinned
11424
+ * when their currency pair is introduced to the subscription.
11425
+ * @default dynamic
11426
+ */
11427
+ readonly costBasisMode: components['schemas']['SubscriptionCostBasisMode'];
11428
+ /**
11429
+ * Pinned cost bases
11430
+ * @description Cost bases pinned to custom-currency pairs for this subscription.
11431
+ */
11432
+ readonly costBasisPins: components['schemas']['SubscriptionCostBasisPin'][];
11361
11433
  /**
11362
11434
  * Billing cadence
11363
11435
  * Format: duration
@@ -11466,6 +11538,11 @@ export interface components {
11466
11538
  * We say "referenced by the Price" regardless of how a price itself is referenced, it colloquially makes sense to say "paying the same price for the same thing". In practice this should be derived from what's printed on the invoice line-item.
11467
11539
  */
11468
11540
  key: string;
11541
+ /**
11542
+ * Currency
11543
+ * @description The materialized currency of the item's rate card. Present for priced items.
11544
+ */
11545
+ readonly currency?: components['schemas']['CurrencyCodeOrCustom'];
11469
11546
  /** @description The feature's key (if present). */
11470
11547
  featureKey?: string;
11471
11548
  /**
@@ -12358,6 +12435,7 @@ export type CreateStripeCustomerPortalSessionParams = components['schemas']['Cre
12358
12435
  export type CreditNoteOriginalInvoiceRef = components['schemas']['CreditNoteOriginalInvoiceRef'];
12359
12436
  export type Currency = components['schemas']['Currency'];
12360
12437
  export type CurrencyCode = components['schemas']['CurrencyCode'];
12438
+ export type CurrencyCodeOrCustom = components['schemas']['CurrencyCodeOrCustom'];
12361
12439
  export type CustomInvoicingApp = components['schemas']['CustomInvoicingApp'];
12362
12440
  export type CustomInvoicingAppReplaceUpdate = components['schemas']['CustomInvoicingAppReplaceUpdate'];
12363
12441
  export type CustomInvoicingCustomerAppData = components['schemas']['CustomInvoicingCustomerAppData'];
@@ -12637,6 +12715,8 @@ export type SubscriptionBadRequestErrorResponse = components['schemas']['Subscri
12637
12715
  export type SubscriptionChange = components['schemas']['SubscriptionChange'];
12638
12716
  export type SubscriptionChangeResponseBody = components['schemas']['SubscriptionChangeResponseBody'];
12639
12717
  export type SubscriptionConflictErrorResponse = components['schemas']['SubscriptionConflictErrorResponse'];
12718
+ export type SubscriptionCostBasisMode = components['schemas']['SubscriptionCostBasisMode'];
12719
+ export type SubscriptionCostBasisPin = components['schemas']['SubscriptionCostBasisPin'];
12640
12720
  export type SubscriptionCreate = components['schemas']['SubscriptionCreate'];
12641
12721
  export type SubscriptionEdit = components['schemas']['SubscriptionEdit'];
12642
12722
  export type SubscriptionEditOperation = components['schemas']['SubscriptionEditOperation'];
@@ -26209,24 +26289,31 @@ export interface operations {
26209
26289
  content: {
26210
26290
  'application/json': {
26211
26291
  /**
26212
- * @description Timing configuration for the migration, when the migration should take effect.
26213
- * If not supported by the subscription, 400 will be returned.
26292
+ * @description When the migration takes effect: immediately, at the next billing cycle, or at an explicit billing-aligned timestamp.
26293
+ * In-place migrations may be scheduled into a later phase when the current and target phase timelines match.
26294
+ * The target plan reference is saved immediately; changed items take effect at the requested time.
26295
+ * Past or unsupported times return an error.
26214
26296
  * @default immediate
26215
26297
  */
26216
26298
  timing?: components['schemas']['SubscriptionTiming'];
26217
26299
  /**
26218
- * @description The version of the plan to migrate to.
26300
+ * @description A strictly later version of the current plan to migrate to.
26219
26301
  * If not provided, the subscription will migrate to the latest version of the current plan.
26220
26302
  */
26221
26303
  targetVersion?: number;
26222
26304
  /**
26223
- * @description The key of the phase to start the subscription in.
26224
- * If not provided, the subscription will start in the first phase of the plan.
26305
+ * @description Explicitly replace the subscription, starting in this target plan phase.
26306
+ * Providing this field always selects replacement, even if the phase matches the current one.
26307
+ * Replacement may produce billing adjustments and does not transfer addons.
26308
+ * Omit it to migrate in place; incompatible phase timelines then return an error.
26225
26309
  */
26226
26310
  startingPhase?: string;
26227
26311
  /**
26228
26312
  * Format: date-time
26229
- * @description The billing anchor of the subscription. The provided date will be normalized according to the billing cadence to the nearest recurrence before start time. If not provided, the previous subscription billing anchor will be used.
26313
+ * @description The anchor used with the plan's billing cadence to calculate billing periods.
26314
+ * If startingPhase is omitted and this anchor is omitted or equal to the existing one, migration preserves the current subscription.
26315
+ * Providing a different anchor ends the current subscription and creates a replacement.
26316
+ * The supplied anchor is preserved; it may be before or after the replacement's start time.
26230
26317
  * @example 2023-01-01T01:01:01.001Z
26231
26318
  */
26232
26319
  billingAnchor?: Date;
@@ -29,6 +29,8 @@ export declare class Subscriptions {
29
29
  customerId: string;
30
30
  plan?: import("./schemas.cjs").components["schemas"]["PlanReference"];
31
31
  currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
32
+ readonly costBasisMode: import("./schemas.cjs").components["schemas"]["SubscriptionCostBasisMode"];
33
+ readonly costBasisPins: import("./schemas.cjs").components["schemas"]["SubscriptionCostBasisPin"][];
32
34
  readonly billingCadence: string;
33
35
  readonly proRatingConfig?: import("./schemas.cjs").components["schemas"]["ProRatingConfig"];
34
36
  readonly billingAnchor: Date;
@@ -55,6 +57,8 @@ export declare class Subscriptions {
55
57
  customerId: string;
56
58
  plan?: import("./schemas.cjs").components["schemas"]["PlanReference"];
57
59
  currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
60
+ readonly costBasisMode: import("./schemas.cjs").components["schemas"]["SubscriptionCostBasisMode"];
61
+ readonly costBasisPins: import("./schemas.cjs").components["schemas"]["SubscriptionCostBasisPin"][];
58
62
  readonly billingCadence: string;
59
63
  readonly proRatingConfig?: import("./schemas.cjs").components["schemas"]["ProRatingConfig"];
60
64
  readonly billingAnchor: Date;
@@ -85,6 +89,8 @@ export declare class Subscriptions {
85
89
  customerId: string;
86
90
  plan?: import("./schemas.cjs").components["schemas"]["PlanReference"];
87
91
  currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
92
+ readonly costBasisMode: import("./schemas.cjs").components["schemas"]["SubscriptionCostBasisMode"];
93
+ readonly costBasisPins: import("./schemas.cjs").components["schemas"]["SubscriptionCostBasisPin"][];
88
94
  readonly billingCadence: string;
89
95
  readonly proRatingConfig?: import("./schemas.cjs").components["schemas"]["ProRatingConfig"];
90
96
  readonly billingAnchor: Date;
@@ -113,6 +119,8 @@ export declare class Subscriptions {
113
119
  customerId: string;
114
120
  plan?: import("./schemas.cjs").components["schemas"]["PlanReference"];
115
121
  currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
122
+ readonly costBasisMode: import("./schemas.cjs").components["schemas"]["SubscriptionCostBasisMode"];
123
+ readonly costBasisPins: import("./schemas.cjs").components["schemas"]["SubscriptionCostBasisPin"][];
116
124
  readonly billingCadence: string;
117
125
  readonly proRatingConfig?: import("./schemas.cjs").components["schemas"]["ProRatingConfig"];
118
126
  readonly billingAnchor: Date;
@@ -164,6 +172,8 @@ export declare class Subscriptions {
164
172
  customerId: string;
165
173
  plan?: import("./schemas.cjs").components["schemas"]["PlanReference"];
166
174
  currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
175
+ readonly costBasisMode: import("./schemas.cjs").components["schemas"]["SubscriptionCostBasisMode"];
176
+ readonly costBasisPins: import("./schemas.cjs").components["schemas"]["SubscriptionCostBasisPin"][];
167
177
  readonly billingCadence: string;
168
178
  readonly proRatingConfig?: import("./schemas.cjs").components["schemas"]["ProRatingConfig"];
169
179
  readonly billingAnchor: Date;