@openmeter/client 1.0.0-beta-a175676db126 → 1.0.0-beta-32d2b94f6086

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.
@@ -988,12 +988,12 @@ export const numericFieldFilter = z
988
988
  }),
989
989
  ])
990
990
  .describe('Filter by a numeric value. All properties are optional; provide exactly one to specify the comparison.');
991
- export const chargeType = z
992
- .enum(['flat_fee', 'usage_based'])
993
- .describe('Type of a charge. Values: - `flat_fee`: A fixed-amount charge. - `usage_based`: A usage-priced charge.');
994
991
  export const chargeCostBasisType = z
995
992
  .enum(['dynamic', 'pinned', 'manual'])
996
993
  .describe('Cost basis resolution mode of a charge.');
994
+ export const chargeType = z
995
+ .enum(['flat_fee', 'usage_based'])
996
+ .describe('Type of a charge. Values: - `flat_fee`: A fixed-amount charge. - `usage_based`: A usage-priced charge.');
997
997
  export const invoiceType = z
998
998
  .enum(['standard'])
999
999
  .describe('The type of a billing invoice.');
@@ -1075,6 +1075,14 @@ export const appCustomerDataExternalInvoicing = z
1075
1075
  labels: labels.optional(),
1076
1076
  })
1077
1077
  .describe('External invoicing customer data.');
1078
+ export const createChargeCostBasisDynamic = z
1079
+ .object({
1080
+ type: z
1081
+ .literal('dynamic')
1082
+ .describe('Discriminator selecting the cost basis mode.'),
1083
+ fiatCurrency: currencyCode,
1084
+ })
1085
+ .describe("Cost basis resolved at the charge's full service period start.");
1078
1086
  export const chargeCostBasisDynamic = z
1079
1087
  .object({
1080
1088
  type: z
@@ -1157,6 +1165,24 @@ export const createCurrencyCustomRequest = z
1157
1165
  code: currencyCodeCustom,
1158
1166
  })
1159
1167
  .describe('CurrencyCustom create request.');
1168
+ export const createChargeCostBasisManual = z
1169
+ .object({
1170
+ type: z
1171
+ .literal('manual')
1172
+ .describe('Discriminator selecting the cost basis mode.'),
1173
+ fiatCurrency: currencyCode.optional(),
1174
+ rate: numeric,
1175
+ })
1176
+ .describe('Cost basis with an explicit conversion rate supplied with the charge.');
1177
+ export const chargeCostBasisManual = z
1178
+ .object({
1179
+ type: z
1180
+ .literal('manual')
1181
+ .describe('Discriminator selecting the cost basis mode.'),
1182
+ fiatCurrency: currencyCode.optional(),
1183
+ rate: numeric,
1184
+ })
1185
+ .describe('Cost basis with an explicit conversion rate supplied with the charge.');
1160
1186
  export const priceFlat = z
1161
1187
  .object({
1162
1188
  type: z.literal('flat').describe('The type of the price.'),
@@ -1186,15 +1212,6 @@ export const rateCardDiscounts = z
1186
1212
  usage: numeric.optional(),
1187
1213
  })
1188
1214
  .describe('Discount configuration for a rate card.');
1189
- export const chargeCostBasisManual = z
1190
- .object({
1191
- type: z
1192
- .literal('manual')
1193
- .describe('Discriminator selecting the cost basis mode.'),
1194
- fiatCurrency: currencyCode,
1195
- rate: numeric,
1196
- })
1197
- .describe('Cost basis with an explicit conversion rate supplied with the charge.');
1198
1215
  export const totals = z
1199
1216
  .object({
1200
1217
  amount: numeric,
@@ -1379,11 +1396,29 @@ export const profileReference = z
1379
1396
  id: ulid,
1380
1397
  })
1381
1398
  .describe('Billing profile reference.');
1399
+ export const createChargeCostBasisPinned = z
1400
+ .object({
1401
+ type: z
1402
+ .literal('pinned')
1403
+ .describe('Discriminator selecting the cost basis mode.'),
1404
+ fiatCurrency: currencyCode,
1405
+ costBasisId: ulid,
1406
+ })
1407
+ .describe('Cost basis pinned to a specific cost basis resource of the custom currency.');
1382
1408
  export const createResourceReference = z
1383
1409
  .object({
1384
1410
  id: ulid,
1385
1411
  })
1386
1412
  .describe('TaxCode reference.');
1413
+ export const chargeCostBasisPinned = z
1414
+ .object({
1415
+ type: z
1416
+ .literal('pinned')
1417
+ .describe('Discriminator selecting the cost basis mode.'),
1418
+ fiatCurrency: currencyCode,
1419
+ costBasisId: ulid,
1420
+ })
1421
+ .describe('Cost basis pinned to a specific cost basis resource of the custom currency.');
1387
1422
  export const taxCodeReference = z
1388
1423
  .object({
1389
1424
  id: ulid,
@@ -1431,15 +1466,6 @@ export const subscriptionReference = z
1431
1466
  .describe('The phase of the subscription.'),
1432
1467
  })
1433
1468
  .describe('Subscription reference represents a reference to the specific subscription item this entity represents.');
1434
- export const chargeCostBasisPinned = z
1435
- .object({
1436
- type: z
1437
- .literal('pinned')
1438
- .describe('Discriminator selecting the cost basis mode.'),
1439
- fiatCurrency: currencyCode,
1440
- costBasisId: ulid,
1441
- })
1442
- .describe('Cost basis pinned to a specific cost basis resource of the custom currency.');
1443
1469
  export const appReference = z
