@openmeter/client 1.0.0-beta-d6d4cd22dad8 → 1.0.0-beta-84dd0f294013

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.
@@ -471,6 +471,9 @@ export const priceFree = z
471
471
  type: z.literal('free').describe('The type of the price.'),
472
472
  })
473
473
  .describe('Free price.');
474
+ export const subscriptionCostBasisMode = z
475
+ .enum(['dynamic', 'pinned'])
476
+ .describe('Controls how custom-currency cost bases are selected for the subscription.');
474
477
  export const subscriptionStatus = z
475
478
  .enum(['active', 'inactive', 'canceled', 'scheduled'])
476
479
  .describe('Subscription status.');
@@ -1321,6 +1324,13 @@ export const subscriptionReference = z
1321
1324
  .describe('The phase of the subscription.'),
1322
1325
  })
1323
1326
  .describe('Subscription reference represents a reference to the specific subscription item this entity represents.');
1327
+ export const subscriptionCostBasisPin = z
1328
+ .object({
1329
+ customCurrencyId: ulid,
1330
+ invoiceCurrency: currencyCode,
1331
+ costBasisId: ulid,
1332
+ })
1333
+ .describe('A cost basis pinned to a custom-currency pair for the subscription.');
1324
1334
  export const addonReference = z
1325
1335
  .object({
1326
1336
  id: ulid,
@@ -2044,6 +2054,11 @@ export const voidCreditGrantRequest = z
2044
2054
  .default('none'),
2045
2055
  })
2046
2056
  .describe('Request body for voiding a credit grant.');
2057
+ export const rateCardProrationConfiguration = z
2058
+ .object({
2059
+ mode: rateCardProrationMode,
2060
+ })
2061
+ .describe('The proration configuration of the rate card.');
2047
2062
  export const subscriptionCreate = z
2048
2063
  .object({
2049
2064
  labels: labels.optional(),
@@ -2066,27 +2081,9 @@ export const subscriptionCreate = z
2066
2081
  })
2067
2082
  .describe('The plan reference of the subscription.'),
2068
2083
  billingAnchor: dateTime.optional(),
2084
+ costBasisMode: subscriptionCostBasisMode.optional().default('dynamic'),
2069
2085
  })
2070
2086
  .describe('Subscription create request.');
2071
- export const rateCardProrationConfiguration = z
2072
- .object({
2073
- mode: rateCardProrationMode,
2074
- })
2075
- .describe('The proration configuration of the rate card.');
2076
- export const subscription = z
2077
- .object({
2078
- id: ulid,
2079
- labels: labels.optional(),
2080
- createdAt: dateTime,
2081
- updatedAt: dateTime,
2082
- deletedAt: dateTime.optional(),
2083
- customerId: ulid,
2084
- planId: ulid.optional(),
2085
- billingAnchor: dateTime,
2086
- status: subscriptionStatus,
2087
- settlementMode: settlementMode.optional(),
2088
- })
2089
- .describe('Subscription.');
2090
2087
  export const subscriptionEditTiming = z
2091
2088
  .union([subscriptionEditTimingEnum, dateTime])
2092
2089
  .describe('Subscription edit timing defined when the changes should take effect. If the provided configuration is not supported by the subscription, an error will be returned.');
@@ -2566,6 +2563,25 @@ export const updateOrganizationDefaultTaxCodesRequest = z
2566
2563
  creditGrantTaxCode: taxCodeReference.optional(),
2567
2564
  })
2568
2565
  .describe('OrganizationDefaultTaxCodes update request.');
2566
+ export const subscription = z
2567
+ .object({
2568
+ id: ulid,
2569
+ labels: labels.optional(),
2570
+ createdAt: dateTime,
2571
+ updatedAt: dateTime,
2572
+ deletedAt: dateTime.optional(),
2573
+ customerId: ulid,
2574
+ planId: ulid.optional(),
2575
+ invoiceCurrency: currencyCode,
2576
+ costBasisMode: subscriptionCostBasisMode.default('dynamic'),
2577
+ costBasisPins: z
2578
+ .array(subscriptionCostBasisPin)
2579
+ .describe('Cost bases pinned to custom-currency pairs for this subscription.'),
2580
+ billingAnchor: dateTime,
2581
+ status: subscriptionStatus,
2582
+ settlementMode: settlementMode.optional(),
2583
+ })
2584
+ .describe('Subscription.');
2569
2585
  export const planAddon = z
