@paygentic/sdk 0.7.1 → 0.7.3

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 (256) hide show
  1. package/README.md +17 -3
  2. package/dist/commonjs/funcs/customersCreateCustomerPaymentMethod.d.ts +19 -0
  3. package/dist/commonjs/funcs/customersCreateCustomerPaymentMethod.d.ts.map +1 -0
  4. package/dist/commonjs/funcs/customersCreateCustomerPaymentMethod.js +125 -0
  5. package/dist/commonjs/funcs/customersCreateCustomerPaymentMethod.js.map +1 -0
  6. package/dist/commonjs/funcs/customersListCustomerPaymentMethods.d.ts +18 -0
  7. package/dist/commonjs/funcs/customersListCustomerPaymentMethods.d.ts.map +1 -0
  8. package/dist/commonjs/funcs/customersListCustomerPaymentMethods.js +123 -0
  9. package/dist/commonjs/funcs/customersListCustomerPaymentMethods.js.map +1 -0
  10. package/dist/commonjs/funcs/invoicesV2List.js +1 -0
  11. package/dist/commonjs/funcs/invoicesV2List.js.map +1 -1
  12. package/dist/commonjs/funcs/paymentSessionsListPaymentSessions.d.ts +18 -0
  13. package/dist/commonjs/funcs/paymentSessionsListPaymentSessions.d.ts.map +1 -0
  14. package/dist/commonjs/funcs/paymentSessionsListPaymentSessions.js +127 -0
  15. package/dist/commonjs/funcs/paymentSessionsListPaymentSessions.js.map +1 -0
  16. package/dist/commonjs/funcs/profitabilityGetProfitability.d.ts +19 -0
  17. package/dist/commonjs/funcs/profitabilityGetProfitability.d.ts.map +1 -0
  18. package/dist/commonjs/funcs/profitabilityGetProfitability.js +127 -0
  19. package/dist/commonjs/funcs/profitabilityGetProfitability.js.map +1 -0
  20. package/dist/commonjs/lib/config.d.ts +2 -2
  21. package/dist/commonjs/lib/config.js +2 -2
  22. package/dist/commonjs/models/index.d.ts +6 -0
  23. package/dist/commonjs/models/index.d.ts.map +1 -1
  24. package/dist/commonjs/models/index.js +6 -0
  25. package/dist/commonjs/models/index.js.map +1 -1
  26. package/dist/commonjs/models/offsetpagination.d.ts +4 -4
  27. package/dist/commonjs/models/offsetpagination.d.ts.map +1 -1
  28. package/dist/commonjs/models/offsetpagination.js +3 -3
  29. package/dist/commonjs/models/offsetpagination.js.map +1 -1
  30. package/dist/commonjs/models/operations/createcustomerpaymentmethod.d.ts +44 -0
  31. package/dist/commonjs/models/operations/createcustomerpaymentmethod.d.ts.map +1 -0
  32. package/dist/commonjs/models/operations/createcustomerpaymentmethod.js +65 -0
  33. package/dist/commonjs/models/operations/createcustomerpaymentmethod.js.map +1 -0
  34. package/dist/commonjs/models/operations/createplan.d.ts +5 -0
  35. package/dist/commonjs/models/operations/createplan.d.ts.map +1 -1
  36. package/dist/commonjs/models/operations/createplan.js +2 -0
  37. package/dist/commonjs/models/operations/createplan.js.map +1 -1
  38. package/dist/commonjs/models/operations/getprofitability.d.ts +55 -0
  39. package/dist/commonjs/models/operations/getprofitability.d.ts.map +1 -0
  40. package/dist/commonjs/models/operations/getprofitability.js +64 -0
  41. package/dist/commonjs/models/operations/getprofitability.js.map +1 -0
  42. package/dist/commonjs/models/operations/getrevenue.d.ts +4 -4
  43. package/dist/commonjs/models/operations/getrevenue.d.ts.map +1 -1
  44. package/dist/commonjs/models/operations/getrevenue.js +4 -5
  45. package/dist/commonjs/models/operations/getrevenue.js.map +1 -1
  46. package/dist/commonjs/models/operations/index.d.ts +4 -0
  47. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  48. package/dist/commonjs/models/operations/index.js +4 -0
  49. package/dist/commonjs/models/operations/index.js.map +1 -1
  50. package/dist/commonjs/models/operations/listcustomerpaymentmethods.d.ts +35 -0
  51. package/dist/commonjs/models/operations/listcustomerpaymentmethods.d.ts.map +1 -0
  52. package/dist/commonjs/models/operations/listcustomerpaymentmethods.js +65 -0
  53. package/dist/commonjs/models/operations/listcustomerpaymentmethods.js.map +1 -0
  54. package/dist/commonjs/models/operations/listinvoices.d.ts +9 -0
  55. package/dist/commonjs/models/operations/listinvoices.d.ts.map +1 -1
  56. package/dist/commonjs/models/operations/listinvoices.js +2 -0
  57. package/dist/commonjs/models/operations/listinvoices.js.map +1 -1
  58. package/dist/commonjs/models/operations/listpaymentsessions.d.ts +36 -10
  59. package/dist/commonjs/models/operations/listpaymentsessions.d.ts.map +1 -1
  60. package/dist/commonjs/models/operations/listpaymentsessions.js +19 -4
  61. package/dist/commonjs/models/operations/listpaymentsessions.js.map +1 -1
  62. package/dist/commonjs/models/operations/updateplan.d.ts +5 -0
  63. package/dist/commonjs/models/operations/updateplan.d.ts.map +1 -1
  64. package/dist/commonjs/models/operations/updateplan.js +2 -0
  65. package/dist/commonjs/models/operations/updateplan.js.map +1 -1
  66. package/dist/commonjs/models/paymentmethod.d.ts +30 -0
  67. package/dist/commonjs/models/paymentmethod.d.ts.map +1 -0
  68. package/dist/commonjs/models/paymentmethod.js +62 -0
  69. package/dist/commonjs/models/paymentmethod.js.map +1 -0
  70. package/dist/commonjs/models/paymentsession.d.ts +53 -0
  71. package/dist/commonjs/models/paymentsession.d.ts.map +1 -0
  72. package/dist/commonjs/models/paymentsession.js +81 -0
  73. package/dist/commonjs/models/paymentsession.js.map +1 -0
  74. package/dist/commonjs/models/plan.d.ts +4 -0
  75. package/dist/commonjs/models/plan.d.ts.map +1 -1
  76. package/dist/commonjs/models/plan.js +1 -0
  77. package/dist/commonjs/models/plan.js.map +1 -1
  78. package/dist/commonjs/models/profitabilityrow.d.ts +38 -0
  79. package/dist/commonjs/models/profitabilityrow.d.ts.map +1 -0
  80. package/dist/commonjs/models/profitabilityrow.js +57 -0
  81. package/dist/commonjs/models/profitabilityrow.js.map +1 -0
  82. package/dist/commonjs/models/profitabilitysummaryresponse.d.ts +26 -0
  83. package/dist/commonjs/models/profitabilitysummaryresponse.d.ts.map +1 -0
  84. package/dist/commonjs/models/profitabilitysummaryresponse.js +54 -0
  85. package/dist/commonjs/models/profitabilitysummaryresponse.js.map +1 -0
  86. package/dist/commonjs/models/profitabilitytrend.d.ts +17 -0
  87. package/dist/commonjs/models/profitabilitytrend.d.ts.map +1 -0
  88. package/dist/commonjs/models/profitabilitytrend.js +51 -0
  89. package/dist/commonjs/models/profitabilitytrend.js.map +1 -0
  90. package/dist/commonjs/models/purchasegrantresponse.d.ts +4 -4
  91. package/dist/commonjs/models/purchasegrantresponse.d.ts.map +1 -1
  92. package/dist/commonjs/models/purchasegrantresponse.js +6 -6
  93. package/dist/commonjs/models/purchasegrantresponse.js.map +1 -1
  94. package/dist/commonjs/models/schemaspaymentsession.d.ts +68 -0
  95. package/dist/commonjs/models/schemaspaymentsession.d.ts.map +1 -0
  96. package/dist/commonjs/models/schemaspaymentsession.js +78 -0
  97. package/dist/commonjs/models/schemaspaymentsession.js.map +1 -0
  98. package/dist/commonjs/sdk/customers.d.ts +14 -0
  99. package/dist/commonjs/sdk/customers.d.ts.map +1 -1
  100. package/dist/commonjs/sdk/customers.js +20 -0
  101. package/dist/commonjs/sdk/customers.js.map +1 -1
  102. package/dist/commonjs/sdk/paymentsessions.d.ts +12 -0
  103. package/dist/commonjs/sdk/paymentsessions.d.ts.map +1 -0
  104. package/dist/commonjs/sdk/paymentsessions.js +22 -0
  105. package/dist/commonjs/sdk/paymentsessions.js.map +1 -0
  106. package/dist/commonjs/sdk/profitability.d.ts +13 -0
  107. package/dist/commonjs/sdk/profitability.d.ts.map +1 -0
  108. package/dist/commonjs/sdk/profitability.js +22 -0
  109. package/dist/commonjs/sdk/profitability.js.map +1 -0
  110. package/dist/commonjs/sdk/sdk.d.ts +6 -0
  111. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  112. package/dist/commonjs/sdk/sdk.js +8 -0
  113. package/dist/commonjs/sdk/sdk.js.map +1 -1
  114. package/dist/esm/funcs/customersCreateCustomerPaymentMethod.d.ts +19 -0
  115. package/dist/esm/funcs/customersCreateCustomerPaymentMethod.d.ts.map +1 -0
  116. package/dist/esm/funcs/customersCreateCustomerPaymentMethod.js +89 -0
  117. package/dist/esm/funcs/customersCreateCustomerPaymentMethod.js.map +1 -0
  118. package/dist/esm/funcs/customersListCustomerPaymentMethods.d.ts +18 -0
  119. package/dist/esm/funcs/customersListCustomerPaymentMethods.d.ts.map +1 -0
  120. package/dist/esm/funcs/customersListCustomerPaymentMethods.js +87 -0
  121. package/dist/esm/funcs/customersListCustomerPaymentMethods.js.map +1 -0
  122. package/dist/esm/funcs/invoicesV2List.js +1 -0
  123. package/dist/esm/funcs/invoicesV2List.js.map +1 -1
  124. package/dist/esm/funcs/paymentSessionsListPaymentSessions.d.ts +18 -0
  125. package/dist/esm/funcs/paymentSessionsListPaymentSessions.d.ts.map +1 -0
  126. package/dist/esm/funcs/paymentSessionsListPaymentSessions.js +91 -0
  127. package/dist/esm/funcs/paymentSessionsListPaymentSessions.js.map +1 -0
  128. package/dist/esm/funcs/profitabilityGetProfitability.d.ts +19 -0
  129. package/dist/esm/funcs/profitabilityGetProfitability.d.ts.map +1 -0
  130. package/dist/esm/funcs/profitabilityGetProfitability.js +91 -0
  131. package/dist/esm/funcs/profitabilityGetProfitability.js.map +1 -0
  132. package/dist/esm/lib/config.d.ts +2 -2
  133. package/dist/esm/lib/config.js +2 -2
  134. package/dist/esm/models/index.d.ts +6 -0
  135. package/dist/esm/models/index.d.ts.map +1 -1
  136. package/dist/esm/models/index.js +6 -0
  137. package/dist/esm/models/index.js.map +1 -1
  138. package/dist/esm/models/offsetpagination.d.ts +4 -4
  139. package/dist/esm/models/offsetpagination.d.ts.map +1 -1
  140. package/dist/esm/models/offsetpagination.js +3 -3
  141. package/dist/esm/models/offsetpagination.js.map +1 -1
  142. package/dist/esm/models/operations/createcustomerpaymentmethod.d.ts +44 -0
  143. package/dist/esm/models/operations/createcustomerpaymentmethod.d.ts.map +1 -0
  144. package/dist/esm/models/operations/createcustomerpaymentmethod.js +27 -0
  145. package/dist/esm/models/operations/createcustomerpaymentmethod.js.map +1 -0
  146. package/dist/esm/models/operations/createplan.d.ts +5 -0
  147. package/dist/esm/models/operations/createplan.d.ts.map +1 -1
  148. package/dist/esm/models/operations/createplan.js +2 -0
  149. package/dist/esm/models/operations/createplan.js.map +1 -1
  150. package/dist/esm/models/operations/getprofitability.d.ts +55 -0
  151. package/dist/esm/models/operations/getprofitability.d.ts.map +1 -0
  152. package/dist/esm/models/operations/getprofitability.js +27 -0
  153. package/dist/esm/models/operations/getprofitability.js.map +1 -0
  154. package/dist/esm/models/operations/getrevenue.d.ts +4 -4
  155. package/dist/esm/models/operations/getrevenue.d.ts.map +1 -1
  156. package/dist/esm/models/operations/getrevenue.js +3 -4
  157. package/dist/esm/models/operations/getrevenue.js.map +1 -1
  158. package/dist/esm/models/operations/index.d.ts +4 -0
  159. package/dist/esm/models/operations/index.d.ts.map +1 -1
  160. package/dist/esm/models/operations/index.js +4 -0
  161. package/dist/esm/models/operations/index.js.map +1 -1
  162. package/dist/esm/models/operations/listcustomerpaymentmethods.d.ts +35 -0
  163. package/dist/esm/models/operations/listcustomerpaymentmethods.d.ts.map +1 -0
  164. package/dist/esm/models/operations/listcustomerpaymentmethods.js +27 -0
  165. package/dist/esm/models/operations/listcustomerpaymentmethods.js.map +1 -0
  166. package/dist/esm/models/operations/listinvoices.d.ts +9 -0
  167. package/dist/esm/models/operations/listinvoices.d.ts.map +1 -1
  168. package/dist/esm/models/operations/listinvoices.js +2 -0
  169. package/dist/esm/models/operations/listinvoices.js.map +1 -1
  170. package/dist/esm/models/operations/listpaymentsessions.d.ts +36 -10
  171. package/dist/esm/models/operations/listpaymentsessions.d.ts.map +1 -1
  172. package/dist/esm/models/operations/listpaymentsessions.js +18 -3
  173. package/dist/esm/models/operations/listpaymentsessions.js.map +1 -1
  174. package/dist/esm/models/operations/updateplan.d.ts +5 -0
  175. package/dist/esm/models/operations/updateplan.d.ts.map +1 -1
  176. package/dist/esm/models/operations/updateplan.js +2 -0
  177. package/dist/esm/models/operations/updateplan.js.map +1 -1
  178. package/dist/esm/models/paymentmethod.d.ts +30 -0
  179. package/dist/esm/models/paymentmethod.d.ts.map +1 -0
  180. package/dist/esm/models/paymentmethod.js +25 -0
  181. package/dist/esm/models/paymentmethod.js.map +1 -0
  182. package/dist/esm/models/paymentsession.d.ts +53 -0
  183. package/dist/esm/models/paymentsession.d.ts.map +1 -0
  184. package/dist/esm/models/paymentsession.js +44 -0
  185. package/dist/esm/models/paymentsession.js.map +1 -0
  186. package/dist/esm/models/plan.d.ts +4 -0
  187. package/dist/esm/models/plan.d.ts.map +1 -1
  188. package/dist/esm/models/plan.js +1 -0
  189. package/dist/esm/models/plan.js.map +1 -1
  190. package/dist/esm/models/profitabilityrow.d.ts +38 -0
  191. package/dist/esm/models/profitabilityrow.d.ts.map +1 -0
  192. package/dist/esm/models/profitabilityrow.js +20 -0
  193. package/dist/esm/models/profitabilityrow.js.map +1 -0
  194. package/dist/esm/models/profitabilitysummaryresponse.d.ts +26 -0
  195. package/dist/esm/models/profitabilitysummaryresponse.d.ts.map +1 -0
  196. package/dist/esm/models/profitabilitysummaryresponse.js +17 -0
  197. package/dist/esm/models/profitabilitysummaryresponse.js.map +1 -0
  198. package/dist/esm/models/profitabilitytrend.d.ts +17 -0
  199. package/dist/esm/models/profitabilitytrend.d.ts.map +1 -0
  200. package/dist/esm/models/profitabilitytrend.js +14 -0
  201. package/dist/esm/models/profitabilitytrend.js.map +1 -0
  202. package/dist/esm/models/purchasegrantresponse.d.ts +4 -4
  203. package/dist/esm/models/purchasegrantresponse.d.ts.map +1 -1
  204. package/dist/esm/models/purchasegrantresponse.js +4 -4
  205. package/dist/esm/models/purchasegrantresponse.js.map +1 -1
  206. package/dist/esm/models/schemaspaymentsession.d.ts +68 -0
  207. package/dist/esm/models/schemaspaymentsession.d.ts.map +1 -0
  208. package/dist/esm/models/schemaspaymentsession.js +41 -0
  209. package/dist/esm/models/schemaspaymentsession.js.map +1 -0
  210. package/dist/esm/sdk/customers.d.ts +14 -0
  211. package/dist/esm/sdk/customers.d.ts.map +1 -1
  212. package/dist/esm/sdk/customers.js +20 -0
  213. package/dist/esm/sdk/customers.js.map +1 -1
  214. package/dist/esm/sdk/paymentsessions.d.ts +12 -0
  215. package/dist/esm/sdk/paymentsessions.d.ts.map +1 -0
  216. package/dist/esm/sdk/paymentsessions.js +18 -0
  217. package/dist/esm/sdk/paymentsessions.js.map +1 -0
  218. package/dist/esm/sdk/profitability.d.ts +13 -0
  219. package/dist/esm/sdk/profitability.d.ts.map +1 -0
  220. package/dist/esm/sdk/profitability.js +18 -0
  221. package/dist/esm/sdk/profitability.js.map +1 -0
  222. package/dist/esm/sdk/sdk.d.ts +6 -0
  223. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  224. package/dist/esm/sdk/sdk.js +8 -0
  225. package/dist/esm/sdk/sdk.js.map +1 -1
  226. package/jsr.json +1 -1
  227. package/package.json +1 -1
  228. package/src/funcs/customersCreateCustomerPaymentMethod.ts +182 -0
  229. package/src/funcs/customersListCustomerPaymentMethods.ts +176 -0
  230. package/src/funcs/invoicesV2List.ts +1 -0
  231. package/src/funcs/paymentSessionsListPaymentSessions.ts +183 -0
  232. package/src/funcs/profitabilityGetProfitability.ts +184 -0
  233. package/src/lib/config.ts +2 -2
  234. package/src/models/index.ts +6 -0
  235. package/src/models/offsetpagination.ts +7 -7
  236. package/src/models/operations/createcustomerpaymentmethod.ts +90 -0
  237. package/src/models/operations/createplan.ts +7 -0
  238. package/src/models/operations/getprofitability.ts +85 -0
  239. package/src/models/operations/getrevenue.ts +7 -6
  240. package/src/models/operations/index.ts +4 -0
  241. package/src/models/operations/listcustomerpaymentmethods.ts +82 -0
  242. package/src/models/operations/listinvoices.ts +11 -0
  243. package/src/models/operations/listpaymentsessions.ts +43 -12
  244. package/src/models/operations/updateplan.ts +7 -0
  245. package/src/models/paymentmethod.ts +62 -0
  246. package/src/models/paymentsession.ts +96 -0
  247. package/src/models/plan.ts +7 -0
  248. package/src/models/profitabilityrow.ts +68 -0
  249. package/src/models/profitabilitysummaryresponse.ts +53 -0
  250. package/src/models/profitabilitytrend.ts +39 -0
  251. package/src/models/purchasegrantresponse.ts +12 -9
  252. package/src/models/schemaspaymentsession.ts +113 -0
  253. package/src/sdk/customers.ts +36 -0
  254. package/src/sdk/paymentsessions.ts +27 -0
  255. package/src/sdk/profitability.ts +28 -0
  256. package/src/sdk/sdk.ts +12 -0
