@paygentic/sdk 0.8.5 → 0.8.6

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 (235) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +9 -3
  3. package/dist/commonjs/funcs/invoicesV2Get.d.ts +1 -1
  4. package/dist/commonjs/funcs/invoicesV2Get.d.ts.map +1 -1
  5. package/dist/commonjs/funcs/invoicesV2Get.js +2 -2
  6. package/dist/commonjs/funcs/invoicesV2Get.js.map +1 -1
  7. package/dist/commonjs/funcs/invoicesV2GetLineItems.d.ts +1 -1
  8. package/dist/commonjs/funcs/invoicesV2GetLineItems.d.ts.map +1 -1
  9. package/dist/commonjs/funcs/invoicesV2GetLineItems.js +2 -2
  10. package/dist/commonjs/funcs/invoicesV2GetLineItems.js.map +1 -1
  11. package/dist/commonjs/funcs/plansGetPlanVersion.d.ts +19 -0
  12. package/dist/commonjs/funcs/plansGetPlanVersion.d.ts.map +1 -0
  13. package/dist/commonjs/funcs/plansGetPlanVersion.js +128 -0
  14. package/dist/commonjs/funcs/plansGetPlanVersion.js.map +1 -0
  15. package/dist/commonjs/funcs/plansMintPlanVersion.d.ts +19 -0
  16. package/dist/commonjs/funcs/plansMintPlanVersion.d.ts.map +1 -0
  17. package/dist/commonjs/funcs/plansMintPlanVersion.js +127 -0
  18. package/dist/commonjs/funcs/plansMintPlanVersion.js.map +1 -0
  19. package/dist/commonjs/funcs/plansTransitionPlanVersion.d.ts +19 -0
  20. package/dist/commonjs/funcs/plansTransitionPlanVersion.d.ts.map +1 -0
  21. package/dist/commonjs/funcs/plansTransitionPlanVersion.js +131 -0
  22. package/dist/commonjs/funcs/plansTransitionPlanVersion.js.map +1 -0
  23. package/dist/commonjs/funcs/plansUpdate.js +2 -2
  24. package/dist/commonjs/funcs/plansUpdate.js.map +1 -1
  25. package/dist/commonjs/funcs/subscriptionsCreate.js +2 -2
  26. package/dist/commonjs/funcs/subscriptionsCreate.js.map +1 -1
  27. package/dist/commonjs/lib/config.d.ts +2 -2
  28. package/dist/commonjs/lib/config.js +2 -2
  29. package/dist/commonjs/models/index.d.ts +4 -0
  30. package/dist/commonjs/models/index.d.ts.map +1 -1
  31. package/dist/commonjs/models/index.js +4 -0
  32. package/dist/commonjs/models/index.js.map +1 -1
  33. package/dist/commonjs/models/mintplanversionrequest.d.ts +46 -0
  34. package/dist/commonjs/models/mintplanversionrequest.d.ts.map +1 -0
  35. package/dist/commonjs/models/mintplanversionrequest.js +60 -0
  36. package/dist/commonjs/models/mintplanversionrequest.js.map +1 -0
  37. package/dist/commonjs/models/operations/createplan.d.ts +5 -0
  38. package/dist/commonjs/models/operations/createplan.d.ts.map +1 -1
  39. package/dist/commonjs/models/operations/createplan.js +1 -0
  40. package/dist/commonjs/models/operations/createplan.js.map +1 -1
  41. package/dist/commonjs/models/operations/getinvoice.d.ts +1 -1
  42. package/dist/commonjs/models/operations/getinvoicelineitems.d.ts +1 -1
  43. package/dist/commonjs/models/operations/getplanversion.d.ts +17 -0
  44. package/dist/commonjs/models/operations/getplanversion.d.ts.map +1 -0
  45. package/dist/commonjs/models/operations/getplanversion.js +50 -0
  46. package/dist/commonjs/models/operations/getplanversion.js.map +1 -0
  47. package/dist/commonjs/models/operations/index.d.ts +3 -0
  48. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  49. package/dist/commonjs/models/operations/index.js +3 -0
  50. package/dist/commonjs/models/operations/index.js.map +1 -1
  51. package/dist/commonjs/models/operations/mintplanversion.d.ts +15 -0
  52. package/dist/commonjs/models/operations/mintplanversion.d.ts.map +1 -0
  53. package/dist/commonjs/models/operations/mintplanversion.js +56 -0
  54. package/dist/commonjs/models/operations/mintplanversion.js.map +1 -0
  55. package/dist/commonjs/models/operations/transitionplanversion.d.ts +20 -0
  56. package/dist/commonjs/models/operations/transitionplanversion.d.ts.map +1 -0
  57. package/dist/commonjs/models/operations/transitionplanversion.js +57 -0
  58. package/dist/commonjs/models/operations/transitionplanversion.js.map +1 -0
  59. package/dist/commonjs/models/operations/updateplan.d.ts +5 -0
  60. package/dist/commonjs/models/operations/updateplan.d.ts.map +1 -1
  61. package/dist/commonjs/models/operations/updateplan.js +1 -0
  62. package/dist/commonjs/models/operations/updateplan.js.map +1 -1
  63. package/dist/commonjs/models/plan.d.ts +4 -0
  64. package/dist/commonjs/models/plan.d.ts.map +1 -1
  65. package/dist/commonjs/models/plan.js +1 -0
  66. package/dist/commonjs/models/plan.js.map +1 -1
  67. package/dist/commonjs/models/planversion.d.ts +71 -0
  68. package/dist/commonjs/models/planversion.d.ts.map +1 -0
  69. package/dist/commonjs/models/planversion.js +76 -0
  70. package/dist/commonjs/models/planversion.js.map +1 -0
  71. package/dist/commonjs/models/planversionpriceslot.d.ts +81 -0
  72. package/dist/commonjs/models/planversionpriceslot.d.ts.map +1 -0
  73. package/dist/commonjs/models/planversionpriceslot.js +88 -0
  74. package/dist/commonjs/models/planversionpriceslot.js.map +1 -0
  75. package/dist/commonjs/models/price.d.ts +4 -4
  76. package/dist/commonjs/models/price.d.ts.map +1 -1
  77. package/dist/commonjs/models/price.js +5 -4
  78. package/dist/commonjs/models/price.js.map +1 -1
  79. package/dist/commonjs/models/pricepropertiesunion.d.ts +1 -1
  80. package/dist/commonjs/models/revenuesummaryresponse.d.ts +8 -0
  81. package/dist/commonjs/models/revenuesummaryresponse.d.ts.map +1 -1
  82. package/dist/commonjs/models/revenuesummaryresponse.js +2 -0
  83. package/dist/commonjs/models/revenuesummaryresponse.js.map +1 -1
  84. package/dist/commonjs/models/revenuetrendbucket.d.ts +4 -0
  85. package/dist/commonjs/models/revenuetrendbucket.d.ts.map +1 -1
  86. package/dist/commonjs/models/revenuetrendbucket.js +1 -0
  87. package/dist/commonjs/models/revenuetrendbucket.js.map +1 -1
  88. package/dist/commonjs/models/scheduleinterval.d.ts +4 -1
  89. package/dist/commonjs/models/scheduleinterval.d.ts.map +1 -1
  90. package/dist/commonjs/models/scheduleinterval.js +1 -1
  91. package/dist/commonjs/models/scheduleinterval.js.map +1 -1
  92. package/dist/commonjs/models/schemasbillingschedule.d.ts +4 -1
  93. package/dist/commonjs/models/schemasbillingschedule.d.ts.map +1 -1
  94. package/dist/commonjs/models/schemasbillingschedule.js +1 -1
  95. package/dist/commonjs/models/schemasbillingschedule.js.map +1 -1
  96. package/dist/commonjs/models/transitionplanversionrequest.d.ts +18 -0
  97. package/dist/commonjs/models/transitionplanversionrequest.d.ts.map +1 -0
  98. package/dist/commonjs/models/transitionplanversionrequest.js +49 -0
  99. package/dist/commonjs/models/transitionplanversionrequest.js.map +1 -0
  100. package/dist/commonjs/sdk/plans.d.ts +21 -0
  101. package/dist/commonjs/sdk/plans.d.ts.map +1 -1
  102. package/dist/commonjs/sdk/plans.js +30 -0
  103. package/dist/commonjs/sdk/plans.js.map +1 -1
  104. package/dist/esm/funcs/invoicesV2Get.d.ts +1 -1
  105. package/dist/esm/funcs/invoicesV2Get.d.ts.map +1 -1
  106. package/dist/esm/funcs/invoicesV2Get.js +2 -2
  107. package/dist/esm/funcs/invoicesV2Get.js.map +1 -1
  108. package/dist/esm/funcs/invoicesV2GetLineItems.d.ts +1 -1
  109. package/dist/esm/funcs/invoicesV2GetLineItems.d.ts.map +1 -1
  110. package/dist/esm/funcs/invoicesV2GetLineItems.js +2 -2
  111. package/dist/esm/funcs/invoicesV2GetLineItems.js.map +1 -1
  112. package/dist/esm/funcs/plansGetPlanVersion.d.ts +19 -0
  113. package/dist/esm/funcs/plansGetPlanVersion.d.ts.map +1 -0
  114. package/dist/esm/funcs/plansGetPlanVersion.js +92 -0
  115. package/dist/esm/funcs/plansGetPlanVersion.js.map +1 -0
  116. package/dist/esm/funcs/plansMintPlanVersion.d.ts +19 -0
  117. package/dist/esm/funcs/plansMintPlanVersion.d.ts.map +1 -0
  118. package/dist/esm/funcs/plansMintPlanVersion.js +91 -0
  119. package/dist/esm/funcs/plansMintPlanVersion.js.map +1 -0
  120. package/dist/esm/funcs/plansTransitionPlanVersion.d.ts +19 -0
  121. package/dist/esm/funcs/plansTransitionPlanVersion.d.ts.map +1 -0
  122. package/dist/esm/funcs/plansTransitionPlanVersion.js +95 -0
  123. package/dist/esm/funcs/plansTransitionPlanVersion.js.map +1 -0
  124. package/dist/esm/funcs/plansUpdate.js +2 -2
  125. package/dist/esm/funcs/plansUpdate.js.map +1 -1
  126. package/dist/esm/funcs/subscriptionsCreate.js +2 -2
  127. package/dist/esm/funcs/subscriptionsCreate.js.map +1 -1
  128. package/dist/esm/lib/config.d.ts +2 -2
  129. package/dist/esm/lib/config.js +2 -2
  130. package/dist/esm/models/index.d.ts +4 -0
  131. package/dist/esm/models/index.d.ts.map +1 -1
  132. package/dist/esm/models/index.js +4 -0
  133. package/dist/esm/models/index.js.map +1 -1
  134. package/dist/esm/models/mintplanversionrequest.d.ts +46 -0
  135. package/dist/esm/models/mintplanversionrequest.d.ts.map +1 -0
  136. package/dist/esm/models/mintplanversionrequest.js +22 -0
  137. package/dist/esm/models/mintplanversionrequest.js.map +1 -0
  138. package/dist/esm/models/operations/createplan.d.ts +5 -0
  139. package/dist/esm/models/operations/createplan.d.ts.map +1 -1
  140. package/dist/esm/models/operations/createplan.js +1 -0
  141. package/dist/esm/models/operations/createplan.js.map +1 -1
  142. package/dist/esm/models/operations/getinvoice.d.ts +1 -1
  143. package/dist/esm/models/operations/getinvoicelineitems.d.ts +1 -1
  144. package/dist/esm/models/operations/getplanversion.d.ts +17 -0
  145. package/dist/esm/models/operations/getplanversion.d.ts.map +1 -0
  146. package/dist/esm/models/operations/getplanversion.js +13 -0
  147. package/dist/esm/models/operations/getplanversion.js.map +1 -0
  148. package/dist/esm/models/operations/index.d.ts +3 -0
  149. package/dist/esm/models/operations/index.d.ts.map +1 -1
  150. package/dist/esm/models/operations/index.js +3 -0
  151. package/dist/esm/models/operations/index.js.map +1 -1
  152. package/dist/esm/models/operations/mintplanversion.d.ts +15 -0
  153. package/dist/esm/models/operations/mintplanversion.d.ts.map +1 -0
  154. package/dist/esm/models/operations/mintplanversion.js +19 -0
  155. package/dist/esm/models/operations/mintplanversion.js.map +1 -0
  156. package/dist/esm/models/operations/transitionplanversion.d.ts +20 -0
  157. package/dist/esm/models/operations/transitionplanversion.d.ts.map +1 -0
  158. package/dist/esm/models/operations/transitionplanversion.js +20 -0
  159. package/dist/esm/models/operations/transitionplanversion.js.map +1 -0
  160. package/dist/esm/models/operations/updateplan.d.ts +5 -0
  161. package/dist/esm/models/operations/updateplan.d.ts.map +1 -1
  162. package/dist/esm/models/operations/updateplan.js +1 -0
  163. package/dist/esm/models/operations/updateplan.js.map +1 -1
  164. package/dist/esm/models/plan.d.ts +4 -0
  165. package/dist/esm/models/plan.d.ts.map +1 -1
  166. package/dist/esm/models/plan.js +1 -0
  167. package/dist/esm/models/plan.js.map +1 -1
  168. package/dist/esm/models/planversion.d.ts +71 -0
  169. package/dist/esm/models/planversion.d.ts.map +1 -0
  170. package/dist/esm/models/planversion.js +39 -0
  171. package/dist/esm/models/planversion.js.map +1 -0
  172. package/dist/esm/models/planversionpriceslot.d.ts +81 -0
  173. package/dist/esm/models/planversionpriceslot.d.ts.map +1 -0
  174. package/dist/esm/models/planversionpriceslot.js +51 -0
  175. package/dist/esm/models/planversionpriceslot.js.map +1 -0
  176. package/dist/esm/models/price.d.ts +4 -4
  177. package/dist/esm/models/price.d.ts.map +1 -1
  178. package/dist/esm/models/price.js +4 -3
  179. package/dist/esm/models/price.js.map +1 -1
  180. package/dist/esm/models/pricepropertiesunion.d.ts +1 -1
  181. package/dist/esm/models/revenuesummaryresponse.d.ts +8 -0
  182. package/dist/esm/models/revenuesummaryresponse.d.ts.map +1 -1
  183. package/dist/esm/models/revenuesummaryresponse.js +2 -0
  184. package/dist/esm/models/revenuesummaryresponse.js.map +1 -1
  185. package/dist/esm/models/revenuetrendbucket.d.ts +4 -0
  186. package/dist/esm/models/revenuetrendbucket.d.ts.map +1 -1
  187. package/dist/esm/models/revenuetrendbucket.js +1 -0
  188. package/dist/esm/models/revenuetrendbucket.js.map +1 -1
  189. package/dist/esm/models/scheduleinterval.d.ts +4 -1
  190. package/dist/esm/models/scheduleinterval.d.ts.map +1 -1
  191. package/dist/esm/models/scheduleinterval.js +1 -1
  192. package/dist/esm/models/scheduleinterval.js.map +1 -1
  193. package/dist/esm/models/schemasbillingschedule.d.ts +4 -1
  194. package/dist/esm/models/schemasbillingschedule.d.ts.map +1 -1
  195. package/dist/esm/models/schemasbillingschedule.js +1 -1
  196. package/dist/esm/models/schemasbillingschedule.js.map +1 -1
  197. package/dist/esm/models/transitionplanversionrequest.d.ts +18 -0
  198. package/dist/esm/models/transitionplanversionrequest.d.ts.map +1 -0
  199. package/dist/esm/models/transitionplanversionrequest.js +12 -0
  200. package/dist/esm/models/transitionplanversionrequest.js.map +1 -0
  201. package/dist/esm/sdk/plans.d.ts +21 -0
  202. package/dist/esm/sdk/plans.d.ts.map +1 -1
  203. package/dist/esm/sdk/plans.js +30 -0
  204. package/dist/esm/sdk/plans.js.map +1 -1
  205. package/jsr.json +1 -1
  206. package/package.json +2 -1
  207. package/src/funcs/invoicesV2Get.ts +5 -1
  208. package/src/funcs/invoicesV2GetLineItems.ts +5 -1
  209. package/src/funcs/plansGetPlanVersion.ts +186 -0
  210. package/src/funcs/plansMintPlanVersion.ts +183 -0
  211. package/src/funcs/plansTransitionPlanVersion.ts +190 -0
  212. package/src/funcs/plansUpdate.ts +2 -2
  213. package/src/funcs/subscriptionsCreate.ts +2 -2
  214. package/src/lib/config.ts +2 -2
  215. package/src/models/index.ts +4 -0
  216. package/src/models/mintplanversionrequest.ts +80 -0
  217. package/src/models/operations/createplan.ts +6 -0
  218. package/src/models/operations/getinvoice.ts +1 -1
  219. package/src/models/operations/getinvoicelineitems.ts +1 -1
  220. package/src/models/operations/getplanversion.ts +37 -0
  221. package/src/models/operations/index.ts +3 -0
  222. package/src/models/operations/mintplanversion.ts +40 -0
  223. package/src/models/operations/transitionplanversion.ts +49 -0
  224. package/src/models/operations/updateplan.ts +6 -0
  225. package/src/models/plan.ts +5 -0
  226. package/src/models/planversion.ts +113 -0
  227. package/src/models/planversionpriceslot.ts +136 -0
  228. package/src/models/price.ts +6 -7
  229. package/src/models/pricepropertiesunion.ts +1 -1
  230. package/src/models/revenuesummaryresponse.ts +10 -0
  231. package/src/models/revenuetrendbucket.ts +5 -0
  232. package/src/models/scheduleinterval.ts +7 -2
  233. package/src/models/schemasbillingschedule.ts +7 -2
  234. package/src/models/transitionplanversionrequest.ts +39 -0
  235. package/src/sdk/plans.ts +54 -0