1444
1470
  .object({
1445
1471
  id: ulid,
@@ -1574,12 +1600,6 @@ export const appStripeCreateCustomerPortalSessionResult = z
1574
1600
  .describe('The URL to redirect the customer to after they have completed their requested actions.'),
1575
1601
  })
1576
1602
  .describe('Result of creating a [Stripe Customer Portal Session](https://docs.stripe.com/api/customer_portal/sessions/object). Contains all the information needed to redirect the customer to the Stripe Customer Portal.');
1577
- export const closedPeriod = z
1578
- .object({
1579
- from: dateTime,
1580
- to: dateTime,
1581
- })
1582
- .describe('A period with defined start and end dates. The period is always inclusive at the start and exclusive at the end.');
1583
1603
  export const chargeResolvedCostBasis = z
1584
1604
  .object({
1585
1605
  fiatCurrency: currencyCode,
@@ -1588,6 +1608,12 @@ export const chargeResolvedCostBasis = z
1588
1608
  resolvedAt: dateTime,
1589
1609
  })
1590
1610
  .describe('Fiat conversion rate a custom-currency charge is invoiced at. Present once the cost basis is resolved; dynamic cost bases are exposed only after the service period has started.');
1611
+ export const closedPeriod = z
1612
+ .object({
1613
+ from: dateTime,
1614
+ to: dateTime,
1615
+ })
1616
+ .describe('A period with defined start and end dates. The period is always inclusive at the start and exclusive at the end.');
1591
1617
  export const subscriptionAddonTimelineSegment = z
1592
1618
  .object({
1593
1619
  activeFrom: dateTime,
@@ -2118,15 +2144,6 @@ export const entitlementAccessResult = z
2118
2144
  .describe('Only available for static entitlements. Config is the JSON parsable configuration of the entitlement. Useful to describe per customer configuration.'),
2119
2145
  })
2120
2146
  .describe('Entitlement access result.');
2121
- export const createCreditGrantPurchase = z
2122
- .object({
2123
- currency: currencyCode,
2124
- perUnitCostBasis: numeric.optional().default('1.0'),
2125
- availabilityPolicy: creditAvailabilityPolicy
2126
- .optional()
2127
- .default('on_creation'),
2128
- })
2129
- .describe('Purchase and payment terms of the grant.');
2130
2147
  export const rateCardMeteredEntitlement = z
2131
2148
  .object({
2132
2149
  type: z
@@ -2174,17 +2191,6 @@ export const recurringPeriod = z
2174
2191
  interval: iso8601Duration,
2175
2192
  })
2176
2193
  .describe('Recurring period with an anchor and an interval.');
2177
- export const creditGrantPurchase = z
2178
- .object({
2179
- currency: currencyCode,
2180
- perUnitCostBasis: numeric.optional().default('1.0'),
2181
- amount: numeric,
2182
- availabilityPolicy: creditAvailabilityPolicy
2183
- .optional()
2184
- .default('on_creation'),
2185
- settlementStatus: creditPurchasePaymentSettlementStatus.optional(),
2186
- })
2187
- .describe('Purchase and payment terms of the grant.');
2188
2194
  export const updateCreditGrantExternalSettlementRequest = z
2189
2195
  .object({
2190
2196
  status: creditPurchasePaymentSettlementStatus,
@@ -2709,12 +2715,26 @@ export const listPlanAddonsParamsFilter = z
2709
2715
  planCurrency: stringFieldFilter.optional(),
2710
2716
  })
2711
2717
  .describe('Filter options for listing plan add-ons.');
2718
+ export const createChargeCostBasis = z
2719
+ .discriminatedUnion('type', [
2720
+ createChargeCostBasisDynamic,
2721
+ createChargeCostBasisPinned,
2722
+ createChargeCostBasisManual,
2723
+ ])
2724
+ .describe('Cost basis selection for a custom-currency charge. The variant chosen fixes when and how the conversion rate is determined.');
2712
2725
  export const createCreditGrantTaxConfig = z
2713
2726
  .object({
2714
2727
  behavior: taxBehavior.optional(),
2715
2728
  taxCode: createResourceReference.optional(),
2716
2729
  })
2717
2730
  .describe('Tax configuration for a credit grant. Tax configuration should be provided to ensure correct revenue recognition, including for externally funded grants.');
2731
+ export const chargeCostBasis = z
2732
+ .discriminatedUnion('type', [
2733
+ chargeCostBasisDynamic,
2734
+ chargeCostBasisPinned,
2735
+ chargeCostBasisManual,
2736
+ ])
2737
+ .describe('Cost basis selection for a custom-currency charge. The variant chosen fixes when and how the conversion rate is determined.');
2718
2738
  export const creditGrantTaxConfig = z
2719
2739
  .object({
2720
2740
  behavior: taxBehavior.optional(),
@@ -2750,13 +2770,6 @@ export const updateOrganizationDefaultTaxCodesRequest = z
2750
2770
  creditGrantTaxCode: taxCodeReference.optional(),
2751
2771
  })
2752
2772
  .describe('OrganizationDefaultTaxCodes update request.');
2753
- export const chargeCostBasis = z
2754
- .discriminatedUnion('type', [
2755
- chargeCostBasisDynamic,
2756
- chargeCostBasisPinned,
2757
- chargeCostBasisManual,
2758
- ])
2759
- .describe('Cost basis selection for a custom-currency charge. The variant chosen fixes when and how the conversion rate is determined.');
2760
2773
  export const invoiceWorkflowAppsReferences = z