2570
2586
  .object({
2571
2587
  id: ulid,
@@ -2945,18 +2961,6 @@ export const chargeFlatFeeSystemIntent = z
2945
2961
  deletedAt: dateTime.optional(),
2946
2962
  })
2947
2963
  .describe('Flat fee intent fields from the system lifecycle controller shadowed by a manual override.');
2948
- export const subscriptionPagePaginatedResponse = z
2949
- .object({
2950
- data: z.array(subscription),
2951
- meta: paginatedMeta,
2952
- })
2953
- .describe('Page paginated response.');
2954
- export const subscriptionChangeResponse = z
2955
- .object({
2956
- current: subscription,
2957
- next: subscription,
2958
- })
2959
- .describe('Response for changing a subscription.');
2960
2964
  export const subscriptionCancel = z
2961
2965
  .object({
2962
2966
  timing: subscriptionEditTiming.optional().default('immediate'),
@@ -2984,6 +2988,7 @@ export const subscriptionChange = z
2984
2988
  })
2985
2989
  .describe('The plan reference of the subscription.'),
2986
2990
  billingAnchor: dateTime.optional(),
2991
+ costBasisMode: subscriptionCostBasisMode.optional().default('dynamic'),
2987
2992
  timing: subscriptionEditTiming,
2988
2993
  })
2989
2994
  .describe('Request for changing a subscription.');
@@ -3311,6 +3316,18 @@ export const workflowTaxSettings = z
3311
3316
  defaultTaxConfig: taxConfig.optional(),
3312
3317
  })
3313
3318
  .describe('Tax settings for a billing workflow.');
3319
+ export const subscriptionPagePaginatedResponse = z
3320
+ .object({
3321
+ data: z.array(subscription),
3322
+ meta: paginatedMeta,
3323
+ })
3324
+ .describe('Page paginated response.');
3325
+ export const subscriptionChangeResponse = z
3326
+ .object({
3327
+ current: subscription,
3328
+ next: subscription,
3329
+ })
3330
+ .describe('Response for changing a subscription.');
3314
3331
  export const planAddonPagePaginatedResponse = z
3315
3332
  .object({
3316
3333
  data: z.array(planAddon),
@@ -5606,6 +5623,9 @@ export const priceFreeWire = z
5606
5623
  type: z.literal('free').describe('The type of the price.'),
5607
5624
  })
5608
5625
  .describe('Free price.');
5626
+ export const subscriptionCostBasisModeWire = z
5627
+ .enum(['dynamic', 'pinned'])
5628
+ .describe('Controls how custom-currency cost bases are selected for the subscription.');
5609
5629
  export const subscriptionStatusWire = z
5610
5630
  .enum(['active', 'inactive', 'canceled', 'scheduled'])
5611
5631
  .describe('Subscription status.');
@@ -6450,6 +6470,13 @@ export const subscriptionReferenceWire = z
6450
6470
  .describe('The phase of the subscription.'),
6451
6471
  })
6452
6472
  .describe('Subscription reference represents a reference to the specific subscription item this entity represents.');
6473
+ export const subscriptionCostBasisPinWire = z
6474
+ .strictObject({
6475
+ custom_currency_id: ulidWire,
6476
+ invoice_currency: currencyCodeWire,
6477
+ cost_basis_id: ulidWire,
6478
+ })
6479
+ .describe('A cost basis pinned to a custom-currency pair for the subscription.');
6453
6480
  export const addonReferenceWire = z
6454
6481
  .strictObject({
6455
6482
  id: ulidWire,
@@ -7156,6 +7183,11 @@ export const voidCreditGrantRequestWire = z
7156
7183
  payment_adjustment: creditGrantVoidPaymentAdjustmentWire.optional(),
7157
7184
  })
7158
7185
  .describe('Request body for voiding a credit grant.');
7186
+ export const rateCardProrationConfigurationWire = z
7187
+ .strictObject({
7188
+ mode: rateCardProrationModeWire,
7189
+ })
7190
+ .describe('The proration configuration of the rate card.');
7159
7191
  export const subscriptionCreateWire = z