@@ -0,0 +1,90 @@
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
+
8
+ export type CreateCustomerPaymentMethodRequestBody = {
9
+ /**
10
+ * URL the customer is redirected to on success. When the page is iframed, success is reported via `postMessage` instead.
11
+ */
12
+ successRedirectUrl?: string | undefined;
13
+ /**
14
+ * URL the customer is redirected to on failure. When the page is iframed, failure is reported via `postMessage` instead.
15
+ */
16
+ failureRedirectUrl?: string | undefined;
17
+ /**
18
+ * Arbitrary key/value pairs to attach to the session.
19
+ */
20
+ metadata?: { [k: string]: any } | undefined;
21
+ };
22
+
23
+ export type CreateCustomerPaymentMethodRequest = {
24
+ /**
25
+ * The unique identifier of the customer.
26
+ */
27
+ id: string;
28
+ requestBody?: CreateCustomerPaymentMethodRequestBody | undefined;
29
+ };
30
+
31
+ /** @internal */
32
+ export type CreateCustomerPaymentMethodRequestBody$Outbound = {
33
+ successRedirectUrl?: string | undefined;
34
+ failureRedirectUrl?: string | undefined;
35
+ metadata?: { [k: string]: any } | undefined;
36
+ };
37
+
38
+ /** @internal */
39
+ export const CreateCustomerPaymentMethodRequestBody$outboundSchema: z.ZodType<
40
+ CreateCustomerPaymentMethodRequestBody$Outbound,
41
+ z.ZodTypeDef,
42
+ CreateCustomerPaymentMethodRequestBody
43
+ > = z.object({
44
+ successRedirectUrl: z.string().optional(),
45
+ failureRedirectUrl: z.string().optional(),
46
+ metadata: z.record(z.any()).optional(),
47
+ });
48
+
49
+ export function createCustomerPaymentMethodRequestBodyToJSON(
50
+ createCustomerPaymentMethodRequestBody:
51
+ CreateCustomerPaymentMethodRequestBody,
52
+ ): string {
53
+ return JSON.stringify(
54
+ CreateCustomerPaymentMethodRequestBody$outboundSchema.parse(
55
+ createCustomerPaymentMethodRequestBody,
56
+ ),
57
+ );
58
+ }
59
+
60
+ /** @internal */
61
+ export type CreateCustomerPaymentMethodRequest$Outbound = {
62
+ id: string;
63
+ RequestBody?: CreateCustomerPaymentMethodRequestBody$Outbound | undefined;
64
+ };
65
+
66
+ /** @internal */
67
+ export const CreateCustomerPaymentMethodRequest$outboundSchema: z.ZodType<
68
+ CreateCustomerPaymentMethodRequest$Outbound,
69
+ z.ZodTypeDef,
70
+ CreateCustomerPaymentMethodRequest
71
+ > = z.object({
72
+ id: z.string(),
73
+ requestBody: z.lazy(() =>
74
+ CreateCustomerPaymentMethodRequestBody$outboundSchema
75
+ ).optional(),
76
+ }).transform((v) => {
77
+ return remap$(v, {
78
+ requestBody: "RequestBody",
79
+ });
80
+ });
81
+
82
+ export function createCustomerPaymentMethodRequestToJSON(
83
+ createCustomerPaymentMethodRequest: CreateCustomerPaymentMethodRequest,
84
+ ): string {
85
+ return JSON.stringify(
86
+ CreateCustomerPaymentMethodRequest$outboundSchema.parse(
87
+ createCustomerPaymentMethodRequest,
88
+ ),
89
+ );
90
+ }
@@ -121,6 +121,10 @@ export type CreatePlanRequest = {
121
121
  * Billing engine version. 0 = legacy fee-schedule billing (Legacy), 1 = line-item billing with metered usage support (Standard).
122
122
  */
123
123
  billingVersion?: BillingVersion | undefined;
124
+ /**
125
+ * ISO 8601 datetime reference point for billing period alignment. Must be in the past or present. When set, subscriptions created under this plan align their first billing period to the next recurrence of this anchor.
126
+ */
127
+ billingAnchor?: Date | null | undefined;
124
128
  };