2761
2774
  .object({
2762
2775
  tax: appReference,
@@ -3410,92 +3423,28 @@ export const pricePagePaginatedResponse = z
3410
3423
  meta: paginatedMeta,
3411
3424
  })
3412
3425
  .describe('Page paginated response.');
3413
- export const createCreditGrantRequest = z
3414
- .object({
3415
- name: z
3416
- .string()
3417
- .min(1)
3418
- .max(256)
3419
- .describe('Display name of the resource. Between 1 and 256 characters.'),
3420
- description: z
3421
- .string()
3422
- .max(1024)
3423
- .optional()
3424
- .describe('Optional description of the resource. Maximum 1024 characters.'),
3425
- labels: createLabels.optional(),
3426
- fundingMethod: creditFundingMethod,
3427
- currency: createCurrencyCode,
3428
- amount: numeric,
3429
- purchase: createCreditGrantPurchase.optional(),
3430
- taxConfig: createCreditGrantTaxConfig.optional(),
3431
- filters: createCreditGrantFilters.optional(),
3432
- priority: z
3433
- .number()
3434
- .int()
3435
- .gte(1)
3436
- .lte(1000)
3437
- .optional()
3438
- .default(10)
3439
- .describe('Draw-down priority of the grant. Lower values have higher priority.'),
3440
- effectiveAt: dateTime.optional(),
3441
- expiresAfter: iso8601Duration.optional(),
3442
- key: externalResourceKey.optional(),
3443
- })
3444
- .describe('CreditGrant create request.');
3445
- export const creditGrant = z
3426
+ export const createCreditGrantPurchase = z
3446
3427
  .object({
3447
- id: ulid,
3448
- name: z
3449
- .string()
3450
- .min(1)
3451
- .max(256)
3452
- .describe('Display name of the resource. Between 1 and 256 characters.'),
3453
- description: z
3454
- .string()
3455
- .max(1024)
3456
- .optional()
3457
- .describe('Optional description of the resource. Maximum 1024 characters.'),
3458
- labels: labels.optional(),
3459
- createdAt: dateTime,
3460
- updatedAt: dateTime,
3461
- deletedAt: dateTime.optional(),
3462
- fundingMethod: creditFundingMethod,
3463
- currency: billingCurrencyCode,
3464
- amount: numeric,
3465
- purchase: creditGrantPurchase.optional(),
3466
- taxConfig: creditGrantTaxConfig.optional(),
3467
- invoice: creditGrantInvoiceReference.optional(),
3468
- filters: creditGrantFilters.optional(),
3469
- priority: z
3470
- .number()
3471
- .int()
3472
- .gte(1)
3473
- .lte(1000)
3428
+ currency: currencyCode,
3429
+ perUnitCostBasis: numeric.optional(),
3430
+ costBasis: createChargeCostBasis.optional(),
3431
+ availabilityPolicy: creditAvailabilityPolicy
3474
3432
  .optional()
3475
- .default(10)
3476
- .describe('Draw-down priority of the grant. Lower values have higher priority.'),
3477
- effectiveAt: dateTime.optional(),
3478
- key: externalResourceKey.optional(),
3479
- expiresAt: dateTime.optional(),
3480
- voidedAt: dateTime.optional(),
3481
- status: creditGrantStatus,
3433
+ .default('on_creation'),
3482
3434
  })
3483
- .describe('A credit grant allocates credits to a customer. Credits are drawn down against charges according to the settlement mode configured on the rate card.');
3484
- export const workflowTaxSettings = z
3435
+ .describe('Purchase and payment terms of the grant.');
3436
+ export const creditGrantPurchase = z
3485
3437
  .object({
3486
- enabled: z
3487
- .boolean()
3488
- .optional()
3489
- .default(true)
3490
- .describe('Enable automatic tax calculation when tax is supported by the app. For example, with Stripe Invoicing when enabled, tax is calculated via Stripe Tax.'),
3491
- enforced: z
3492
- .boolean()
3438
+ currency: currencyCode,
3439
+ perUnitCostBasis: numeric.optional(),
3440
+ resolvedCostBasis: chargeResolvedCostBasis.optional(),
3441
+ amount: numeric.optional(),
3442
+ availabilityPolicy: creditAvailabilityPolicy
3493
3443
  .optional()
3494
- .default(false)
3495
- .describe('Enforce tax calculation when tax is supported by the app. When enabled, the billing system will not allow to create an invoice without tax calculation. Enforcement is different per apps, for example, Stripe app requires customer to have a tax location when starting a paid subscription.'),
3496
- defaultTaxConfig: taxConfig.optional(),
3444
+ .default('on_creation'),
3445
+ settlementStatus: creditPurchasePaymentSettlementStatus.optional(),
3497
3446
  })
3498
- .describe('Tax settings for a billing workflow.');
3447
+ .describe('Purchase and payment terms of the grant.');
3499
3448
  export const createChargeFlatFeeRequest = z
3500
3449
  .object({
3501
3450
  name: z
@@ -3529,6 +3478,21 @@ export const createChargeFlatFeeRequest = z
3529
3478
  billingPeriod: closedPeriod.optional(),
3530
3479
  })
3531
3480
  .describe('Flat fee charge create request.');