@@ -134,7 +134,7 @@ async function $do(
134
134
 
135
135
  const doResult = await client._do(req, {
136
136
  context,
137
- errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
137
+ errorCodes: ["400", "401", "403", "404", "409", "4XX", "500", "5XX"],
138
138
  retryConfig: context.retryConfig,
139
139
  retryCodes: context.retryCodes,
140
140
  });
@@ -162,7 +162,7 @@ async function $do(
162
162
  >(
163
163
  M.json([200, 201], models.Subscription$inboundSchema),
164
164
  M.jsonErr(400, errors.BadRequest$inboundSchema),
165
- M.jsonErr([401, 403, 404], errors.ErrorT$inboundSchema),
165
+ M.jsonErr([401, 403, 404, 409], errors.ErrorT$inboundSchema),
166
166
  M.jsonErr(500, errors.ErrorT$inboundSchema),
167
167
  M.fail("4XX"),
168
168
  M.fail("5XX"),
package/src/lib/config.ts CHANGED
@@ -65,7 +65,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
65
65
  export const SDK_METADATA = {
66
66
  language: "typescript",
67
67
  openapiDocVersion: "0.1.0",
68
- sdkVersion: "0.8.5",
68
+ sdkVersion: "0.8.6",
69
69
  genVersion: "2.879.13",
70
- userAgent: "speakeasy-sdk/typescript 0.8.5 2.879.13 0.1.0 @paygentic/sdk",
70
+ userAgent: "speakeasy-sdk/typescript 0.8.6 2.879.13 0.1.0 @paygentic/sdk",
71
71
  } as const;
@@ -55,6 +55,7 @@ export * from "./meteredentitlementdetail.js";
55
55
  export * from "./meteredentitlementlistitem.js";
56
56
  export * from "./meterevent.js";
57
57
  export * from "./metereventlist.js";
58
+ export * from "./mintplanversionrequest.js";
58
59
  export * from "./offsetpagination.js";
59
60
  export * from "./order.js";
60
61
  export * from "./orderlineitem.js";
@@ -65,6 +66,8 @@ export * from "./paymentsession.js";
65
66
  export * from "./paymentsummary.js";
66
67
  export * from "./plan.js";
67
68
  export * from "./plancreditallocation.js";
69
+ export * from "./planversion.js";
70
+ export * from "./planversionpriceslot.js";
68
71
  export * from "./planversionsummary.js";
69
72
  export * from "./price.js";
70
73
  export * from "./pricefeature.js";
@@ -103,6 +106,7 @@ export * from "./subscriptionmetadata.js";
103
106
  export * from "./subscriptionportal.js";
104
107
  export * from "./subscriptionreconciliation.js";
105
108
  export * from "./testclock.js";
109
+ export * from "./transitionplanversionrequest.js";
106
110
  export * from "./updateapprovalrequest.js";
107
111
  export * from "./updatebillingschedulerequest.js";
108
112
  export * from "./updateorderlineitemrequest.js";
@@ -0,0 +1,80 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+
7
+ export type ReplacePrice = {
8
+ /**
9
+ * Unique identifier for a price
10
+ */
11
+ replacesPriceId: string;
12
+ /**
13
+ * Unique identifier for a price
14
+ */
15
+ withPriceId: string;
16
+ };
17
+
18
+ /**
19
+ * A reference-by-id price diff applied to the prices of the plan's current version. Every id references an existing price created via POST /prices; inline price definitions are not accepted. An empty body copies the current prices into the new version unchanged. A version must carry at least one price, so a diff that would leave none is rejected.
20
+ */
21
+ export type MintPlanVersionRequest = {
22
+ /**
23
+ * Prices to add to the version. Each must not already be on the plan's current version.
24
+ */
25
+ addPrices?: Array<string> | undefined;
26
+ /**
27
+ * Prices to remove. Each must be on the plan's current version.
28
+ */
29
+ removePrices?: Array<string> | undefined;
30
+ /**
31
+ * Prices to swap in place, preserving the slot's lineage so the price keeps its identity where the plan is configured for stable price ids. replacesPriceId must be on the plan's current version; withPriceId is the new price.
32
+ */
33
+ replacePrices?: Array<ReplacePrice> | undefined;
34
+ };
35
+
36
+ /** @internal */
37
+ export type ReplacePrice$Outbound = {
38
+ replacesPriceId: string;
39
+ withPriceId: string;
40
+ };
41
+
42
+ /** @internal */
43
+ export const ReplacePrice$outboundSchema: z.ZodType<
44
+ ReplacePrice$Outbound,
45
+ z.ZodTypeDef,
46
+ ReplacePrice
47
+ > = z.object({
48
+ replacesPriceId: z.string(),
49
+ withPriceId: z.string(),
50
+ });
51
+
52
+ export function replacePriceToJSON(replacePrice: ReplacePrice): string {
53
+ return JSON.stringify(ReplacePrice$outboundSchema.parse(replacePrice));
54
+ }
55
+
56
+ /** @internal */
57
+ export type MintPlanVersionRequest$Outbound = {
58
+ addPrices?: Array<string> | undefined;
59
+ removePrices?: Array<string> | undefined;
60
+ replacePrices?: Array<ReplacePrice$Outbound> | undefined;
61
+ };
62
+
63
+ /** @internal */
64
+ export const MintPlanVersionRequest$outboundSchema: z.ZodType<
65
+ MintPlanVersionRequest$Outbound,
66
+ z.ZodTypeDef,
67
+ MintPlanVersionRequest
68
+ > = z.object({
69
+ addPrices: z.array(z.string()).optional(),
70
+ removePrices: z.array(z.string()).optional(),
71
+ replacePrices: z.array(z.lazy(() => ReplacePrice$outboundSchema)).optional(),
72
+ });
73
+
74
+ export function mintPlanVersionRequestToJSON(
75
+ mintPlanVersionRequest: MintPlanVersionRequest,
76
+ ): string {
77
+ return JSON.stringify(
78
+ MintPlanVersionRequest$outboundSchema.parse(mintPlanVersionRequest),
79
+ );
80
+ }
@@ -130,6 +130,10 @@ export type CreatePlanRequest = {
130
130
  * Credit-pool funding declarations for this plan. Each entry funds a distinct pricing unit's credit pool when a subscription to this plan activates: the allocated amount is minted as a credit grant on the customer's pool for that pricing unit, once at activation, or on a recurring basis only when that allocation explicitly sets recurrencePeriod. A plan may declare zero or more allocations; no two allocations on the same plan may target the same pricingUnitId.
131
131
  */
132
132
  creditAllocations?: Array<models.PlanCreditAllocation> | undefined;
133
+ /**
134
+ * Governs price identity when a price on this plan's default version is replaced. When true (default), replacing a price at make-default keeps the original price id live (its value changes) and the superseded value is preserved under a new id. When false, the replacement price's id goes live instead and the superseded value stays under the original id.
135
+ */
136
+ stablePriceIds?: boolean | undefined;
133
137
  };
134
138
 
135
139
  /** @internal */
@@ -171,6 +175,7 @@ export type CreatePlanRequest$Outbound = {
171
175
  billingVersion: number;
172
176
  billingAnchor?: string | null | undefined;
173
177
  creditAllocations?: Array<models.PlanCreditAllocation$Outbound> | undefined;
178
+ stablePriceIds: boolean;
174
179
  };
175
180
 
176
181
  /** @internal */
@@ -198,6 +203,7 @@ export const CreatePlanRequest$outboundSchema: z.ZodType<
198
203
  .optional(),
199
204
  creditAllocations: z.array(models.PlanCreditAllocation$outboundSchema)
200
205
  .optional(),
206
+ stablePriceIds: z.boolean().default(true),
201
207
  });
202
208
 
203
209
  export function createPlanRequestToJSON(
@@ -18,7 +18,7 @@ export type GetInvoiceRequest = {
18
18
  */
19
19
  lineItemsLimit?: number | undefined;
20
20
  /**
21
- * Pagination token for line items when expand=lineItems
21
+ * Opaque pagination token for line items when expand=lineItems, taken from a previous response's nextPageToken. Do not construct or parse this value.
22
22
  */
23
23
  lineItemsPageToken?: string | undefined;
24
24
  };
@@ -14,7 +14,7 @@ export type GetInvoiceLineItemsRequest = {
14
14
  */
15
15
  limit?: number | undefined;
16
16
  /**
17
- * Token for pagination to fetch the next page of results
17
+ * Opaque pagination token to fetch the next page of results, taken from a previous response's nextPageToken. Do not construct or parse this value.
18
18
  */
19
19
  pageToken?: string | undefined;
20
20
  };
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+
7
+ export type GetPlanVersionRequest = {
8
+ id: string;
9
+ /**
10
+ * The version number within the plan (1-based).
11
+ */
12
+ versionNumber: number;
13
+ };
14
+
15
+ /** @internal */
16
+ export type GetPlanVersionRequest$Outbound = {
17
+ id: string;
18
+ versionNumber: number;
19
+ };
20
+
21
+ /** @internal */
22
+ export const GetPlanVersionRequest$outboundSchema: z.ZodType<
23
+ GetPlanVersionRequest$Outbound,
24
+ z.ZodTypeDef,
25
+ GetPlanVersionRequest
26
+ > = z.object({
27
+ id: z.string(),
28
+ versionNumber: z.number().int(),
29
+ });
30
+
31
+ export function getPlanVersionRequestToJSON(
32
+ getPlanVersionRequest: GetPlanVersionRequest,
33
+ ): string {
34
+ return JSON.stringify(
35
+ GetPlanVersionRequest$outboundSchema.parse(getPlanVersionRequest),
36
+ );
37
+ }
@@ -61,6 +61,7 @@ export * from "./getmerchantintegration.js";
61
61
  export * from "./getorder.js";
62
62
  export * from "./getpayment.js";
63
63
  export * from "./getplan.js";
64
+ export * from "./getplanversion.js";
64
65
  export * from "./getprice.js";
65
66
  export * from "./getproduct.js";
66
67
  export * from "./getprofitability.js";
@@ -104,11 +105,13 @@ export * from "./listsourcerules.js";
104
105
  export * from "./listsources.js";
105
106
  export * from "./listsubscriptions.js";
106
107
  export * from "./listtestclocks.js";
108
+ export * from "./mintplanversion.js";
107
109
  export * from "./purchaseentitlementgrant.js";
108
110
  export * from "./reconcilesubscriptionfeatures.js";
109
111
  export * from "./rejectsourceevent.js";
110
112
  export * from "./replacescheduleintervals.js";
111
113
  export * from "./terminatesubscription.js";
114
+ export * from "./transitionplanversion.js";
112
115
  export * from "./updateapproval.js";
113
116
  export * from "./updatebillablemetric.js";
114
117
  export * from "./updatebillingschedule.js";
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import * as models from "../index.js";
8
+
9
+ export type MintPlanVersionRequest = {
10
+ id: string;
11
+ mintPlanVersionRequest: models.MintPlanVersionRequest;
12
+ };
13
+
14
+ /** @internal */
15
+ export type MintPlanVersionRequest$Outbound = {
16
+ id: string;
17
+ MintPlanVersionRequest: models.MintPlanVersionRequest$Outbound;
18
+ };
19
+
20
+ /** @internal */
21
+ export const MintPlanVersionRequest$outboundSchema: z.ZodType<
22
+ MintPlanVersionRequest$Outbound,
23
+ z.ZodTypeDef,
24
+ MintPlanVersionRequest
25
+ > = z.object({
26
+ id: z.string(),
27
+ mintPlanVersionRequest: models.MintPlanVersionRequest$outboundSchema,
28
+ }).transform((v) => {
29
+ return remap$(v, {
30
+ mintPlanVersionRequest: "MintPlanVersionRequest",
31
+ });
32
+ });
33
+
34
+ export function mintPlanVersionRequestToJSON(
35
+ mintPlanVersionRequest: MintPlanVersionRequest,
36
+ ): string {
37
+ return JSON.stringify(
38
+ MintPlanVersionRequest$outboundSchema.parse(mintPlanVersionRequest),
39
+ );
40
+ }
@@ -0,0 +1,49 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import * as models from "../index.js";
8
+
9
+ export type TransitionPlanVersionRequest = {
10
+ id: string;
11
+ /**
12
+ * The version number within the plan (1-based).
13
+ */
14
+ versionNumber: number;
15
+ transitionPlanVersionRequest: models.TransitionPlanVersionRequest;
16
+ };
17
+
18
+ /** @internal */
19
+ export type TransitionPlanVersionRequest$Outbound = {
20
+ id: string;
21
+ versionNumber: number;
22
+ TransitionPlanVersionRequest: models.TransitionPlanVersionRequest$Outbound;
23
+ };
24
+
25
+ /** @internal */
26
+ export const TransitionPlanVersionRequest$outboundSchema: z.ZodType<
27
+ TransitionPlanVersionRequest$Outbound,
28
+ z.ZodTypeDef,
29
+ TransitionPlanVersionRequest
30
+ > = z.object({
31
+ id: z.string(),
32
+ versionNumber: z.number().int(),
33
+ transitionPlanVersionRequest:
34
+ models.TransitionPlanVersionRequest$outboundSchema,
35
+ }).transform((v) => {
36
+ return remap$(v, {
37
+ transitionPlanVersionRequest: "TransitionPlanVersionRequest",
38
+ });
39
+ });
40
+
41
+ export function transitionPlanVersionRequestToJSON(
42
+ transitionPlanVersionRequest: TransitionPlanVersionRequest,
43
+ ): string {
44
+ return JSON.stringify(
45
+ TransitionPlanVersionRequest$outboundSchema.parse(
46
+ transitionPlanVersionRequest,
47
+ ),
48
+ );
49
+ }
@@ -103,6 +103,10 @@ export type UpdatePlanRequestBody = {
103
103
  * Credit-pool funding declarations for this plan. Each entry funds a distinct pricing unit's credit pool when a subscription to this plan activates: the allocated amount is minted as a credit grant on the customer's pool for that pricing unit, once at activation, or on a recurring basis only when that allocation explicitly sets recurrencePeriod. A plan may declare zero or more allocations; no two allocations on the same plan may target the same pricingUnitId.
104
104
  */
105
105
  creditAllocations?: Array<models.PlanCreditAllocation> | undefined;
106
+ /**
107
+ * Governs price identity when a price is replaced by minting a new plan version and making it default. When true (default), replacing a price at make-default keeps the original price id live (its value changes) and the superseded value is preserved under a new id. When false, the replacement price's id goes live instead and the superseded value stays under the original id. Has no effect on this request's own prices field: prices carried over keep their ids, but swapping one price for another there moves the plan to the new price's id rather than keeping the original live.
108
+ */
109
+ stablePriceIds?: boolean | undefined;
106
110
  };
107
111
 
108
112
  export type UpdatePlanRequest = {
@@ -143,6 +147,7 @@ export type UpdatePlanRequestBody$Outbound = {
143
147
  renewalReminderDays?: number | undefined;
144
148
  billingAnchor?: string | null | undefined;
145
149
  creditAllocations?: Array<models.PlanCreditAllocation$Outbound> | undefined;
150
+ stablePriceIds?: boolean | undefined;
146
151
  };
147
152
 
148
153
  /** @internal */
@@ -166,6 +171,7 @@ export const UpdatePlanRequestBody$outboundSchema: z.ZodType<
166
171
  .optional(),
167
172
  creditAllocations: z.array(models.PlanCreditAllocation$outboundSchema)
168
173
  .optional(),
174
+ stablePriceIds: z.boolean().optional(),
169
175
  });
170
176
 
171
177
  export function updatePlanRequestBodyToJSON(
@@ -122,6 +122,10 @@ export type Plan = {
122
122
  * Unique identifier for a plan version
123
123
  */
124
124
  defaultVersionId?: string | undefined;
125
+ /**
126
+ * Governs price identity when a price on this plan's default version is replaced. When true (default), replacing a price at make-default keeps the original price id live (its value changes) and the superseded value is preserved under a new id. When false, the replacement price's id goes live instead and the superseded value stays under the original id.
127
+ */
128
+ stablePriceIds: boolean;
125
129
  };
126
130
 
127
131
  /** @internal */
@@ -197,6 +201,7 @@ export const Plan$inboundSchema: z.ZodType<Plan, z.ZodTypeDef, unknown> = z
197
201
  ).optional(),
198
202
  creditAllocations: z.array(PlanCreditAllocation$inboundSchema).optional(),
199
203
  defaultVersionId: z.string().optional(),
204
+ stablePriceIds: z.boolean().default(true),
200
205
  });