125
129
 
126
130
  /** @internal */
@@ -160,6 +164,7 @@ export type CreatePlanRequest$Outbound = {
160
164
  renewalReminderEnabled: boolean;
161
165
  renewalReminderDays: number;
162
166
  billingVersion: number;
167
+ billingAnchor?: string | null | undefined;
163
168
  };
164
169
 
165
170
  /** @internal */
@@ -183,6 +188,8 @@ export const CreatePlanRequest$outboundSchema: z.ZodType<
183
188
  renewalReminderEnabled: z.boolean().default(true),
184
189
  renewalReminderDays: z.number().int().default(3),
185
190
  billingVersion: BillingVersion$outboundSchema.default(0),
191
+ billingAnchor: z.nullable(z.date().transform(v => v.toISOString()))
192
+ .optional(),
186
193
  });
187
194
 
188
195
  export function createPlanRequestToJSON(
@@ -0,0 +1,85 @@
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
+ * Time bucket granularity for the per-customer revenue trend. When omitted, the server picks a reasonable bucket from the window length.
10
+ */
11
+ export const GetProfitabilityBucketWidth = {
12
+ Hour: "hour",
13
+ Day: "day",
14
+ Week: "week",
15
+ } as const;
16
+ /**
17
+ * Time bucket granularity for the per-customer revenue trend. When omitted, the server picks a reasonable bucket from the window length.
18
+ */
19
+ export type GetProfitabilityBucketWidth = ClosedEnum<
20
+ typeof GetProfitabilityBucketWidth
21
+ >;
22
+
23
+ export type GetProfitabilityRequest = {
24
+ /**
25
+ * Merchant whose customers to summarize
26
+ */
27
+ merchantId: string;
28
+ /**
29
+ * Start of the time range (ISO 8601 format)
30
+ */
31
+ from: Date;
32
+ /**
33
+ * End of the time range (ISO 8601 format)
34
+ */
35
+ to: Date;
36
+ /**
37
+ * Number of top customers (by profit) to return individually. The rest are rolled into a single 'Other' row.
38
+ */
39
+ topN?: number | undefined;
40
+ /**
41
+ * ISO 4217 currency code to scope the summary. Defaults to the merchant's primary currency.
42
+ */
43
+ currency?: string | undefined;
44
+ /**
45
+ * Time bucket granularity for the per-customer revenue trend. When omitted, the server picks a reasonable bucket from the window length.
46
+ */
47
+ bucketWidth?: GetProfitabilityBucketWidth | undefined;
48
+ };
49
+
50
+ /** @internal */
51
+ export const GetProfitabilityBucketWidth$outboundSchema: z.ZodNativeEnum<
52
+ typeof GetProfitabilityBucketWidth
53
+ > = z.nativeEnum(GetProfitabilityBucketWidth);
54
+
55
+ /** @internal */
56
+ export type GetProfitabilityRequest$Outbound = {
57
+ merchantId: string;
58
+ from: string;
59
+ to: string;
60
+ topN: number;
61
+ currency?: string | undefined;
62
+ bucketWidth: string;
63
+ };
64
+
65
+ /** @internal */
66
+ export const GetProfitabilityRequest$outboundSchema: z.ZodType<
67
+ GetProfitabilityRequest$Outbound,
68
+ z.ZodTypeDef,
69
+ GetProfitabilityRequest
70
+ > = z.object({
71
+ merchantId: z.string(),
72
+ from: z.date().transform(v => v.toISOString()),
73
+ to: z.date().transform(v => v.toISOString()),
74
+ topN: z.number().int().default(10),
75
+ currency: z.string().optional(),
76
+ bucketWidth: GetProfitabilityBucketWidth$outboundSchema.default("day"),
77
+ });
78
+
79
+ export function getProfitabilityRequestToJSON(
80
+ getProfitabilityRequest: GetProfitabilityRequest,
81
+ ): string {
82
+ return JSON.stringify(
83
+ GetProfitabilityRequest$outboundSchema.parse(getProfitabilityRequest),
84
+ );
85
+ }
@@ -8,7 +8,7 @@ import { ClosedEnum } from "../../types/enums.js";
8
8
  /**
9
9
  * Time bucket granularity for trend data
10
10
  */
11
- export const BucketWidth = {
11
+ export const GetRevenueBucketWidth = {
12
12
  Hour: "hour",
13
13
  Day: "day",
14
14
  Week: "week",
@@ -16,7 +16,7 @@ export const BucketWidth = {
16
16
  /**
17
17
  * Time bucket granularity for trend data
18
18
  */
19
- export type BucketWidth = ClosedEnum<typeof BucketWidth>;
19
+ export type GetRevenueBucketWidth = ClosedEnum<typeof GetRevenueBucketWidth>;
20
20
 
21
21
  /**
22
22
  * Group invoice data by dimension. Allowed values: 'plan' (max 5 groups, top 4 + 'other' when exceeding), 'customer' (max 25 groups, top 24 + 'other' when exceeding, sorted by revenue descending), 'currency' (one entry per currency, primary currency first then alphabetical). Note: groupBy values are mutually exclusive — combining them returns a 400 error. When groupBy=currency is active, top-level netRevenue, invoices, and payments fields are omitted; currencyBreakdown is the sole data source.
@@ -43,7 +43,7 @@ export type GetRevenueRequest = {
43
43
  /**
44
44
  * Time bucket granularity for trend data
45
45
  */
46
- bucketWidth?: BucketWidth | undefined;
46
+ bucketWidth?: GetRevenueBucketWidth | undefined;
47
47
  /**
48
48
  * Filter by merchant ID. At least one of merchantId, subscriptionIds, or customerId must be provided.
49
49
  */
@@ -67,8 +67,9 @@ export type GetRevenueRequest = {
67
67
  };
68
68
 
69
69
  /** @internal */
70
- export const BucketWidth$outboundSchema: z.ZodNativeEnum<typeof BucketWidth> = z
71
- .nativeEnum(BucketWidth);
70
+ export const GetRevenueBucketWidth$outboundSchema: z.ZodNativeEnum<
71
+ typeof GetRevenueBucketWidth
72
+ > = z.nativeEnum(GetRevenueBucketWidth);
72
73
 
73
74
  /** @internal */
74
75
  export const GroupBy$outboundSchema: z.ZodNativeEnum<typeof GroupBy> = z
@@ -94,7 +95,7 @@ export const GetRevenueRequest$outboundSchema: z.ZodType<
94
95
  > = z.object({
95
96
  startTime: z.date().transform(v => v.toISOString()),
96
97
  endTime: z.date().transform(v => v.toISOString()),
97
- bucketWidth: BucketWidth$outboundSchema.default("day"),
98
+ bucketWidth: GetRevenueBucketWidth$outboundSchema.default("day"),
98
99
  merchantId: z.string().optional(),
99
100
  customerId: z.string().optional(),
100
101
  subscriptionIds: z.array(z.string()).optional(),
@@ -9,6 +9,7 @@ export * from "./bulkrejectsourceevents.js";
9
9
  export * from "./createbillablemetric.js";
10
10
  export * from "./createcost.js";
11
11
  export * from "./createcustomer.js";
12
+ export * from "./createcustomerpaymentmethod.js";
12
13
  export * from "./createentitlementgrant.js";
13
14
  export * from "./createfeature.js";
14
15
  export * from "./createfee.js";
@@ -45,6 +46,7 @@ export * from "./getpayment.js";
45
46
  export * from "./getplan.js";
46
47
  export * from "./getprice.js";
47
48
  export * from "./getproduct.js";
49
+ export * from "./getprofitability.js";
48
50
  export * from "./getrevenue.js";
49
51
  export * from "./getsource.js";
50
52
  export * from "./getsourcerule.js";
@@ -56,6 +58,7 @@ export * from "./listavailableplans.js";
56
58
  export * from "./listbillablemetricevents.js";
57
59
  export * from "./listbillablemetrics.js";
58
60
  export * from "./listcosts.js";
61
+ export * from "./listcustomerpaymentmethods.js";
59
62
  export * from "./listcustomers.js";
60
63
  export * from "./listentitlementgrants.js";
61
64
  export * from "./listentitlements.js";
@@ -64,6 +67,7 @@ export * from "./listfees.js";
64
67
  export * from "./listinvoices.js";
65
68
  export * from "./listlineitems.js";
66
69
  export * from "./listpayments.js";
70
+ export * from "./listpaymentsessions.js";
67
71
  export * from "./listplans.js";
68
72
  export * from "./listprices.js";
69
73
  export * from "./listproducts.js";
@@ -0,0 +1,82 @@
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 * as models from "../index.js";
11
+
12
+ export type ListCustomerPaymentMethodsRequest = {
13
+ /**
14
+ * The unique identifier of the customer.
15
+ */
16
+ id: string;
17
+ };
18
+
19
+ export const ListCustomerPaymentMethodsObject = {
20
+ List: "list",
21
+ } as const;
22
+ export type ListCustomerPaymentMethodsObject = ClosedEnum<
23
+ typeof ListCustomerPaymentMethodsObject
24
+ >;
25
+
26
+ /**
27
+ * List of payment methods
28
+ */
29
+ export type ListCustomerPaymentMethodsResponse = {
30
+ object: ListCustomerPaymentMethodsObject;
31
+ data: Array<models.PaymentMethod>;
32
+ };
33
+
34
+ /** @internal */
35
+ export type ListCustomerPaymentMethodsRequest$Outbound = {
36
+ id: string;
37
+ };
38
+
39
+ /** @internal */
40
+ export const ListCustomerPaymentMethodsRequest$outboundSchema: z.ZodType<
41
+ ListCustomerPaymentMethodsRequest$Outbound,
42
+ z.ZodTypeDef,
43
+ ListCustomerPaymentMethodsRequest
44
+ > = z.object({
45
+ id: z.string(),
46
+ });
47
+
48
+ export function listCustomerPaymentMethodsRequestToJSON(
49
+ listCustomerPaymentMethodsRequest: ListCustomerPaymentMethodsRequest,
50
+ ): string {
51
+ return JSON.stringify(
52
+ ListCustomerPaymentMethodsRequest$outboundSchema.parse(
53
+ listCustomerPaymentMethodsRequest,
54
+ ),
55
+ );
56
+ }
57
+
58
+ /** @internal */
59
+ export const ListCustomerPaymentMethodsObject$inboundSchema: z.ZodNativeEnum<
60
+ typeof ListCustomerPaymentMethodsObject
61
+ > = z.nativeEnum(ListCustomerPaymentMethodsObject);
62
+
63
+ /** @internal */
64
+ export const ListCustomerPaymentMethodsResponse$inboundSchema: z.ZodType<
65
+ ListCustomerPaymentMethodsResponse,
66
+ z.ZodTypeDef,
67
+ unknown
68
+ > = z.object({
69
+ object: ListCustomerPaymentMethodsObject$inboundSchema,
70
+ data: z.array(models.PaymentMethod$inboundSchema),
71
+ });
72
+
73
+ export function listCustomerPaymentMethodsResponseFromJSON(
74
+ jsonString: string,
75
+ ): SafeParseResult<ListCustomerPaymentMethodsResponse, SDKValidationError> {
76
+ return safeParse(
77
+ jsonString,
78
+ (x) =>
79
+ ListCustomerPaymentMethodsResponse$inboundSchema.parse(JSON.parse(x)),
80
+ `Failed to parse 'ListCustomerPaymentMethodsResponse' from JSON`,
81
+ );
82
+ }
@@ -46,6 +46,10 @@ export type ListInvoicesRequest = {
46
46
  * Maximum number of invoices to return
47
47
  */
48
48
  limit?: number | undefined;
49
+ /**
50
+ * Number of invoices to skip for pagination
51
+ */
52
+ offset?: number | undefined;
49
53
  /**
50
54
  * Filter for invoices ready for processing (platform only)
51
55
  */
@@ -75,6 +79,10 @@ export type ListInvoicesObject = ClosedEnum<typeof ListInvoicesObject>;
75
79
  export type ListInvoicesResponse = {
76
80
  object: ListInvoicesObject;
77
81
  data: Array<models.Invoice>;
82
+ /**
83
+ * Offset-based pagination response.
84
+ */
85
+ pagination: models.OffsetPagination;
78
86
  };
79
87
 
80
88
  /** @internal */
@@ -89,6 +97,7 @@ export const ListInvoicesStatus$outboundSchema: z.ZodNativeEnum<
89
97
  /** @internal */
90
98
  export type ListInvoicesRequest$Outbound = {
91
99
  limit: number;
100
+ offset: number;
92
101
  nextActionAt?: string | undefined;
93
102
  status?: string | undefined;
94
103
  subscriptionId?: string | undefined;
@@ -102,6 +111,7 @@ export const ListInvoicesRequest$outboundSchema: z.ZodType<
102
111
  ListInvoicesRequest
103
112
  > = z.object({
104
113
  limit: z.number().int().default(10),
114
+ offset: z.number().int().default(0),
105
115
  nextActionAt: NextActionAt$outboundSchema.optional(),
106
116
  status: ListInvoicesStatus$outboundSchema.optional(),
107
117
  subscriptionId: z.string().optional(),
@@ -129,6 +139,7 @@ export const ListInvoicesResponse$inboundSchema: z.ZodType<
129
139
  > = z.object({
130
140
  object: ListInvoicesObject$inboundSchema,
131
141
  data: z.array(models.Invoice$inboundSchema),
142
+ pagination: models.OffsetPagination$inboundSchema,
132
143
  });
133
144
 
134
145
  export function listInvoicesResponseFromJSON(
@@ -10,41 +10,64 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
10
  import * as models from "../index.js";
11
11
 
12
12
  /**
13
- * Filter by payment status.
13
+ * Filter by payment session status.
14
14
  */
15
15
  export const ListPaymentSessionsStatus = {
16
16
  Pending: "pending",
17
17
  Processing: "processing",
18
18
  Completed: "completed",
19
+ Failed: "failed",
19
20
  Expired: "expired",
20
21
  Cancelled: "cancelled",
21
22
  } as const;
22
23
  /**
23
- * Filter by payment status.
24
+ * Filter by payment session status.
24
25
  */
25
26
  export type ListPaymentSessionsStatus = ClosedEnum<
26
27
  typeof ListPaymentSessionsStatus
27
28
  >;
28
29
 
30
+ /**
31
+ * Filter by the kind of entity the session pays for.
32
+ */
33
+ export const EntityType = {
34
+ Invoice: "invoice",
35
+ Subscription: "subscription",
36
+ Payment: "payment",
37
+ Topup: "topup",
38
+ } as const;
39
+ /**
40
+ * Filter by the kind of entity the session pays for.
41
+ */
42
+ export type EntityType = ClosedEnum<typeof EntityType>;
43
+
29
44
  export type ListPaymentSessionsRequest = {
30
45
  /**
31
46
  * Merchant organization ID. Required when using an API key that is not scoped to a single merchant.
32
47
  */
33
48
  merchantId?: string | undefined;
34
49
  /**
35
- * Filter by payment status.
50
+ * Filter to sessions linked to this subscription (its own activation session plus all of its invoices' sessions).
36
51
  */
37
- status?: ListPaymentSessionsStatus | undefined;
52
+ subscriptionId?: string | undefined;
38
53
  /**
39
- * Filter by customer ID.
54
+ * Filter to sessions linked to a payment for this customer.
40
55
  */
41
56
  customerId?: string | undefined;
42
57
  /**
43
- * Number of payments to return.
58
+ * Filter by payment session status.
59
+ */
60
+ status?: ListPaymentSessionsStatus | undefined;
61
+ /**
62
+ * Filter by the kind of entity the session pays for.
63
+ */
64
+ entityType?: EntityType | undefined;
65
+ /**
66
+ * Number of sessions to return.
44
67
  */
45
68
  limit?: number | undefined;
46
69
  /**
47
- * Number of payments to skip.
70
+ * Number of sessions to skip.
48
71
  */
49
72
  offset?: number | undefined;
50
73
  };
@@ -57,11 +80,11 @@ export type ListPaymentSessionsObject = ClosedEnum<
57
80
  >;
58
81
 
59
82
  /**
60
- * List of payments
83
+ * List of payment sessions
61
84
  */
62
85
  export type ListPaymentSessionsResponse = {
63
86
  object: ListPaymentSessionsObject;
64
- data: Array<models.Payment>;
87
+ data: Array<models.SchemasPaymentSession>;
65
88
  /**
66
89
  * Offset-based pagination response.
67
90
  */
@@ -73,11 +96,17 @@ export const ListPaymentSessionsStatus$outboundSchema: z.ZodNativeEnum<
73
96
  typeof ListPaymentSessionsStatus
74
97
  > = z.nativeEnum(ListPaymentSessionsStatus);
75
98
 
99
+ /** @internal */
100
+ export const EntityType$outboundSchema: z.ZodNativeEnum<typeof EntityType> = z
101
+ .nativeEnum(EntityType);
102
+
76
103
  /** @internal */
77
104
  export type ListPaymentSessionsRequest$Outbound = {
78
105
  merchantId?: string | undefined;
79
- status?: string | undefined;
106
+ subscriptionId?: string | undefined;
80
107
  customerId?: string | undefined;
108
+ status?: string | undefined;
109
+ entityType?: string | undefined;
81
110
  limit: number;
82
111
  offset: number;
83
112
  };
@@ -89,8 +118,10 @@ export const ListPaymentSessionsRequest$outboundSchema: z.ZodType<
89
118
  ListPaymentSessionsRequest
90
119
  > = z.object({
91
120
  merchantId: z.string().optional(),
92
- status: ListPaymentSessionsStatus$outboundSchema.optional(),
121
+ subscriptionId: z.string().optional(),
93
122
  customerId: z.string().optional(),
123
+ status: ListPaymentSessionsStatus$outboundSchema.optional(),
124
+ entityType: EntityType$outboundSchema.optional(),
94
125
  limit: z.number().int().default(10),
95
126
  offset: z.number().int().default(0),
96
127
  });
@@ -115,7 +146,7 @@ export const ListPaymentSessionsResponse$inboundSchema: z.ZodType<
115
146
  unknown
116
147
  > = z.object({
117
148
  object: ListPaymentSessionsObject$inboundSchema,
118
- data: z.array(models.Payment$inboundSchema),
149
+ data: z.array(models.SchemasPaymentSession$inboundSchema),
119
150
  pagination: models.OffsetPagination$inboundSchema,
120
151
  });
121
152
 
@@ -94,6 +94,10 @@ export type UpdatePlanRequestBody = {
94
94
  * Number of days before renewal to send the reminder email
95
95
  */
96
96
  renewalReminderDays?: number | undefined;
97
+ /**
98
+ * ISO 8601 datetime reference point for billing period alignment. Must be in the past or present. Set to null to clear the anchor and revert to start-time-based anchoring.
99
+ */
100
+ billingAnchor?: Date | null | undefined;
97
101
  };
98
102
 
99
103
  export type UpdatePlanRequest = {
@@ -132,6 +136,7 @@ export type UpdatePlanRequestBody$Outbound = {
132
136
  taxBehavior?: string | undefined;
133
137
  renewalReminderEnabled?: boolean | undefined;
134
138
  renewalReminderDays?: number | undefined;
139
+ billingAnchor?: string | null | undefined;
135
140
  };
136
141
 
137
142
  /** @internal */
@@ -151,6 +156,8 @@ export const UpdatePlanRequestBody$outboundSchema: z.ZodType<
151
156
  taxBehavior: UpdatePlanTaxBehavior$outboundSchema.optional(),
152
157
  renewalReminderEnabled: z.boolean().optional(),
153
158
  renewalReminderDays: z.number().int().optional(),
159
+ billingAnchor: z.nullable(z.date().transform(v => v.toISOString()))
160
+ .optional(),
154
161
  });
155
162
 
156
163
  export function updatePlanRequestBodyToJSON(
@@ -0,0 +1,62 @@
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
+
11
+ export const PaymentMethodObject = {
12
+ PaymentMethod: "paymentMethod",
13
+ } as const;
14
+ export type PaymentMethodObject = ClosedEnum<typeof PaymentMethodObject>;
15
+
16
+ export type PaymentMethod = {
17
+ object: PaymentMethodObject;
18
+ /**
19
+ * Payment method identifier.
20
+ */
21
+ id: string;
22
+ /**
23
+ * Payment method type (e.g. `card`, `sepa_debit`).
24
+ */
25
+ type?: string | null | undefined;
26
+ brand?: string | null | undefined;
27
+ last4?: string | null | undefined;
28
+ expMonth?: number | null | undefined;
29
+ expYear?: number | null | undefined;
30
+ createdAt: Date;
31
+ };
32
+
33
+ /** @internal */
34
+ export const PaymentMethodObject$inboundSchema: z.ZodNativeEnum<
35
+ typeof PaymentMethodObject
36
+ > = z.nativeEnum(PaymentMethodObject);
37
+
38
+ /** @internal */
39
+ export const PaymentMethod$inboundSchema: z.ZodType<
40
+ PaymentMethod,
41
+ z.ZodTypeDef,
42
+ unknown
43
+ > = z.object({
44
+ object: PaymentMethodObject$inboundSchema,
45
+ id: z.string(),
46
+ type: z.nullable(z.string()).optional(),
47
+ brand: z.nullable(z.string()).optional(),
48
+ last4: z.nullable(z.string()).optional(),
49
+ expMonth: z.nullable(z.number().int()).optional(),
50
+ expYear: z.nullable(z.number().int()).optional(),
51
+ createdAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
52
+ });
53
+
54
+ export function paymentMethodFromJSON(
55
+ jsonString: string,
56
+ ): SafeParseResult<PaymentMethod, SDKValidationError> {
57
+ return safeParse(
58
+ jsonString,
59
+ (x) => PaymentMethod$inboundSchema.parse(JSON.parse(x)),
60
+ `Failed to parse 'PaymentMethod' from JSON`,
61
+ );
62
+ }