3481
+ export const workflowTaxSettings = z
3482
+ .object({
3483
+ enabled: z
3484
+ .boolean()
3485
+ .optional()
3486
+ .default(true)
3487
+ .describe('Enable automatic tax calculation when tax is supported by the app. For example, with Stripe Invoicing when enabled, tax is calculated via Stripe Tax.'),
3488
+ enforced: z
3489
+ .boolean()
3490
+ .optional()
3491
+ .default(false)
3492
+ .describe('Enforce tax calculation when tax is supported by the app. When enabled, the billing system will not allow to create an invoice without tax calculation. Enforcement is different per apps, for example, Stripe app requires customer to have a tax location when starting a paid subscription.'),
3493
+ defaultTaxConfig: taxConfig.optional(),
3494
+ })
3495
+ .describe('Tax settings for a billing workflow.');
3532
3496
  export const planAddonPagePaginatedResponse = z
3533
3497
  .object({
3534
3498
  data: z.array(planAddon),
@@ -3975,12 +3939,77 @@ export const updatePrice = z
3975
3939
  updatePriceVolume,
3976
3940
  ])
3977
3941
  .describe('Price.');
3978
- export const creditGrantPagePaginatedResponse = z
3942
+ export const createCreditGrantRequest = z
3979
3943
  .object({
3980
- data: z.array(creditGrant),
3981
- meta: paginatedMeta,
3944
+ name: z
3945
+ .string()
3946
+ .min(1)
3947
+ .max(256)
3948
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
3949
+ description: z
3950
+ .string()
3951
+ .max(1024)
3952
+ .optional()
3953
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
3954
+ labels: createLabels.optional(),
3955
+ fundingMethod: creditFundingMethod,
3956
+ currency: createCurrencyCode,
3957
+ amount: numeric,
3958
+ purchase: createCreditGrantPurchase.optional(),
3959
+ taxConfig: createCreditGrantTaxConfig.optional(),
3960
+ filters: createCreditGrantFilters.optional(),
3961
+ priority: z
3962
+ .number()
3963
+ .int()
3964
+ .gte(1)
3965
+ .lte(1000)
3966
+ .optional()
3967
+ .default(10)
3968
+ .describe('Draw-down priority of the grant. Lower values have higher priority.'),
3969
+ effectiveAt: dateTime.optional(),
3970
+ expiresAfter: iso8601Duration.optional(),
3971
+ key: externalResourceKey.optional(),
3982
3972
  })
3983
- .describe('Page paginated response.');
3973
+ .describe('CreditGrant create request.');
3974
+ export const creditGrant = z
3975
+ .object({
3976
+ id: ulid,
3977
+ name: z
3978
+ .string()
3979
+ .min(1)
3980
+ .max(256)
3981
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
3982
+ description: z
3983
+ .string()
3984
+ .max(1024)
3985
+ .optional()
3986
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
3987
+ labels: labels.optional(),
3988
+ createdAt: dateTime,
3989
+ updatedAt: dateTime,
3990
+ deletedAt: dateTime.optional(),
3991
+ fundingMethod: creditFundingMethod,
3992
+ currency: billingCurrencyCode,
3993
+ amount: numeric,
3994
+ purchase: creditGrantPurchase.optional(),
3995
+ taxConfig: creditGrantTaxConfig.optional(),
3996
+ invoice: creditGrantInvoiceReference.optional(),
3997
+ filters: creditGrantFilters.optional(),
3998
+ priority: z
3999
+ .number()
4000
+ .int()
4001
+ .gte(1)
4002
+ .lte(1000)
4003
+ .optional()
4004
+ .default(10)
4005
+ .describe('Draw-down priority of the grant. Lower values have higher priority.'),
4006
+ effectiveAt: dateTime.optional(),
4007
+ key: externalResourceKey.optional(),
4008
+ expiresAt: dateTime.optional(),
4009
+ voidedAt: dateTime.optional(),
4010
+ status: creditGrantStatus,
4011
+ })
4012
+ .describe('A credit grant allocates credits to a customer. Credits are drawn down against charges according to the settlement mode configured on the rate card.');
3984
4013
  export const currencyPagePaginatedResponse = z
3985
4014
  .object({
3986
4015
  data: z.array(currency),
@@ -4200,6 +4229,12 @@ export const updateInvoiceLineRateCard = z
4200
4229
  discounts: updateDiscounts.optional(),
4201
4230
  })
4202
4231
  .describe('Rate card configuration snapshot for a usage-based invoice line.');
4232
+ export const creditGrantPagePaginatedResponse = z
4233
+ .object({
4234
+ data: z.array(creditGrant),
4235
+ meta: paginatedMeta,
4236
+ })
4237
+ .describe('Page paginated response.');
4203
4238
  export const workflow = z
4204
4239
  .object({
4205
4240
  collection: workflowCollectionSettings.optional(),
@@ -6703,12 +6738,12 @@ export const numericFieldFilterWire = z
6703
6738
  }),
6704
6739
  ])
6705
6740
  .describe('Filter by a numeric value. All properties are optional; provide exactly one to specify the comparison.');
6706
- export const chargeTypeWire = z
6707
- .enum(['flat_fee', 'usage_based'])
6708
- .describe('Type of a charge. Values: - `flat_fee`: A fixed-amount charge. - `usage_based`: A usage-priced charge.');
6709
6741
  export const chargeCostBasisTypeWire = z
6710
6742
  .enum(['dynamic', 'pinned', 'manual'])
