@paygentic/sdk 0.7.20 → 0.8.0

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.
Files changed (100) hide show
  1. package/dist/commonjs/funcs/pricesCreate.js +2 -2
  2. package/dist/commonjs/funcs/pricesCreate.js.map +1 -1
  3. package/dist/commonjs/lib/config.d.ts +2 -2
  4. package/dist/commonjs/lib/config.js +2 -2
  5. package/dist/commonjs/lib/config.js.map +1 -1
  6. package/dist/commonjs/models/index.d.ts +2 -0
  7. package/dist/commonjs/models/index.d.ts.map +1 -1
  8. package/dist/commonjs/models/index.js +2 -0
  9. package/dist/commonjs/models/index.js.map +1 -1
  10. package/dist/commonjs/models/meteredentitlementdetail.d.ts +9 -5
  11. package/dist/commonjs/models/meteredentitlementdetail.d.ts.map +1 -1
  12. package/dist/commonjs/models/meteredentitlementdetail.js +1 -0
  13. package/dist/commonjs/models/meteredentitlementdetail.js.map +1 -1
  14. package/dist/commonjs/models/meteredentitlementlistitem.d.ts +9 -5
  15. package/dist/commonjs/models/meteredentitlementlistitem.d.ts.map +1 -1
  16. package/dist/commonjs/models/meteredentitlementlistitem.js +1 -0
  17. package/dist/commonjs/models/meteredentitlementlistitem.js.map +1 -1
  18. package/dist/commonjs/models/operations/createplan.d.ts +3 -3
  19. package/dist/commonjs/models/operations/createplan.js +2 -2
  20. package/dist/commonjs/models/operations/createprice.d.ts +7 -17
  21. package/dist/commonjs/models/operations/createprice.d.ts.map +1 -1
  22. package/dist/commonjs/models/operations/createprice.js +3 -13
  23. package/dist/commonjs/models/operations/createprice.js.map +1 -1
  24. package/dist/commonjs/models/operations/updateprice.d.ts +7 -17
  25. package/dist/commonjs/models/operations/updateprice.d.ts.map +1 -1
  26. package/dist/commonjs/models/operations/updateprice.js +3 -13
  27. package/dist/commonjs/models/operations/updateprice.js.map +1 -1
  28. package/dist/commonjs/models/price.d.ts +4 -4
  29. package/dist/commonjs/models/price.d.ts.map +1 -1
  30. package/dist/commonjs/models/price.js +5 -5
  31. package/dist/commonjs/models/price.js.map +1 -1
  32. package/dist/commonjs/models/pricemodel.d.ts +18 -0
  33. package/dist/commonjs/models/pricemodel.d.ts.map +1 -0
  34. package/dist/commonjs/models/pricemodel.js +52 -0
  35. package/dist/commonjs/models/pricemodel.js.map +1 -0
  36. package/dist/commonjs/models/pricemodelinput.d.ts +15 -0
  37. package/dist/commonjs/models/pricemodelinput.d.ts.map +1 -0
  38. package/dist/commonjs/models/pricemodelinput.js +49 -0
  39. package/dist/commonjs/models/pricemodelinput.js.map +1 -0
  40. package/dist/commonjs/models/schemasprice.d.ts +9 -10
  41. package/dist/commonjs/models/schemasprice.d.ts.map +1 -1
  42. package/dist/commonjs/models/schemasprice.js +4 -10
  43. package/dist/commonjs/models/schemasprice.js.map +1 -1
  44. package/dist/esm/funcs/pricesCreate.js +2 -2
  45. package/dist/esm/funcs/pricesCreate.js.map +1 -1
  46. package/dist/esm/lib/config.d.ts +2 -2
  47. package/dist/esm/lib/config.js +2 -2
  48. package/dist/esm/lib/config.js.map +1 -1
  49. package/dist/esm/models/index.d.ts +2 -0
  50. package/dist/esm/models/index.d.ts.map +1 -1
  51. package/dist/esm/models/index.js +2 -0
  52. package/dist/esm/models/index.js.map +1 -1
  53. package/dist/esm/models/meteredentitlementdetail.d.ts +9 -5
  54. package/dist/esm/models/meteredentitlementdetail.d.ts.map +1 -1
  55. package/dist/esm/models/meteredentitlementdetail.js +1 -0
  56. package/dist/esm/models/meteredentitlementdetail.js.map +1 -1
  57. package/dist/esm/models/meteredentitlementlistitem.d.ts +9 -5
  58. package/dist/esm/models/meteredentitlementlistitem.d.ts.map +1 -1
  59. package/dist/esm/models/meteredentitlementlistitem.js +1 -0
  60. package/dist/esm/models/meteredentitlementlistitem.js.map +1 -1
  61. package/dist/esm/models/operations/createplan.d.ts +3 -3
  62. package/dist/esm/models/operations/createplan.js +2 -2
  63. package/dist/esm/models/operations/createprice.d.ts +7 -17
  64. package/dist/esm/models/operations/createprice.d.ts.map +1 -1
  65. package/dist/esm/models/operations/createprice.js +2 -12
  66. package/dist/esm/models/operations/createprice.js.map +1 -1
  67. package/dist/esm/models/operations/updateprice.d.ts +7 -17
  68. package/dist/esm/models/operations/updateprice.d.ts.map +1 -1
  69. package/dist/esm/models/operations/updateprice.js +2 -12
  70. package/dist/esm/models/operations/updateprice.js.map +1 -1
  71. package/dist/esm/models/price.d.ts +4 -4
  72. package/dist/esm/models/price.d.ts.map +1 -1
  73. package/dist/esm/models/price.js +4 -4
  74. package/dist/esm/models/price.js.map +1 -1
  75. package/dist/esm/models/pricemodel.d.ts +18 -0
  76. package/dist/esm/models/pricemodel.d.ts.map +1 -0
  77. package/dist/esm/models/pricemodel.js +16 -0
  78. package/dist/esm/models/pricemodel.js.map +1 -0
  79. package/dist/esm/models/pricemodelinput.d.ts +15 -0
  80. package/dist/esm/models/pricemodelinput.d.ts.map +1 -0
  81. package/dist/esm/models/pricemodelinput.js +13 -0
  82. package/dist/esm/models/pricemodelinput.js.map +1 -0
  83. package/dist/esm/models/schemasprice.d.ts +9 -10
  84. package/dist/esm/models/schemasprice.d.ts.map +1 -1
  85. package/dist/esm/models/schemasprice.js +3 -9
  86. package/dist/esm/models/schemasprice.js.map +1 -1
  87. package/jsr.json +1 -1
  88. package/package.json +1 -1
  89. package/src/funcs/pricesCreate.ts +2 -2
  90. package/src/lib/config.ts +2 -2
  91. package/src/models/index.ts +2 -0
  92. package/src/models/meteredentitlementdetail.ts +10 -5
  93. package/src/models/meteredentitlementlistitem.ts +10 -5
  94. package/src/models/operations/createplan.ts +4 -4
  95. package/src/models/operations/createprice.ts +9 -22
  96. package/src/models/operations/updateprice.ts +9 -22
  97. package/src/models/price.ts +6 -6
  98. package/src/models/pricemodel.ts +28 -0
  99. package/src/models/pricemodelinput.ts +22 -0
  100. package/src/models/schemasprice.ts +11 -15