7160
7192
  .strictObject({
7161
7193
  labels: labelsWire.optional(),
@@ -7178,27 +7210,9 @@ export const subscriptionCreateWire = z
7178
7210
  })
7179
7211
  .describe('The plan reference of the subscription.'),
7180
7212
  billing_anchor: dateTimeWire.optional(),
7213
+ cost_basis_mode: subscriptionCostBasisModeWire.optional(),
7181
7214
  })
7182
7215
  .describe('Subscription create request.');
7183
- export const rateCardProrationConfigurationWire = z
7184
- .strictObject({
7185
- mode: rateCardProrationModeWire,
7186
- })
7187
- .describe('The proration configuration of the rate card.');
7188
- export const subscriptionWire = z
7189
- .strictObject({
7190
- id: ulidWire,
7191
- labels: labelsWire.optional(),
7192
- created_at: dateTimeWire,
7193
- updated_at: dateTimeWire,
7194
- deleted_at: dateTimeWire.optional(),
7195
- customer_id: ulidWire,
7196
- plan_id: ulidWire.optional(),
7197
- billing_anchor: dateTimeWire,
7198
- status: subscriptionStatusWire,
7199
- settlement_mode: settlementModeWire.optional(),
7200
- })
7201
- .describe('Subscription.');
7202
7216
  export const subscriptionEditTimingWire = z
7203
7217
  .union([subscriptionEditTimingEnumWire, dateTimeWire])
7204
7218
  .describe('Subscription edit timing defined when the changes should take effect. If the provided configuration is not supported by the subscription, an error will be returned.');
@@ -7671,6 +7685,25 @@ export const updateOrganizationDefaultTaxCodesRequestWire = z
7671
7685
  credit_grant_tax_code: taxCodeReferenceWire.optional(),
7672
7686
  })
7673
7687
  .describe('OrganizationDefaultTaxCodes update request.');
7688
+ export const subscriptionWire = z
7689
+ .strictObject({
7690
+ id: ulidWire,
7691
+ labels: labelsWire.optional(),
7692
+ created_at: dateTimeWire,
7693
+ updated_at: dateTimeWire,
7694
+ deleted_at: dateTimeWire.optional(),
7695
+ customer_id: ulidWire,
7696
+ plan_id: ulidWire.optional(),
7697
+ invoice_currency: currencyCodeWire,
7698
+ cost_basis_mode: subscriptionCostBasisModeWire,
7699
+ cost_basis_pins: z
7700
+ .array(subscriptionCostBasisPinWire)
7701
+ .describe('Cost bases pinned to custom-currency pairs for this subscription.'),
7702
+ billing_anchor: dateTimeWire,
7703
+ status: subscriptionStatusWire,
7704
+ settlement_mode: settlementModeWire.optional(),
7705
+ })
7706
+ .describe('Subscription.');
7674
7707
  export const planAddonWire = z
7675
7708
  .strictObject({
7676
7709
  id: ulidWire,
@@ -8050,18 +8083,6 @@ export const chargeFlatFeeSystemIntentWire = z
8050
8083
  deleted_at: dateTimeWire.optional(),
8051
8084
  })
8052
8085
  .describe('Flat fee intent fields from the system lifecycle controller shadowed by a manual override.');
8053
- export const subscriptionPagePaginatedResponseWire = z
8054
- .strictObject({
8055
- data: z.array(subscriptionWire),
8056
- meta: paginatedMetaWire,
8057
- })
8058
- .describe('Page paginated response.');
8059
- export const subscriptionChangeResponseWire = z
8060
- .strictObject({
8061
- current: subscriptionWire,
8062
- next: subscriptionWire,
8063
- })
8064
- .describe('Response for changing a subscription.');
8065
8086
  export const subscriptionCancelWire = z
8066
8087
  .strictObject({
8067
8088
  timing: subscriptionEditTimingWire.optional(),
@@ -8089,6 +8110,7 @@ export const subscriptionChangeWire = z
8089
8110
  })
8090
8111
  .describe('The plan reference of the subscription.'),
8091
8112
  billing_anchor: dateTimeWire.optional(),
8113
+ cost_basis_mode: subscriptionCostBasisModeWire.optional(),
8092
8114
  timing: subscriptionEditTimingWire,
8093
8115
  })