6711
6743
  .describe('Cost basis resolution mode of a charge.');
6744
+ export const chargeTypeWire = z
6745
+ .enum(['flat_fee', 'usage_based'])
6746
+ .describe('Type of a charge. Values: - `flat_fee`: A fixed-amount charge. - `usage_based`: A usage-priced charge.');
6712
6747
  export const invoiceTypeWire = z
6713
6748
  .enum(['standard'])
6714
6749
  .describe('The type of a billing invoice.');
@@ -6790,6 +6825,14 @@ export const appCustomerDataExternalInvoicingWire = z
6790
6825
  labels: labelsWire.optional(),
6791
6826
  })
6792
6827
  .describe('External invoicing customer data.');
6828
+ export const createChargeCostBasisDynamicWire = z
6829
+ .strictObject({
6830
+ type: z
6831
+ .literal('dynamic')
6832
+ .describe('Discriminator selecting the cost basis mode.'),
6833
+ fiat_currency: currencyCodeWire,
6834
+ })
6835
+ .describe("Cost basis resolved at the charge's full service period start.");
6793
6836
  export const chargeCostBasisDynamicWire = z
6794
6837
  .strictObject({
6795
6838
  type: z
@@ -6872,6 +6915,24 @@ export const createCurrencyCustomRequestWire = z
6872
6915
  code: currencyCodeCustomWire,
6873
6916
  })
6874
6917
  .describe('CurrencyCustom create request.');
6918
+ export const createChargeCostBasisManualWire = z
6919
+ .strictObject({
6920
+ type: z
6921
+ .literal('manual')
6922
+ .describe('Discriminator selecting the cost basis mode.'),
6923
+ fiat_currency: currencyCodeWire.optional(),
6924
+ rate: numericWire,
6925
+ })
6926
+ .describe('Cost basis with an explicit conversion rate supplied with the charge.');
6927
+ export const chargeCostBasisManualWire = z
6928
+ .strictObject({
6929
+ type: z
6930
+ .literal('manual')
6931
+ .describe('Discriminator selecting the cost basis mode.'),
6932
+ fiat_currency: currencyCodeWire.optional(),
6933
+ rate: numericWire,
6934
+ })
6935
+ .describe('Cost basis with an explicit conversion rate supplied with the charge.');
6875
6936
  export const priceFlatWire = z
6876
6937
  .strictObject({
6877
6938
  type: z.literal('flat').describe('The type of the price.'),
@@ -6896,20 +6957,11 @@ export const rateCardDiscountsWire = z
6896
6957
  .number()
6897
6958
  .nonnegative()
6898
6959
  .lte(100)
6899
- .optional()
6900
- .describe('Percentage discount applied to the price (0–100).'),
6901
- usage: numericWire.optional(),
6902
- })
6903
- .describe('Discount configuration for a rate card.');
6904
- export const chargeCostBasisManualWire = z
6905
- .strictObject({
6906
- type: z
6907
- .literal('manual')
6908
- .describe('Discriminator selecting the cost basis mode.'),
6909
- fiat_currency: currencyCodeWire,
6910
- rate: numericWire,
6960
+ .optional()
6961
+ .describe('Percentage discount applied to the price (0–100).'),
6962
+ usage: numericWire.optional(),
6911
6963
  })
6912
- .describe('Cost basis with an explicit conversion rate supplied with the charge.');
6964
+ .describe('Discount configuration for a rate card.');
6913
6965
  export const totalsWire = z
6914
6966
  .strictObject({
6915
6967
  amount: numericWire,
@@ -7094,11 +7146,29 @@ export const profileReferenceWire = z
7094
7146
  id: ulidWire,
7095
7147
  })
7096
7148
  .describe('Billing profile reference.');
7149
+ export const createChargeCostBasisPinnedWire = z
7150
+ .strictObject({
7151
+ type: z
7152
+ .literal('pinned')
7153
+ .describe('Discriminator selecting the cost basis mode.'),
7154
+ fiat_currency: currencyCodeWire,
7155
+ cost_basis_id: ulidWire,
7156
+ })
7157
+ .describe('Cost basis pinned to a specific cost basis resource of the custom currency.');
7097
7158
  export const createResourceReferenceWire = z
7098
7159
  .strictObject({
7099
7160
  id: ulidWire,
7100
7161
  })
7101
7162
  .describe('TaxCode reference.');
7163
+ export const chargeCostBasisPinnedWire = z
7164
+ .strictObject({
7165
+ type: z
7166
+ .literal('pinned')
7167
+ .describe('Discriminator selecting the cost basis mode.'),
7168
+ fiat_currency: currencyCodeWire,
7169
+ cost_basis_id: ulidWire,
7170
+ })
7171
+ .describe('Cost basis pinned to a specific cost basis resource of the custom currency.');
7102
7172
  export const taxCodeReferenceWire = z
7103
7173
  .strictObject({
7104
7174
  id: ulidWire,
@@ -7146,15 +7216,6 @@ export const subscriptionReferenceWire = z
7146
7216
  .describe('The phase of the subscription.'),
7147
7217
  })
7148
7218
  .describe('Subscription reference represents a reference to the specific subscription item this entity represents.');
7149
- export const chargeCostBasisPinnedWire = z
7150
- .strictObject({
7151
- type: z
7152
- .literal('pinned')
7153
- .describe('Discriminator selecting the cost basis mode.'),
7154
- fiat_currency: currencyCodeWire,
7155
- cost_basis_id: ulidWire,
7156
- })
7157
- .describe('Cost basis pinned to a specific cost basis resource of the custom currency.');
7158
7219
  export const appReferenceWire = z