201
206
 
202
207
  export function planFromJSON(
@@ -0,0 +1,113 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import { ClosedEnum } from "../types/enums.js";
8
+ import { Result as SafeParseResult } from "../types/fp.js";
9
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
10
+ import {
11
+ PlanVersionPriceSlot,
12
+ PlanVersionPriceSlot$inboundSchema,
13
+ } from "./planversionpriceslot.js";
14
+
15
+ export const PlanVersionObject = {
16
+ PlanVersion: "plan_version",
17
+ } as const;
18
+ export type PlanVersionObject = ClosedEnum<typeof PlanVersionObject>;
19
+
20
+ /**
21
+ * Lifecycle status of the version.
22
+ */
23
+ export const PlanVersionStatus = {
24
+ Draft: "draft",
25
+ Published: "published",
26
+ Archived: "archived",
27
+ } as const;
28
+ /**
29
+ * Lifecycle status of the version.
30
+ */
31
+ export type PlanVersionStatus = ClosedEnum<typeof PlanVersionStatus>;
32
+
33
+ /**
34
+ * A single plan version, including its price slots. Extends the list summary with the version's prices for draft review.
35
+ */
36
+ export type PlanVersion = {
37
+ /**
38
+ * Unique identifier for a plan version
39
+ */
40
+ id: string;
41
+ object: PlanVersionObject;
42
+ /**
43
+ * Monotonic version number within the plan, starting at 1.
44
+ */
45
+ versionNumber: number;
46
+ /**
47
+ * Lifecycle status of the version.
48
+ */
49
+ status: PlanVersionStatus;
50
+ /**
51
+ * When this version was published. Absent for draft versions.
52
+ */
53
+ publishedAt?: Date | undefined;
54
+ /**
55
+ * Whether this version is the plan's current default (live) version.
56
+ */
57
+ isDefault: boolean;
58
+ /**
59
+ * Number of committed-status subscriptions pinned to this version at creation time. Not a live-billing cohort.
60
+ */
61
+ subscriptionCount: number;
62
+ /**
63
+ * Unique identifier for a plan version
64
+ */
65
+ basedOnVersionId?: string | undefined;
66
+ /**
67
+ * When this version was last modified. Optimistic-concurrency token: read this value and echo it back as an `If-Match` header on a draft-price-mutation request to reject the write (412) if the draft changed since this read.
68
+ */
69
+ updatedAt: Date;
70
+ /**
71
+ * The price slots that make up this version.
72
+ */
73
+ prices: Array<PlanVersionPriceSlot>;
74
+ };
75
+
76
+ /** @internal */
77
+ export const PlanVersionObject$inboundSchema: z.ZodNativeEnum<
78
+ typeof PlanVersionObject
79
+ > = z.nativeEnum(PlanVersionObject);
80
+
81
+ /** @internal */
82
+ export const PlanVersionStatus$inboundSchema: z.ZodNativeEnum<
83
+ typeof PlanVersionStatus
84
+ > = z.nativeEnum(PlanVersionStatus);
85
+
86
+ /** @internal */
87
+ export const PlanVersion$inboundSchema: z.ZodType<
88
+ PlanVersion,
89
+ z.ZodTypeDef,
90
+ unknown
91
+ > = z.object({
92
+ id: z.string(),
93
+ object: PlanVersionObject$inboundSchema,
94
+ versionNumber: z.number().int(),
95
+ status: PlanVersionStatus$inboundSchema,
96
+ publishedAt: z.string().datetime({ offset: true }).transform(v => new Date(v))
97
+ .optional(),
98
+ isDefault: z.boolean(),
99
+ subscriptionCount: z.number().int(),
100
+ basedOnVersionId: z.string().optional(),
101
+ updatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
102
+ prices: z.array(PlanVersionPriceSlot$inboundSchema),
103
+ });
104
+
105
+ export function planVersionFromJSON(
106
+ jsonString: string,
107
+ ): SafeParseResult<PlanVersion, SDKValidationError> {
108
+ return safeParse(
109
+ jsonString,
110
+ (x) => PlanVersion$inboundSchema.parse(JSON.parse(x)),
111
+ `Failed to parse 'PlanVersion' from JSON`,
112
+ );
113
+ }
@@ -0,0 +1,136 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import { ClosedEnum } from "../types/enums.js";
8
+ import { Result as SafeParseResult } from "../types/fp.js";
9
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
10
+ import { PriceFeature, PriceFeature$inboundSchema } from "./pricefeature.js";
11
+
12
+ export const PlanVersionPriceSlotObject = {
13
+ Price: "price",
14
+ } as const;
15
+ export type PlanVersionPriceSlotObject = ClosedEnum<
16
+ typeof PlanVersionPriceSlotObject
17
+ >;
18
+
19
+ export const PlanVersionPriceSlotModel = {
20
+ Standard: "standard",
21
+ Dynamic: "dynamic",
22
+ Volume: "volume",
23
+ Percentage: "percentage",
24
+ } as const;
25
+ export type PlanVersionPriceSlotModel = ClosedEnum<
26
+ typeof PlanVersionPriceSlotModel
27
+ >;
28
+
29
+ export const PlanVersionPriceSlotPaymentTerm = {
30
+ InArrears: "in_arrears",
31
+ InAdvance: "in_advance",
32
+ } as const;
33
+ export type PlanVersionPriceSlotPaymentTerm = ClosedEnum<
34
+ typeof PlanVersionPriceSlotPaymentTerm
35
+ >;
36
+
37
+ /**
38
+ * One price slot on a plan version. Every `Price` field is present, plus `priceDeleted` layered on top.
39
+ */
40
+ export type PlanVersionPriceSlot = {
41
+ /**
42
+ * Unique identifier for a price
43
+ */
44
+ id: string;
45
+ object: PlanVersionPriceSlotObject;
46
+ /**
47
+ * Unique identifier for an organization
48
+ */
49
+ merchantId: string;
50
+ billableMetricId?: string | undefined;
51
+ /**
52
+ * The unique identifier for the fee referred to by this price
53
+ */
54
+ feeId?: string | undefined;
55
+ /**
56
+ * ISO 8601 duration for billing frequency (e.g., P1M for monthly)
57
+ */
58
+ billingCadence?: string | null | undefined;
59
+ createdAt: Date;
60
+ currency?: string | undefined;
61
+ description?: string | undefined;
62
+ invoiceDisplayName: string;
63
+ model: PlanVersionPriceSlotModel;
64
+ paymentTerm: PlanVersionPriceSlotPaymentTerm;
65
+ properties: { [k: string]: any };
66
+ unitAmount?: string | undefined;
67
+ updatedAt: Date;
68
+ /**
69
+ * Features associated with this price
70
+ */
71
+ features?: Array<PriceFeature> | undefined;
72
+ /**
73
+ * When true, grants applied to a subscription will discount usage charged by this price. Only supported for standard metered prices.
74
+ */
75
+ grantDiscountEnabled: boolean;
76
+ /**
77
+ * Quantity used when generating invoice line items for this price. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
78
+ */
79
+ quantity: number;
80
+ /**
81
+ * True when the underlying price this slot references has been soft-deleted. The slot can still be removed or replaced to repair the draft; it cannot be published while any slot remains dead.
82
+ */
83
+ priceDeleted: boolean;
84
+ };
85
+
86
+ /** @internal */
87
+ export const PlanVersionPriceSlotObject$inboundSchema: z.ZodNativeEnum<
88
+ typeof PlanVersionPriceSlotObject
89
+ > = z.nativeEnum(PlanVersionPriceSlotObject);
90
+
91
+ /** @internal */
92
+ export const PlanVersionPriceSlotModel$inboundSchema: z.ZodNativeEnum<
93
+ typeof PlanVersionPriceSlotModel
94
+ > = z.nativeEnum(PlanVersionPriceSlotModel);
95
+
96
+ /** @internal */
97
+ export const PlanVersionPriceSlotPaymentTerm$inboundSchema: z.ZodNativeEnum<
98
+ typeof PlanVersionPriceSlotPaymentTerm
99
+ > = z.nativeEnum(PlanVersionPriceSlotPaymentTerm);
100
+
101
+ /** @internal */
102
+ export const PlanVersionPriceSlot$inboundSchema: z.ZodType<
103
+ PlanVersionPriceSlot,
104
+ z.ZodTypeDef,
105
+ unknown
106
+ > = z.object({
107
+ id: z.string(),
108
+ object: PlanVersionPriceSlotObject$inboundSchema.default("price"),
109
+ merchantId: z.string(),
110
+ billableMetricId: z.string().optional(),
111
+ feeId: z.string().optional(),
112
+ billingCadence: z.nullable(z.string()).optional(),
113
+ createdAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
114
+ currency: z.string().optional(),
115
+ description: z.string().optional(),
116
+ invoiceDisplayName: z.string(),
117
+ model: PlanVersionPriceSlotModel$inboundSchema,
118
+ paymentTerm: PlanVersionPriceSlotPaymentTerm$inboundSchema,
119
+ properties: z.record(z.any()),
120
+ unitAmount: z.string().optional(),
121
+ updatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
122
+ features: z.array(PriceFeature$inboundSchema).optional(),
123
+ grantDiscountEnabled: z.boolean().default(false),
124
+ quantity: z.number().int().default(1),
125
+ priceDeleted: z.boolean(),
126
+ });
127
+
128
+ export function planVersionPriceSlotFromJSON(
129
+ jsonString: string,
130
+ ): SafeParseResult<PlanVersionPriceSlot, SDKValidationError> {
131
+ return safeParse(
132
+ jsonString,
133
+ (x) => PlanVersionPriceSlot$inboundSchema.parse(JSON.parse(x)),
134
+ `Failed to parse 'PlanVersionPriceSlot' from JSON`,
135
+ );
136
+ }
@@ -14,13 +14,13 @@ export const PriceObject = {
14
14
  } as const;
15
15
  export type PriceObject = ClosedEnum<typeof PriceObject>;
16
16
 
17
- export const Model = {
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 Model = ClosedEnum<typeof Model>;
23
+ export type PriceModel1 = ClosedEnum<typeof PriceModel1>;
24
24
 
25
25
  export const PricePaymentTerm = {
26
26
  InArrears: "in_arrears",
@@ -51,7 +51,7 @@ export type Price = {
51
51
  currency?: string | undefined;
52
52
  description?: string | undefined;
53
53
  invoiceDisplayName: string;
54
- model: Model;
54
+ model: PriceModel1;
55
55
  paymentTerm: PricePaymentTerm;
56
56
  properties: { [k: string]: any };
57
57
  unitAmount?: string | undefined;
@@ -75,9 +75,8 @@ export const PriceObject$inboundSchema: z.ZodNativeEnum<typeof PriceObject> = z
75
75
  .nativeEnum(PriceObject);
76
76
 
77
77
  /** @internal */
78
- export const Model$inboundSchema: z.ZodNativeEnum<typeof Model> = z.nativeEnum(
79
- Model,
80
- );
78
+ export const PriceModel1$inboundSchema: z.ZodNativeEnum<typeof PriceModel1> = z
79
+ .nativeEnum(PriceModel1);
81
80
 
82
81
  /** @internal */
83
82
  export const PricePaymentTerm$inboundSchema: z.ZodNativeEnum<
@@ -99,7 +98,7 @@ export const Price$inboundSchema: z.ZodType<Price, z.ZodTypeDef, unknown> = z
99
98
  currency: z.string().optional(),
100
99
  description: z.string().optional(),
101
100
  invoiceDisplayName: z.string(),
102
- model: Model$inboundSchema,
101
+ model: PriceModel1$inboundSchema,
103
102
  paymentTerm: PricePaymentTerm$inboundSchema,
104
103
  properties: z.record(z.any()),
105
104
  unitAmount: z.string().optional(),