8094
8116
  .describe('Request for changing a subscription.');
@@ -8419,6 +8441,18 @@ export const workflowTaxSettingsWire = z
8419
8441
  default_tax_config: taxConfigWire.optional(),
8420
8442
  })
8421
8443
  .describe('Tax settings for a billing workflow.');
8444
+ export const subscriptionPagePaginatedResponseWire = z
8445
+ .strictObject({
8446
+ data: z.array(subscriptionWire),
8447
+ meta: paginatedMetaWire,
8448
+ })
8449
+ .describe('Page paginated response.');
8450
+ export const subscriptionChangeResponseWire = z
8451
+ .strictObject({
8452
+ current: subscriptionWire,
8453
+ next: subscriptionWire,
8454
+ })
8455
+ .describe('Response for changing a subscription.');
8422
8456
  export const planAddonPagePaginatedResponseWire = z
8423
8457
  .strictObject({
8424
8458
  data: z.array(planAddonWire),
@@ -822,6 +822,15 @@ export interface SubscriptionReference {
822
822
  };
823
823
  };
824
824
  }
825
+ /** A cost basis pinned to a custom-currency pair for the subscription. */
826
+ export interface SubscriptionCostBasisPin {
827
+ /** The managed custom currency ID. */
828
+ customCurrencyId: string;
829
+ /** The fiat currency in which the subscription is invoiced. */
830
+ invoiceCurrency: string;
831
+ /** The pinned cost basis resource ID. */
832
+ costBasisId: string;
833
+ }
825
834
  /** Addon reference. */