7159
7220
  .strictObject({
7160
7221
  id: ulidWire,
@@ -7288,12 +7349,6 @@ export const appStripeCreateCustomerPortalSessionResultWire = z
7288
7349
  .describe('The URL to redirect the customer to after they have completed their requested actions.'),
7289
7350
  })
7290
7351
  .describe('Result of creating a [Stripe Customer Portal Session](https://docs.stripe.com/api/customer_portal/sessions/object). Contains all the information needed to redirect the customer to the Stripe Customer Portal.');
7291
- export const closedPeriodWire = z
7292
- .strictObject({
7293
- from: dateTimeWire,
7294
- to: dateTimeWire,
7295
- })
7296
- .describe('A period with defined start and end dates. The period is always inclusive at the start and exclusive at the end.');
7297
7352
  export const chargeResolvedCostBasisWire = z
7298
7353
  .strictObject({
7299
7354
  fiat_currency: currencyCodeWire,
@@ -7302,6 +7357,12 @@ export const chargeResolvedCostBasisWire = z
7302
7357
  resolved_at: dateTimeWire,
7303
7358
  })
7304
7359
  .describe('Fiat conversion rate a custom-currency charge is invoiced at. Present once the cost basis is resolved; dynamic cost bases are exposed only after the service period has started.');
7360
+ export const closedPeriodWire = z
7361
+ .strictObject({
7362
+ from: dateTimeWire,
7363
+ to: dateTimeWire,
7364
+ })
7365
+ .describe('A period with defined start and end dates. The period is always inclusive at the start and exclusive at the end.');
7305
7366
  export const subscriptionAddonTimelineSegmentWire = z
7306
7367
  .strictObject({
7307
7368
  active_from: dateTimeWire,
@@ -7823,13 +7884,6 @@ export const entitlementAccessResultWire = z
7823
7884
  .describe('Only available for static entitlements. Config is the JSON parsable configuration of the entitlement. Useful to describe per customer configuration.'),
7824
7885
  })
7825
7886
  .describe('Entitlement access result.');
7826
- export const createCreditGrantPurchaseWire = z
7827
- .strictObject({
7828
- currency: currencyCodeWire,
7829
- per_unit_cost_basis: numericWire.optional(),
7830
- availability_policy: creditAvailabilityPolicyWire.optional(),
7831
- })
7832
- .describe('Purchase and payment terms of the grant.');
7833
7887
  export const rateCardMeteredEntitlementWire = z
7834
7888
  .strictObject({
7835
7889
  type: z
@@ -7876,15 +7930,6 @@ export const recurringPeriodWire = z
7876
7930
  interval: iso8601DurationWire,
7877
7931
  })
7878
7932
  .describe('Recurring period with an anchor and an interval.');
7879
- export const creditGrantPurchaseWire = z
7880
- .strictObject({
7881
- currency: currencyCodeWire,
7882
- per_unit_cost_basis: numericWire.optional(),
7883
- amount: numericWire,
7884
- availability_policy: creditAvailabilityPolicyWire.optional(),
7885
- settlement_status: creditPurchasePaymentSettlementStatusWire.optional(),
7886
- })
7887
- .describe('Purchase and payment terms of the grant.');
7888
7933
  export const updateCreditGrantExternalSettlementRequestWire = z
7889
7934
  .strictObject({
7890
7935
  status: creditPurchasePaymentSettlementStatusWire,
@@ -8400,12 +8445,26 @@ export const listPlanAddonsParamsFilterWire = z
8400
8445
  plan_currency: stringFieldFilterWire.optional(),
8401
8446
  })
8402
8447
  .describe('Filter options for listing plan add-ons.');
8448
+ export const createChargeCostBasisWire = z
8449
+ .discriminatedUnion('type', [
8450
+ createChargeCostBasisDynamicWire,
8451
+ createChargeCostBasisPinnedWire,
8452
+ createChargeCostBasisManualWire,
8453
+ ])
8454
+ .describe('Cost basis selection for a custom-currency charge. The variant chosen fixes when and how the conversion rate is determined.');
8403
8455
  export const createCreditGrantTaxConfigWire = z
8404
8456
  .strictObject({
8405
8457
  behavior: taxBehaviorWire.optional(),
8406
8458
  tax_code: createResourceReferenceWire.optional(),
8407
8459
  })
8408
8460
  .describe('Tax configuration for a credit grant. Tax configuration should be provided to ensure correct revenue recognition, including for externally funded grants.');
8461
+ export const chargeCostBasisWire = z
8462
+ .discriminatedUnion('type', [
8463
+ chargeCostBasisDynamicWire,
8464
+ chargeCostBasisPinnedWire,
8465
+ chargeCostBasisManualWire,
8466
+ ])
8467
+ .describe('Cost basis selection for a custom-currency charge. The variant chosen fixes when and how the conversion rate is determined.');
8409
8468
  export const creditGrantTaxConfigWire = z
8410
8469
  .strictObject({
8411
8470
  behavior: taxBehaviorWire.optional(),
@@ -8441,13 +8500,6 @@ export const updateOrganizationDefaultTaxCodesRequestWire = z
8441
8500
  credit_grant_tax_code: taxCodeReferenceWire.optional(),
8442
8501
  })
8443
8502
  .describe('OrganizationDefaultTaxCodes update request.');