@@ -78,23 +78,27 @@ export type MeteredEntitlementDetail = {
78
78
  */
79
79
  isSoftLimit: boolean;
80
80
  /**
81
- * Remaining grant balance for the current period.
81
+ * Remaining balance for the current period. When `pricingUnitId` is set, this is expressed in that pricing unit's credits (a balance shared across every feature drawing the same unit); otherwise it is in the feature's native metered units.
82
82
  */
83
83
  balance: number;
84
84
  /**
85
- * Total usage consumed in the current billing period.
85
+ * Total usage consumed in the current billing period, in the same unit as `balance` (credits when `pricingUnitId` is set, otherwise native metered units). When `pricingUnitId` is set, this is the shared-pool aggregate across every feature drawing the same unit, not usage specific to this feature.
86
86
  */
87
87
  usageInPeriod: number;
88
88
  /**
89
- * Amount of usage exceeding the granted balance.
89
+ * Amount of usage exceeding the balance, in the same unit as `balance` (credits when `pricingUnitId` is set, otherwise native metered units).
90
90
  */
91
91
  overage: number;
92
92
  /**
93
- * Start of the current usage period. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead describes the pre-activation `[subscription start, activation)` window and may be `null` when there is no associated subscription.
93
+ * The pricing unit this feature is denominated in when it draws a credit pool. When set, `balance`/`usageInPeriod`/`overage` are in that unit's credits and reflect a balance shared across all features on the same unit. `null` for currency-denominated features (native metered units).
94
+ */
95
+ pricingUnitId: string | null;
96
+ /**
97
+ * Start of the current usage period. These bounds describe this entitlement's own usage window (not the shared pool's), even for a pool-backed feature (`pricingUnitId` set) whose `balance` and `usageInPeriod` are shared-pool aggregates. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead describes the pre-activation `[subscription start, activation)` window and may be `null` when there is no associated subscription.
94
98
  */
95
99
  currentPeriodStart: Date | null;
96
100
  /**
97
- * End of the current usage period. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead holds `activeFrom` — the end of the pre-activation `[subscription start, activation)` window.
101
+ * End of the current usage period. These bounds describe this entitlement's own usage window (not the shared pool's), even for a pool-backed feature (`pricingUnitId` set) whose `balance` and `usageInPeriod` are shared-pool aggregates. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead holds `activeFrom` — the end of the pre-activation `[subscription start, activation)` window.
98
102
  */
99
103
  currentPeriodEnd: Date | null;
100
104
  };