826
835
  export interface AddonReference {
827
836
  id: string;
@@ -1745,6 +1754,11 @@ export interface VoidCreditGrantRequest {
1745
1754
  */
1746
1755
  paymentAdjustment: 'none';
1747
1756
  }
1757
+ /** The proration configuration of the rate card. */
1758
+ export interface RateCardProrationConfiguration {
1759
+ /** The proration mode of the rate card. */
1760
+ mode: 'no_proration' | 'prorate_prices';
1761
+ }
1748
1762
  /** Subscription create request. */
1749
1763
  export interface SubscriptionCreate {
1750
1764
  labels?: Labels;
@@ -1782,48 +1796,8 @@ export interface SubscriptionCreate {
1782
1796
  * creation time as the billing anchor.
1783
1797
  */
1784
1798
  billingAnchor?: Date;
1785
- }
1786
- /** The proration configuration of the rate card. */
1787
- export interface RateCardProrationConfiguration {
1788
- /** The proration mode of the rate card. */
1789
- mode: 'no_proration' | 'prorate_prices';
1790
- }
1791
- /** Subscription. */
1792
- export interface Subscription {
1793
- id: string;
1794
- labels?: Labels;
1795
- /** An ISO-8601 timestamp representation of entity creation date. */
1796
- createdAt: Date;
1797
- /** An ISO-8601 timestamp representation of entity last update date. */
1798
- updatedAt: Date;
1799
- /** An ISO-8601 timestamp representation of entity deletion date. */
1800
- deletedAt?: Date;
1801
- /** The customer ID of the subscription. */
1802
- customerId: string;
1803
- /** The plan ID of the subscription. Set if subscription is created from a plan. */
1804
- planId?: string;
1805
- /**
1806
- * A billing anchor is the fixed point in time that determines the subscription's
1807
- * recurring billing cycle. It affects when charges occur and how prorations are
1808
- * calculated. Common anchors:
1809
- *
1810
- * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
1811
- * - Subscription anniversary (day customer signed up)
1812
- * - Custom date (customer-specified day)
1813
- */
1814
- billingAnchor: Date;
1815
- /** The status of the subscription. */
1816
- status: 'active' | 'inactive' | 'canceled' | 'scheduled';
1817
- /**
1818
- * Settlement mode for billing.
1819
- *
1820
- * Values:
1821
- *
1822
- * - `credit_then_invoice`: Credits are applied first, then any remainder is
1823
- * invoiced.
1824
- * - `credit_only`: Usage is settled exclusively against credits.
1825
- */
1826
- settlementMode?: 'credit_then_invoice' | 'credit_only';
1799
+ /** Controls how custom-currency cost bases are selected for the subscription. */
1800
+ costBasisMode: 'dynamic' | 'pinned';
1827
1801
  }
1828
1802
  /**
1829
1803
  * Unit conversion configuration.
@@ -2502,6 +2476,52 @@ export interface UpdateOrganizationDefaultTaxCodesRequest {
2502
2476
  /** Default tax code for credit grants. */
2503
2477
  creditGrantTaxCode?: TaxCodeReference;
2504
2478
  }
2479
+ /** Subscription. */
2480
+ export interface Subscription {
2481
+ id: string;
2482
+ labels?: Labels;
2483
+ /** An ISO-8601 timestamp representation of entity creation date. */
2484
+ createdAt: Date;
2485
+ /** An ISO-8601 timestamp representation of entity last update date. */
2486
+ updatedAt: Date;
2487
+ /** An ISO-8601 timestamp representation of entity deletion date. */
2488
+ deletedAt?: Date;
2489
+ /** The customer ID of the subscription. */
2490
+ customerId: string;
2491
+ /** The plan ID of the subscription. Set if subscription is created from a plan. */
2492
+ planId?: string;
2493
+ /** The fiat currency in which the subscription is invoiced. */
2494
+ invoiceCurrency: string;
2495
+ /**
2496
+ * Controls whether custom-currency cost bases are resolved dynamically or pinned
2497
+ * when their currency pair is introduced to the subscription.
2498
+ */
2499
+ costBasisMode: 'dynamic' | 'pinned';
2500
+ /** Cost bases pinned to custom-currency pairs for this subscription. */
2501
+ costBasisPins: SubscriptionCostBasisPin[];
2502
+ /**
2503
+ * A billing anchor is the fixed point in time that determines the subscription's
2504
+ * recurring billing cycle. It affects when charges occur and how prorations are
2505
+ * calculated. Common anchors:
2506
+ *
2507
+ * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
2508
+ * - Subscription anniversary (day customer signed up)
2509
+ * - Custom date (customer-specified day)
2510
+ */
2511
+ billingAnchor: Date;
2512
+ /** The status of the subscription. */
2513
+ status: 'active' | 'inactive' | 'canceled' | 'scheduled';
2514
+ /**
2515
+ * Settlement mode for billing.
2516
+ *
2517
+ * Values:
2518
+ *
2519
+ * - `credit_then_invoice`: Credits are applied first, then any remainder is
2520
+ * invoiced.
2521
+ * - `credit_only`: Usage is settled exclusively against credits.
2522
+ */
2523
+ settlementMode?: 'credit_then_invoice' | 'credit_only';
2524
+ }
2505
2525
  /**
2506
2526
  * PlanAddon represents an association between a plan and an add-on, controlling
2507
2527
  * which add-ons are available for purchase within a plan.
@@ -2960,18 +2980,6 @@ export interface ChargeFlatFeeSystemIntent {
2960
2980
  */
2961
2981
  deletedAt?: Date;
2962
2982
  }
2963
- /** Page paginated response. */
2964
- export interface SubscriptionPagePaginatedResponse {
2965
- data: Subscription[];
2966
- meta: PaginatedMeta;
2967
- }
2968
- /** Response for changing a subscription. */
2969
- export interface SubscriptionChangeResponse {
2970
- /** The current subscription before the change. */
2971
- current: Subscription;
2972
- /** The new state of the subscription after the change. */
2973
- next: Subscription;
2974
- }
2975
2983
  /** Request for canceling a subscription. */