8444
- export const chargeCostBasisWire = z
8445
- .discriminatedUnion('type', [
8446
- chargeCostBasisDynamicWire,
8447
- chargeCostBasisPinnedWire,
8448
- chargeCostBasisManualWire,
8449
- ])
8450
- .describe('Cost basis selection for a custom-currency charge. The variant chosen fixes when and how the conversion rate is determined.');
8451
8503
  export const invoiceWorkflowAppsReferencesWire = z
8452
8504
  .strictObject({
8453
8505
  tax: appReferenceWire,
@@ -9108,88 +9160,24 @@ export const pricePagePaginatedResponseWire = z
9108
9160
  meta: paginatedMetaWire,
9109
9161
  })
9110
9162
  .describe('Page paginated response.');
9111
- export const createCreditGrantRequestWire = z
9112
- .strictObject({
9113
- name: z
9114
- .string()
9115
- .min(1)
9116
- .max(256)
9117
- .describe('Display name of the resource. Between 1 and 256 characters.'),
9118
- description: z
9119
- .string()
9120
- .max(1024)
9121
- .optional()
9122
- .describe('Optional description of the resource. Maximum 1024 characters.'),
9123
- labels: createLabelsWire.optional(),
9124
- funding_method: creditFundingMethodWire,
9125
- currency: createCurrencyCodeWire,
9126
- amount: numericWire,
9127
- purchase: createCreditGrantPurchaseWire.optional(),
9128
- tax_config: createCreditGrantTaxConfigWire.optional(),
9129
- filters: createCreditGrantFiltersWire.optional(),
9130
- priority: z
9131
- .number()
9132
- .int()
9133
- .gte(1)
9134
- .lte(1000)
9135
- .optional()
9136
- .describe('Draw-down priority of the grant. Lower values have higher priority.'),
9137
- effective_at: dateTimeWire.optional(),
9138
- expires_after: iso8601DurationWire.optional(),
9139
- key: externalResourceKeyWire.optional(),
9140
- })
9141
- .describe('CreditGrant create request.');
9142
- export const creditGrantWire = z
9163
+ export const createCreditGrantPurchaseWire = z
9143
9164
  .strictObject({
9144
- id: ulidWire,
9145
- name: z
9146
- .string()
9147
- .min(1)
9148
- .max(256)
9149
- .describe('Display name of the resource. Between 1 and 256 characters.'),
9150
- description: z
9151
- .string()
9152
- .max(1024)
9153
- .optional()
9154
- .describe('Optional description of the resource. Maximum 1024 characters.'),
9155
- labels: labelsWire.optional(),
9156
- created_at: dateTimeWire,
9157
- updated_at: dateTimeWire,
9158
- deleted_at: dateTimeWire.optional(),
9159
- funding_method: creditFundingMethodWire,
9160
- currency: billingCurrencyCodeWire,
9161
- amount: numericWire,
9162
- purchase: creditGrantPurchaseWire.optional(),
9163
- tax_config: creditGrantTaxConfigWire.optional(),
9164
- invoice: creditGrantInvoiceReferenceWire.optional(),
9165
- filters: creditGrantFiltersWire.optional(),
9166
- priority: z
9167
- .number()
9168
- .int()
9169
- .gte(1)
9170
- .lte(1000)
9171
- .optional()
9172
- .describe('Draw-down priority of the grant. Lower values have higher priority.'),
9173
- effective_at: dateTimeWire.optional(),
9174
- key: externalResourceKeyWire.optional(),
9175
- expires_at: dateTimeWire.optional(),
9176
- voided_at: dateTimeWire.optional(),
9177
- status: creditGrantStatusWire,
9165
+ currency: currencyCodeWire,
9166
+ per_unit_cost_basis: numericWire.optional(),
9167
+ cost_basis: createChargeCostBasisWire.optional(),
9168
+ availability_policy: creditAvailabilityPolicyWire.optional(),
9178
9169
  })
9179
- .describe('A credit grant allocates credits to a customer. Credits are drawn down against charges according to the settlement mode configured on the rate card.');
9180
- export const workflowTaxSettingsWire = z
9170
+ .describe('Purchase and payment terms of the grant.');
9171
+ export const creditGrantPurchaseWire = z
9181
9172
  .strictObject({
9182
- enabled: z
9183
- .boolean()
9184
- .optional()
9185
- .describe('Enable automatic tax calculation when tax is supported by the app. For example, with Stripe Invoicing when enabled, tax is calculated via Stripe Tax.'),
9186
- enforced: z
9187
- .boolean()
9188
- .optional()
9189
- .describe('Enforce tax calculation when tax is supported by the app. When enabled, the billing system will not allow to create an invoice without tax calculation. Enforcement is different per apps, for example, Stripe app requires customer to have a tax location when starting a paid subscription.'),
9190
- default_tax_config: taxConfigWire.optional(),
9173
+ currency: currencyCodeWire,
9174
+ per_unit_cost_basis: numericWire.optional(),
9175
+ resolved_cost_basis: chargeResolvedCostBasisWire.optional(),
9176
+ amount: numericWire.optional(),
9177
+ availability_policy: creditAvailabilityPolicyWire.optional(),
9178
+ settlement_status: creditPurchasePaymentSettlementStatusWire.optional(),
9191
9179
  })
9192
- .describe('Tax settings for a billing workflow.');
9180
+ .describe('Purchase and payment terms of the grant.');
9193
9181
  export const createChargeFlatFeeRequestWire = z