@@ -130,6 +134,7 @@ export const MeteredEntitlementDetail$inboundSchema: z.ZodType<
130
134
  balance: z.number(),
131
135
  usageInPeriod: z.number(),
132
136
  overage: z.number(),
137
+ pricingUnitId: z.nullable(z.string()),
133
138
  currentPeriodStart: z.nullable(
134
139
  z.string().datetime({ offset: true }).transform(v => new Date(v)),
135
140
  ),
@@ -69,23 +69,27 @@ export type MeteredEntitlementListItem = {
69
69
  */
70
70
  isSoftLimit: boolean;
71
71
  /**
72
- * Remaining grant balance for the current period.
72
+ * Remaining balance for the current period. When `pricingUnitId` is set, this is expressed in that pricing unit's credits (a balance shared across every feature drawing the same unit); otherwise it is in the feature's native metered units.
73
73
  */
74
74
  balance: number;
75
75
  /**
76
- * Total usage consumed in the current billing period.
76
+ * Total usage consumed in the current billing period, in the same unit as `balance` (credits when `pricingUnitId` is set, otherwise native metered units). When `pricingUnitId` is set, this is the shared-pool aggregate across every feature drawing the same unit, not usage specific to this feature.
77
77
  */
78
78
  usageInPeriod: number;
79
79
  /**
80
- * Amount of usage exceeding the granted balance.
80
+ * Amount of usage exceeding the balance, in the same unit as `balance` (credits when `pricingUnitId` is set, otherwise native metered units).
81
81
  */
82
82
  overage: number;
83
83
  /**
84
- * Start of the current usage period. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead describes the pre-activation `[subscription start, activation)` window and may be `null` when there is no associated subscription.
84
+ * The pricing unit this feature is denominated in when it draws a credit pool. When set, `balance`/`usageInPeriod`/`overage` are in that unit's credits and reflect a balance shared across all features on the same unit. `null` for currency-denominated features (native metered units).
85
+ */
86
+ pricingUnitId: string | null;
87
+ /**
88
+ * Start of the current usage period. These bounds describe this entitlement's own usage window (not the shared pool's), even for a pool-backed feature (`pricingUnitId` set) whose `balance` and `usageInPeriod` are shared-pool aggregates. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead describes the pre-activation `[subscription start, activation)` window and may be `null` when there is no associated subscription.
85
89
  */
86
90
  currentPeriodStart: Date | null;
87
91
  /**
88
- * End of the current usage period. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead holds `activeFrom` — the end of the pre-activation `[subscription start, activation)` window.
92
+ * End of the current usage period. These bounds describe this entitlement's own usage window (not the shared pool's), even for a pool-backed feature (`pricingUnitId` set) whose `balance` and `usageInPeriod` are shared-pool aggregates. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead holds `activeFrom` — the end of the pre-activation `[subscription start, activation)` window.
89
93
  */
90
94
  currentPeriodEnd: Date | null;
91
95
  };