2976
2984
  export interface SubscriptionCancel {
2977
2985
  /** If not provided the subscription is canceled immediately. */
@@ -3014,6 +3022,8 @@ export interface SubscriptionChange {
3014
3022
  * creation time as the billing anchor.
3015
3023
  */
3016
3024
  billingAnchor?: Date;
3025
+ /** Controls how custom-currency cost bases are selected for the subscription. */
3026
+ costBasisMode: 'dynamic' | 'pinned';
3017
3027
  /**
3018
3028
  * Timing configuration for the change, when the change should take effect. For
3019
3029
  * changing a subscription, the accepted values depend on the subscription
@@ -3477,6 +3487,18 @@ export interface WorkflowTaxSettings {
3477
3487
  defaultTaxConfig?: TaxConfig;
3478
3488
  }
3479
3489
  /** Page paginated response. */
3490
+ export interface SubscriptionPagePaginatedResponse {
3491
+ data: Subscription[];
3492
+ meta: PaginatedMeta;
3493
+ }
3494
+ /** Response for changing a subscription. */
3495
+ export interface SubscriptionChangeResponse {
3496
+ /** The current subscription before the change. */
3497
+ current: Subscription;
3498
+ /** The new state of the subscription after the change. */
3499
+ next: Subscription;
3500
+ }
3501
+ /** Page paginated response. */
3480
3502
  export interface PlanAddonPagePaginatedResponse {
3481
3503
  data: PlanAddon[];
3482
3504
  meta: PaginatedMeta;
@@ -5513,6 +5535,46 @@ export interface VoidCreditGrantRequestInput {
5513
5535
  */
5514
5536
  paymentAdjustment?: 'none';
5515
5537
  }
5538
+ /** Subscription create request. */
5539
+ export interface SubscriptionCreateInput {
5540
+ labels?: Labels;
5541
+ /**
5542
+ * Settlement mode for billing.
5543
+ *
5544
+ * Values:
5545
+ *
5546
+ * - `credit_then_invoice`: Credits are applied first, then any remainder is
5547
+ * invoiced.
5548
+ * - `credit_only`: Usage is settled exclusively against credits.
5549
+ */
5550
+ settlementMode?: 'credit_then_invoice' | 'credit_only';
5551
+ /** The customer to create the subscription for. */
5552
+ customer: {
5553
+ id?: string;
5554
+ key?: string;
5555
+ };
5556
+ /** The plan reference of the subscription. */
5557
+ plan: {
5558
+ id?: string;
5559
+ key?: string;
5560
+ version?: number;
5561
+ };
5562
+ /**
5563
+ * A billing anchor is the fixed point in time that determines the subscription's
5564
+ * recurring billing cycle. It affects when charges occur and how prorations are
5565
+ * calculated. Common anchors:
5566
+ *
5567
+ * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
5568
+ * - Subscription anniversary (day customer signed up)
5569
+ * - Custom date (customer-specified day)
5570
+ *
5571
+ * If not provided, the subscription will be created with the subscription's
5572
+ * creation time as the billing anchor.
5573
+ */
5574
+ billingAnchor?: Date;
5575
+ /** Controls how custom-currency cost bases are selected for the subscription. */
5576
+ costBasisMode?: 'dynamic' | 'pinned';
5577
+ }
5516
5578
  /**
5517
5579
  * Unit conversion configuration.
5518
5580
  *
@@ -5594,6 +5656,52 @@ export interface GovernanceQueryRequestInput {
5594
5656
  customer: GovernanceQueryRequestCustomers;
5595
5657
  feature?: GovernanceQueryRequestFeatures;
5596
5658
  }
5659
+ /** Subscription. */
5660
+ export interface SubscriptionInput {
5661
+ id: string;
5662
+ labels?: Labels;
5663
+ /** An ISO-8601 timestamp representation of entity creation date. */
5664
+ createdAt: Date;
5665
+ /** An ISO-8601 timestamp representation of entity last update date. */
5666
+ updatedAt: Date;
5667
+ /** An ISO-8601 timestamp representation of entity deletion date. */
5668
+ deletedAt?: Date;
5669
+ /** The customer ID of the subscription. */
5670
+ customerId: string;
5671
+ /** The plan ID of the subscription. Set if subscription is created from a plan. */
5672
+ planId?: string;
5673
+ /** The fiat currency in which the subscription is invoiced. */
5674
+ invoiceCurrency: string;
5675
+ /**
5676
+ * Controls whether custom-currency cost bases are resolved dynamically or pinned
5677
+ * when their currency pair is introduced to the subscription.
5678
+ */
5679
+ costBasisMode?: 'dynamic' | 'pinned';
5680
+ /** Cost bases pinned to custom-currency pairs for this subscription. */
5681
+ costBasisPins: SubscriptionCostBasisPin[];
5682
+ /**
5683
+ * A billing anchor is the fixed point in time that determines the subscription's
5684
+ * recurring billing cycle. It affects when charges occur and how prorations are
5685
+ * calculated. Common anchors:
5686
+ *
5687
+ * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
5688
+ * - Subscription anniversary (day customer signed up)
5689
+ * - Custom date (customer-specified day)
5690
+ */
5691
+ billingAnchor: Date;
5692
+ /** The status of the subscription. */
5693
+ status: 'active' | 'inactive' | 'canceled' | 'scheduled';
5694
+ /**
5695
+ * Settlement mode for billing.
5696
+ *
5697
+ * Values:
5698
+ *
5699
+ * - `credit_then_invoice`: Credits are applied first, then any remainder is
5700
+ * invoiced.
5701
+ * - `credit_only`: Usage is settled exclusively against credits.
5702
+ */
5703
+ settlementMode?: 'credit_then_invoice' | 'credit_only';
5704
+ }
5597
5705
  /** An ingested metering event with ingestion metadata. */
5598
5706
  export interface IngestedEventInput {
5599
5707
  /** The original event ingested. */
@@ -5612,6 +5720,52 @@ export interface SubscriptionCancelInput {
5612
5720
  /** If not provided the subscription is canceled immediately. */
5613
5721
  timing?: SubscriptionEditTiming;
5614
5722
  }
5723
+ /** Request for changing a subscription. */
5724
+ export interface SubscriptionChangeInput {
5725
+ labels?: Labels;
5726
+ /**
5727
+ * Settlement mode for billing.
5728
+ *
5729
+ * Values:
5730
+ *
5731
+ * - `credit_then_invoice`: Credits are applied first, then any remainder is
5732
+ * invoiced.
5733
+ * - `credit_only`: Usage is settled exclusively against credits.
5734
+ */
5735
+ settlementMode?: 'credit_then_invoice' | 'credit_only';
5736
+ /** The customer to create the subscription for. */
5737
+ customer: {
5738
+ id?: string;
5739
+ key?: string;
5740
+ };
5741
+ /** The plan reference of the subscription. */
5742
+ plan: {
5743
+ id?: string;
5744
+ key?: string;
5745
+ version?: number;
5746
+ };
5747
+ /**
5748
+ * A billing anchor is the fixed point in time that determines the subscription's
5749
+ * recurring billing cycle. It affects when charges occur and how prorations are
5750
+ * calculated. Common anchors:
5751
+ *
5752
+ * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
5753
+ * - Subscription anniversary (day customer signed up)
5754
+ * - Custom date (customer-specified day)
5755
+ *
5756
+ * If not provided, the subscription will be created with the subscription's
5757
+ * creation time as the billing anchor.
5758
+ */
5759
+ billingAnchor?: Date;
5760
+ /** Controls how custom-currency cost bases are selected for the subscription. */
5761
+ costBasisMode?: 'dynamic' | 'pinned';
5762
+ /**
5763
+ * Timing configuration for the change, when the change should take effect. For
5764
+ * changing a subscription, the accepted values depend on the subscription
5765
+ * configuration.
5766
+ */
5767
+ timing: SubscriptionEditTiming;
5768
+ }
5615
5769
  /**
5616
5770
  * Invoice-level snapshot of the workflow configuration.
5617
5771
  *
@@ -5792,6 +5946,18 @@ export interface WorkflowTaxSettingsInput {
5792
5946
  */
5793
5947
  defaultTaxConfig?: TaxConfig;
5794
5948
  }
5949
+ /** Page paginated response. */
5950
+ export interface SubscriptionPagePaginatedResponseInput {
5951
+ data: SubscriptionInput[];
5952
+ meta: PaginatedMeta;
5953
+ }
5954
+ /** Response for changing a subscription. */
5955
+ export interface SubscriptionChangeResponseInput {
5956
+ /** The current subscription before the change. */
5957
+ current: SubscriptionInput;
5958
+ /** The new state of the subscription after the change. */
5959
+ next: SubscriptionInput;
5960
+ }
5795
5961
  /** Cursor paginated response. */
5796
5962
  export interface IngestedEventPaginatedResponseInput {
5797
5963
  data: IngestedEventInput[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmeter/client",
3
- "version": "1.0.0-beta-d6d4cd22dad8",
3
+ "version": "1.0.0-beta-84dd0f294013",
4
4
  "description": "Official TypeScript SDK for the OpenMeter API — usage metering and billing",
5
5
  "keywords": [
6
6
  "openmeter",