9194
9182
  .strictObject({
9195
9183
  name: z
@@ -9223,6 +9211,19 @@ export const createChargeFlatFeeRequestWire = z
9223
9211
  billing_period: closedPeriodWire.optional(),
9224
9212
  })
9225
9213
  .describe('Flat fee charge create request.');
9214
+ export const workflowTaxSettingsWire = z
9215
+ .strictObject({
9216
+ enabled: z
9217
+ .boolean()
9218
+ .optional()
9219
+ .describe('Enable automatic tax calculation when tax is supported by the app. For example, with Stripe Invoicing when enabled, tax is calculated via Stripe Tax.'),
9220
+ enforced: z
9221
+ .boolean()
9222
+ .optional()
9223
+ .describe('Enforce tax calculation when tax is supported by the app. When enabled, the billing system will not allow to create an invoice without tax calculation. Enforcement is different per apps, for example, Stripe app requires customer to have a tax location when starting a paid subscription.'),
9224
+ default_tax_config: taxConfigWire.optional(),
9225
+ })
9226
+ .describe('Tax settings for a billing workflow.');
9226
9227
  export const planAddonPagePaginatedResponseWire = z
9227
9228
  .strictObject({
9228
9229
  data: z.array(planAddonWire),
@@ -9670,12 +9671,75 @@ export const updatePriceWire = z
9670
9671
  updatePriceVolumeWire,
9671
9672
  ])
9672
9673
  .describe('Price.');
9673
- export const creditGrantPagePaginatedResponseWire = z
9674
+ export const createCreditGrantRequestWire = z
9674
9675
  .strictObject({
9675
- data: z.array(creditGrantWire),
9676
- meta: paginatedMetaWire,
9676
+ name: z
9677
+ .string()
9678
+ .min(1)
9679
+ .max(256)
9680
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
9681
+ description: z
9682
+ .string()
9683
+ .max(1024)
9684
+ .optional()
9685
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
9686
+ labels: createLabelsWire.optional(),
9687
+ funding_method: creditFundingMethodWire,
9688
+ currency: createCurrencyCodeWire,
9689
+ amount: numericWire,
9690
+ purchase: createCreditGrantPurchaseWire.optional(),
9691
+ tax_config: createCreditGrantTaxConfigWire.optional(),
9692
+ filters: createCreditGrantFiltersWire.optional(),
9693
+ priority: z
9694
+ .number()
9695
+ .int()
9696
+ .gte(1)
9697
+ .lte(1000)
9698
+ .optional()
9699
+ .describe('Draw-down priority of the grant. Lower values have higher priority.'),
9700
+ effective_at: dateTimeWire.optional(),
9701
+ expires_after: iso8601DurationWire.optional(),
9702
+ key: externalResourceKeyWire.optional(),
9677
9703
  })
9678
- .describe('Page paginated response.');
9704
+ .describe('CreditGrant create request.');
9705
+ export const creditGrantWire = z
9706
+ .strictObject({
9707
+ id: ulidWire,
9708
+ name: z
9709
+ .string()
9710
+ .min(1)
9711
+ .max(256)
9712
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
9713
+ description: z
9714
+ .string()
9715
+ .max(1024)
9716
+ .optional()
9717
+ .describe('Optional description of the resource. Maximum 1024 characters.'),
9718
+ labels: labelsWire.optional(),
9719
+ created_at: dateTimeWire,
9720
+ updated_at: dateTimeWire,
9721
+ deleted_at: dateTimeWire.optional(),
9722
+ funding_method: creditFundingMethodWire,
9723
+ currency: billingCurrencyCodeWire,
9724
+ amount: numericWire,
9725
+ purchase: creditGrantPurchaseWire.optional(),
9726
+ tax_config: creditGrantTaxConfigWire.optional(),
9727
+ invoice: creditGrantInvoiceReferenceWire.optional(),
9728
+ filters: creditGrantFiltersWire.optional(),
9729
+ priority: z
9730
+ .number()
9731
+ .int()
9732
+ .gte(1)
9733
+ .lte(1000)
9734
+ .optional()
9735
+ .describe('Draw-down priority of the grant. Lower values have higher priority.'),
9736
+ effective_at: dateTimeWire.optional(),
9737
+ key: externalResourceKeyWire.optional(),
9738
+ expires_at: dateTimeWire.optional(),
9739
+ voided_at: dateTimeWire.optional(),
9740
+ status: creditGrantStatusWire,
9741
+ })
9742
+ .describe('A credit grant allocates credits to a customer. Credits are drawn down against charges according to the settlement mode configured on the rate card.');
9679
9743
  export const currencyPagePaginatedResponseWire = z
9680
9744
  .strictObject({
9681
9745
  data: z.array(currencyWire),
@@ -9896,6 +9960,12 @@ export const updateInvoiceLineRateCardWire = z
9896
9960
  discounts: updateDiscountsWire.optional(),
9897
9961
  })
9898
9962
  .describe('Rate card configuration snapshot for a usage-based invoice line.');
9963
+ export const creditGrantPagePaginatedResponseWire = z
9964
+ .strictObject({
9965
+ data: z.array(creditGrantWire),
9966
+ meta: paginatedMetaWire,
9967
+ })
9968
+ .describe('Page paginated response.');
9899
9969
  export const workflowWire = z
9900
9970
  .strictObject({
9901
9971
  collection: workflowCollectionSettingsWire.optional(),