@@ -115,6 +119,7 @@ export const MeteredEntitlementListItem$inboundSchema: z.ZodType<
115
119
  balance: z.number(),
116
120
  usageInPeriod: z.number(),
117
121
  overage: z.number(),
122
+ pricingUnitId: z.nullable(z.string()),
118
123
  currentPeriodStart: z.nullable(
119
124
  z.string().datetime({ offset: true }).transform(v => new Date(v)),
120
125
  ),
@@ -49,14 +49,14 @@ export const CreatePlanTaxBehavior = {
49
49
  export type CreatePlanTaxBehavior = ClosedEnum<typeof CreatePlanTaxBehavior>;
50
50
 
51
51
  /**
52
- * Billing engine version. 0 = legacy fee-schedule billing (Legacy), 1 = line-item billing with metered usage support (Standard).
52
+ * Billing engine version. Only 1 (Standard, line-item billing with metered usage support) is accepted for new plans; omitting the field defaults to 1. 0 (Legacy, fee-schedule billing) is rejected — it exists only on plans created before this restriction.
53
53
  */
54
54
  export const BillingVersion = {
55
55
  Zero: 0,
56
56
  One: 1,
57
57
  } as const;
58
58
  /**
59
- * Billing engine version. 0 = legacy fee-schedule billing (Legacy), 1 = line-item billing with metered usage support (Standard).
59
+ * Billing engine version. Only 1 (Standard, line-item billing with metered usage support) is accepted for new plans; omitting the field defaults to 1. 0 (Legacy, fee-schedule billing) is rejected — it exists only on plans created before this restriction.
60
60
  */
61
61
  export type BillingVersion = ClosedEnum<typeof BillingVersion>;
62
62
 
@@ -118,7 +118,7 @@ export type CreatePlanRequest = {
118
118
  */
119
119
  renewalReminderDays?: number | undefined;
120
120
  /**
121
- * Billing engine version. 0 = legacy fee-schedule billing (Legacy), 1 = line-item billing with metered usage support (Standard).
121
+ * Billing engine version. Only 1 (Standard, line-item billing with metered usage support) is accepted for new plans; omitting the field defaults to 1. 0 (Legacy, fee-schedule billing) is rejected — it exists only on plans created before this restriction.
122
122
  */
123
123
  billingVersion?: BillingVersion | undefined;
124
124
  /**
@@ -187,7 +187,7 @@ export const CreatePlanRequest$outboundSchema: z.ZodType<
187
187
  taxBehavior: CreatePlanTaxBehavior$outboundSchema.default("exclusive"),
188
188
  renewalReminderEnabled: z.boolean().default(true),
189
189
  renewalReminderDays: z.number().int().default(3),
190
- billingVersion: BillingVersion$outboundSchema.default(0),
190
+ billingVersion: BillingVersion$outboundSchema.default(1),
191
191
  billingAnchor: z.nullable(z.date().transform(v => v.toISOString()))
192
192
  .optional(),
193
193
  });
@@ -6,20 +6,6 @@ import * as z from "zod/v3";
6
6
  import { ClosedEnum } from "../../types/enums.js";
7
7
  import * as models from "../index.js";
8
8
 
9
- /**
10
- * Pricing calculation model. Required for billable metrics, optional for fees (defaults to 'standard').
11
- */
12
- export const CreatePriceModel = {
13
- Standard: "standard",
14
- Dynamic: "dynamic",
15
- Volume: "volume",
16
- Percentage: "percentage",
17
- } as const;
18
- /**
19
- * Pricing calculation model. Required for billable metrics, optional for fees (defaults to 'standard').
20
- */
21
- export type CreatePriceModel = ClosedEnum<typeof CreatePriceModel>;
22
-
23
9
  /**
24
10
  * Billing timing preference. For billable metrics: 'instant' (charges immediately) or 'in_arrears' (charges at period end). For fees: 'in_advance' (charges upfront) or 'in_arrears' (charges at period end).
25
11
  */
@@ -43,9 +29,13 @@ export type CreatePriceRequest = {
43
29
  */
44
30
  feeId?: string | undefined;
45
31
  /**
46
- * Pricing calculation model. Required for billable metrics, optional for fees (defaults to 'standard').
32
+ * Unique identifier for a pricing unit
33
+ */
34
+ pricingUnitId?: string | undefined;
35
+ /**
36
+ * Pricing calculation model. Required for billable metrics, optional for fees (defaults to 'standard'). Only 'standard' is accepted; for percentage/revenue-share use 'standard' with a unit-price multiplier. Legacy prices using 'dynamic'/'volume'/'percentage' stay readable and billable but cannot be created.
47
37
  */
48
- model?: CreatePriceModel | undefined;
38
+ model?: models.PriceModelInput | undefined;
49
39
  /**
50
40
  * Line item label shown on customer invoices. Sample values: 'Claude Token Consumption', 'Storage Usage (GB)', 'Inference API Calls', 'Image Generation Count', 'Training Compute Hours', 'Data Transfer (TB)'
51
41
  */
@@ -70,11 +60,6 @@ export type CreatePriceRequest = {
70
60
  quantity?: number | undefined;
71
61
  };
72
62
 
73
- /** @internal */
74
- export const CreatePriceModel$outboundSchema: z.ZodNativeEnum<
75
- typeof CreatePriceModel
76
- > = z.nativeEnum(CreatePriceModel);
77
-
78
63
  /** @internal */
79
64
  export const CreatePricePaymentTerm$outboundSchema: z.ZodNativeEnum<
80
65
  typeof CreatePricePaymentTerm
@@ -84,6 +69,7 @@ export const CreatePricePaymentTerm$outboundSchema: z.ZodNativeEnum<
84
69
  export type CreatePriceRequest$Outbound = {
85
70
  billableMetricId?: string | undefined;
86
71
  feeId?: string | undefined;
72
+ pricingUnitId?: string | undefined;
87
73
  model?: string | undefined;
88
74
  invoiceDisplayName: string;
89
75
  paymentTerm: string;
@@ -102,7 +88,8 @@ export const CreatePriceRequest$outboundSchema: z.ZodType<
102
88
  > = z.object({
103
89
  billableMetricId: z.string().optional(),
104
90
  feeId: z.string().optional(),
105
- model: CreatePriceModel$outboundSchema.optional(),
91
+ pricingUnitId: z.string().optional(),
92
+ model: models.PriceModelInput$outboundSchema.optional(),
106
93
  invoiceDisplayName: z.string(),
107
94
  paymentTerm: CreatePricePaymentTerm$outboundSchema,
108
95
  billingCadence: z.nullable(z.string()).optional(),
@@ -7,20 +7,6 @@ import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { ClosedEnum } from "../../types/enums.js";
8
8
  import * as models from "../index.js";
9
9
 
10
- /**
11
- * The pricing model to be used, which can be standard, dynamic, volume-based, or percentage-based.
12
- */
13
- export const UpdatePriceModel = {
14
- Standard: "standard",
15
- Dynamic: "dynamic",
16
- Volume: "volume",
17
- Percentage: "percentage",
18
- } as const;
19
- /**
20
- * The pricing model to be used, which can be standard, dynamic, volume-based, or percentage-based.
21
- */
22
- export type UpdatePriceModel = ClosedEnum<typeof UpdatePriceModel>;
23
-
24
10
  /**
25
11
  * Billing timing preference. For billable metrics: 'instant' (charges immediately) or 'in_arrears' (charges at period end). For fees: 'in_advance' (charges upfront) or 'in_arrears' (charges at period end).
26
12
  */
@@ -39,14 +25,18 @@ export type UpdatePriceRequestBody = {
39
25
  * Unique identifier for a billable metric
40
26
  */
41
27
  billableMetricId?: string | undefined;
28
+ /**
29
+ * Denominate this metered price in a pricing unit (credits). Set to a pricing unit ID to draw down a credit pool, null to revert to real currency, or omit to leave unchanged.
30
+ */
31
+ pricingUnitId?: string | null | undefined;
42
32
  /**
43
33
  * Updated invoice line item label. Sample values: 'LLM Token Usage', 'Storage Charges', 'API Call Fees'
44
34
  */
45
35
  invoiceDisplayName?: string | undefined;
46
36
  /**
47
- * The pricing model to be used, which can be standard, dynamic, volume-based, or percentage-based.
37
+ * The pricing model to set. Only 'standard' is accepted. Legacy 'dynamic'/'volume'/'percentage' prices can still be edited (other fields) but cannot be switched to those models. Percentage/revenue-share is expressed via 'standard' with a unit-price multiplier.
48
38
  */
49
- model?: UpdatePriceModel | undefined;
39
+ model?: models.PriceModelInput | undefined;
50
40
  properties?: models.PricePropertiesUnion | undefined;
51
41
  /**
52
42
  * Billing timing preference. For billable metrics: 'instant' (charges immediately) or 'in_arrears' (charges at period end). For fees: 'in_advance' (charges upfront) or 'in_arrears' (charges at period end).
@@ -78,11 +68,6 @@ export type UpdatePriceRequest = {
78
68
  requestBody: UpdatePriceRequestBody;
79
69
  };
80
70
 
81
- /** @internal */
82
- export const UpdatePriceModel$outboundSchema: z.ZodNativeEnum<
83
- typeof UpdatePriceModel
84
- > = z.nativeEnum(UpdatePriceModel);
85
-
86
71
  /** @internal */
87
72
  export const UpdatePricePaymentTerm$outboundSchema: z.ZodNativeEnum<
88
73
  typeof UpdatePricePaymentTerm
@@ -91,6 +76,7 @@ export const UpdatePricePaymentTerm$outboundSchema: z.ZodNativeEnum<
91
76
  /** @internal */
92
77
  export type UpdatePriceRequestBody$Outbound = {
93
78
  billableMetricId?: string | undefined;
79
+ pricingUnitId?: string | null | undefined;
94
80
  invoiceDisplayName?: string | undefined;
95
81
  model?: string | undefined;
96
82
  properties?: models.PricePropertiesUnion$Outbound | undefined;
@@ -108,8 +94,9 @@ export const UpdatePriceRequestBody$outboundSchema: z.ZodType<
108
94
  UpdatePriceRequestBody
109
95
  > = z.object({
110
96
  billableMetricId: z.string().optional(),
97
+ pricingUnitId: z.nullable(z.string()).optional(),
111
98
  invoiceDisplayName: z.string().optional(),
112
- model: UpdatePriceModel$outboundSchema.optional(),
99
+ model: models.PriceModelInput$outboundSchema.optional(),
113
100
  properties: models.PricePropertiesUnion$outboundSchema.optional(),
114
101
  paymentTerm: UpdatePricePaymentTerm$outboundSchema.optional(),
115
102
  billingCadence: z.nullable(z.string()).optional(),
@@ -14,13 +14,13 @@ export const PriceObject = {
14
14
  } as const;
15
15
  export type PriceObject = ClosedEnum<typeof PriceObject>;
16
16
 
17
- export const PriceModel = {
17
+ export const PriceModel1 = {
18
18
  Standard: "standard",
19
19
  Dynamic: "dynamic",
20
20
  Volume: "volume",
21
21
  Percentage: "percentage",
22
22
  } as const;
23
- export type PriceModel = ClosedEnum<typeof PriceModel>;
23
+ export type PriceModel1 = ClosedEnum<typeof PriceModel1>;
24
24
 
25
25
  export const PricePaymentTerm = {
26
26
  Instant: "instant",
@@ -52,7 +52,7 @@ export type Price = {
52
52
  currency?: string | undefined;
53
53
  description?: string | undefined;
54
54
  invoiceDisplayName: string;
55
- model: PriceModel;
55
+ model: PriceModel1;
56
56
  paymentTerm: PricePaymentTerm;
57
57
  properties: { [k: string]: any };
58
58
  unitAmount?: string | undefined;
@@ -76,8 +76,8 @@ export const PriceObject$inboundSchema: z.ZodNativeEnum<typeof PriceObject> = z
76
76
  .nativeEnum(PriceObject);
77
77
 
78
78
  /** @internal */
79
- export const PriceModel$inboundSchema: z.ZodNativeEnum<typeof PriceModel> = z
80
- .nativeEnum(PriceModel);
79
+ export const PriceModel1$inboundSchema: z.ZodNativeEnum<typeof PriceModel1> = z
80
+ .nativeEnum(PriceModel1);
81
81
 
82
82
  /** @internal */
83
83
  export const PricePaymentTerm$inboundSchema: z.ZodNativeEnum<
@@ -99,7 +99,7 @@ export const Price$inboundSchema: z.ZodType<Price, z.ZodTypeDef, unknown> = z
99
99
  currency: z.string().optional(),
100
100
  description: z.string().optional(),
101
101
  invoiceDisplayName: z.string(),
102
- model: PriceModel$inboundSchema,
102
+ model: PriceModel1$inboundSchema,
103
103
  paymentTerm: PricePaymentTerm$inboundSchema,
104
104
  properties: z.record(z.any()),
105
105
  unitAmount: z.string().optional(),
@@ -0,0 +1,28 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import * as openEnums from "../types/enums.js";
7
+ import { OpenEnum } from "../types/enums.js";
8
+
9
+ /**
10
+ * Pricing model of a price as returned by the API. Includes legacy models ('dynamic', 'volume', 'percentage') retained for existing prices; only 'standard' can be created (see PriceModelInput).
11
+ */
12
+ export const PriceModel = {
13
+ Standard: "standard",
14
+ Dynamic: "dynamic",
15
+ Volume: "volume",
16
+ Percentage: "percentage",
17
+ } as const;
18
+ /**
19
+ * Pricing model of a price as returned by the API. Includes legacy models ('dynamic', 'volume', 'percentage') retained for existing prices; only 'standard' can be created (see PriceModelInput).
20
+ */
21
+ export type PriceModel = OpenEnum<typeof PriceModel>;
22
+
23
+ /** @internal */
24
+ export const PriceModel$inboundSchema: z.ZodType<
25
+ PriceModel,
26
+ z.ZodTypeDef,
27
+ unknown
28
+ > = openEnums.inboundSchema(PriceModel);
@@ -0,0 +1,22 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { ClosedEnum } from "../types/enums.js";
7
+
8
+ /**
9
+ * Pricing model accepted when creating or updating a price. Only 'standard' is creatable. Percentage-style and revenue-share pricing are expressed with 'standard' plus a unit-price multiplier (e.g. 10% ⇒ unitPrice '0.1'). The legacy 'dynamic', 'volume', and 'percentage' models remain billable and readable on existing prices but can no longer be created.
10
+ */
11
+ export const PriceModelInput = {
12
+ Standard: "standard",
13
+ } as const;
14
+ /**
15
+ * Pricing model accepted when creating or updating a price. Only 'standard' is creatable. Percentage-style and revenue-share pricing are expressed with 'standard' plus a unit-price multiplier (e.g. 10% ⇒ unitPrice '0.1'). The legacy 'dynamic', 'volume', and 'percentage' models remain billable and readable on existing prices but can no longer be created.
16
+ */
17
+ export type PriceModelInput = ClosedEnum<typeof PriceModelInput>;
18
+
19
+ /** @internal */
20
+ export const PriceModelInput$outboundSchema: z.ZodNativeEnum<
21
+ typeof PriceModelInput
22
+ > = z.nativeEnum(PriceModelInput);
@@ -8,6 +8,7 @@ import { ClosedEnum } from "../types/enums.js";
8
8
  import { Result as SafeParseResult } from "../types/fp.js";
9
9
  import { SDKValidationError } from "./errors/sdkvalidationerror.js";
10
10
  import { PriceFeature, PriceFeature$inboundSchema } from "./pricefeature.js";
11
+ import { PriceModel, PriceModel$inboundSchema } from "./pricemodel.js";
11
12
  import {
12
13
  PricePropertiesUnion,
13
14
  PricePropertiesUnion$inboundSchema,
@@ -18,14 +19,6 @@ export const SchemasPriceObject = {
18
19
  } as const;
19
20
  export type SchemasPriceObject = ClosedEnum<typeof SchemasPriceObject>;
20
21
 
21
- export const SchemasPriceModel = {
22
- Standard: "standard",
23
- Dynamic: "dynamic",
24
- Volume: "volume",
25
- Percentage: "percentage",
26
- } as const;
27
- export type SchemasPriceModel = ClosedEnum<typeof SchemasPriceModel>;
28
-
29
22
  export const SchemasPricePaymentTerm = {
30
23
  Instant: "instant",
31
24
  InArrears: "in_arrears",
@@ -49,6 +42,10 @@ export type SchemasPrice = {
49
42
  * The unique identifier for the fee referred to by this price. Present when price is linked to a fee.
50
43
  */
51
44
  feeId?: string | undefined;
45
+ /**
46
+ * Unique identifier for a pricing unit
47
+ */
48
+ pricingUnitId?: string | undefined;
52
49
  /**
53
50
  * Unique identifier for an organization
54
51
  */
@@ -59,7 +56,10 @@ export type SchemasPrice = {
59
56
  billingCadence?: string | null | undefined;
60
57
  createdAt: Date;
61
58
  invoiceDisplayName: string;
62
- model?: SchemasPriceModel | undefined;
59
+ /**
60
+ * Pricing model of a price as returned by the API. Includes legacy models ('dynamic', 'volume', 'percentage') retained for existing prices; only 'standard' can be created (see PriceModelInput).
61
+ */
62
+ model?: PriceModel | undefined;
63
63
  paymentTerm: SchemasPricePaymentTerm;
64
64
  properties: PricePropertiesUnion;
65
65
  updatedAt: Date;
@@ -82,11 +82,6 @@ export const SchemasPriceObject$inboundSchema: z.ZodNativeEnum<
82
82
  typeof SchemasPriceObject
83
83
  > = z.nativeEnum(SchemasPriceObject);
84
84
 
85
- /** @internal */
86
- export const SchemasPriceModel$inboundSchema: z.ZodNativeEnum<
87
- typeof SchemasPriceModel
88
- > = z.nativeEnum(SchemasPriceModel);
89
-
90
85
  /** @internal */
91
86
  export const SchemasPricePaymentTerm$inboundSchema: z.ZodNativeEnum<
92
87
  typeof SchemasPricePaymentTerm
@@ -102,11 +97,12 @@ export const SchemasPrice$inboundSchema: z.ZodType<
102
97
  object: SchemasPriceObject$inboundSchema.default("price"),
103
98
  billableMetricId: z.string().optional(),
104
99
  feeId: z.string().optional(),
100
+ pricingUnitId: z.string().optional(),
105
101
  merchantId: z.string(),
106
102
  billingCadence: z.nullable(z.string()).optional(),
107
103
  createdAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
108
104
  invoiceDisplayName: z.string(),
109
- model: SchemasPriceModel$inboundSchema.optional(),
105
+ model: PriceModel$inboundSchema.optional(),
110
106
  paymentTerm: SchemasPricePaymentTerm$inboundSchema,
111
107
  properties: PricePropertiesUnion$inboundSchema,
112
108
  updatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),