dodopayments 2.32.1 → 2.33.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 (278) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/bin/migration-config.json +17 -17
  3. package/client.d.mts +15 -15
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +15 -15
  6. package/client.d.ts.map +1 -1
  7. package/package.json +1 -1
  8. package/resources/addons.d.mts +4 -4
  9. package/resources/addons.d.mts.map +1 -1
  10. package/resources/addons.d.ts +4 -4
  11. package/resources/addons.d.ts.map +1 -1
  12. package/resources/addons.js +6 -6
  13. package/resources/addons.js.map +1 -1
  14. package/resources/addons.mjs +6 -6
  15. package/resources/addons.mjs.map +1 -1
  16. package/resources/balances.d.mts +2 -2
  17. package/resources/balances.d.mts.map +1 -1
  18. package/resources/balances.d.ts +2 -2
  19. package/resources/balances.d.ts.map +1 -1
  20. package/resources/brands.d.mts +1 -1
  21. package/resources/brands.d.mts.map +1 -1
  22. package/resources/brands.d.ts +1 -1
  23. package/resources/brands.d.ts.map +1 -1
  24. package/resources/brands.js +3 -3
  25. package/resources/brands.js.map +1 -1
  26. package/resources/brands.mjs +3 -3
  27. package/resources/brands.mjs.map +1 -1
  28. package/resources/credit-entitlements/balances.d.mts +69 -69
  29. package/resources/credit-entitlements/balances.d.mts.map +1 -1
  30. package/resources/credit-entitlements/balances.d.ts +69 -69
  31. package/resources/credit-entitlements/balances.d.ts.map +1 -1
  32. package/resources/credit-entitlements/balances.js +41 -41
  33. package/resources/credit-entitlements/balances.js.map +1 -1
  34. package/resources/credit-entitlements/balances.mjs +41 -41
  35. package/resources/credit-entitlements/balances.mjs.map +1 -1
  36. package/resources/credit-entitlements/credit-entitlements.d.mts +38 -38
  37. package/resources/credit-entitlements/credit-entitlements.d.mts.map +1 -1
  38. package/resources/credit-entitlements/credit-entitlements.d.ts +38 -38
  39. package/resources/credit-entitlements/credit-entitlements.d.ts.map +1 -1
  40. package/resources/credit-entitlements/credit-entitlements.js +40 -40
  41. package/resources/credit-entitlements/credit-entitlements.js.map +1 -1
  42. package/resources/credit-entitlements/credit-entitlements.mjs +40 -40
  43. package/resources/credit-entitlements/credit-entitlements.mjs.map +1 -1
  44. package/resources/credit-entitlements/index.d.mts +2 -2
  45. package/resources/credit-entitlements/index.d.mts.map +1 -1
  46. package/resources/credit-entitlements/index.d.ts +2 -2
  47. package/resources/credit-entitlements/index.d.ts.map +1 -1
  48. package/resources/customers/customers.d.mts +23 -23
  49. package/resources/customers/customers.d.mts.map +1 -1
  50. package/resources/customers/customers.d.ts +23 -23
  51. package/resources/customers/customers.d.ts.map +1 -1
  52. package/resources/customers/customers.js +16 -16
  53. package/resources/customers/customers.js.map +1 -1
  54. package/resources/customers/customers.mjs +16 -16
  55. package/resources/customers/customers.mjs.map +1 -1
  56. package/resources/customers/index.d.mts +1 -1
  57. package/resources/customers/index.d.mts.map +1 -1
  58. package/resources/customers/index.d.ts +1 -1
  59. package/resources/customers/index.d.ts.map +1 -1
  60. package/resources/customers/wallets/index.d.mts +1 -1
  61. package/resources/customers/wallets/index.d.mts.map +1 -1
  62. package/resources/customers/wallets/index.d.ts +1 -1
  63. package/resources/customers/wallets/index.d.ts.map +1 -1
  64. package/resources/customers/wallets/ledger-entries.d.mts +8 -8
  65. package/resources/customers/wallets/ledger-entries.d.mts.map +1 -1
  66. package/resources/customers/wallets/ledger-entries.d.ts +8 -8
  67. package/resources/customers/wallets/ledger-entries.d.ts.map +1 -1
  68. package/resources/customers/wallets/ledger-entries.js +3 -3
  69. package/resources/customers/wallets/ledger-entries.js.map +1 -1
  70. package/resources/customers/wallets/ledger-entries.mjs +3 -3
  71. package/resources/customers/wallets/ledger-entries.mjs.map +1 -1
  72. package/resources/customers/wallets/wallets.d.mts +1 -1
  73. package/resources/customers/wallets/wallets.d.mts.map +1 -1
  74. package/resources/customers/wallets/wallets.d.ts +1 -1
  75. package/resources/customers/wallets/wallets.d.ts.map +1 -1
  76. package/resources/discounts.d.mts +36 -47
  77. package/resources/discounts.d.mts.map +1 -1
  78. package/resources/discounts.d.ts +36 -47
  79. package/resources/discounts.d.ts.map +1 -1
  80. package/resources/discounts.js +15 -15
  81. package/resources/discounts.js.map +1 -1
  82. package/resources/discounts.mjs +15 -15
  83. package/resources/discounts.mjs.map +1 -1
  84. package/resources/disputes.d.mts +1 -1
  85. package/resources/disputes.d.mts.map +1 -1
  86. package/resources/disputes.d.ts +1 -1
  87. package/resources/disputes.d.ts.map +1 -1
  88. package/resources/disputes.js +3 -3
  89. package/resources/disputes.js.map +1 -1
  90. package/resources/disputes.mjs +3 -3
  91. package/resources/disputes.mjs.map +1 -1
  92. package/resources/entitlements/entitlements.d.mts +15 -15
  93. package/resources/entitlements/entitlements.d.mts.map +1 -1
  94. package/resources/entitlements/entitlements.d.ts +15 -15
  95. package/resources/entitlements/entitlements.d.ts.map +1 -1
  96. package/resources/entitlements/entitlements.js +15 -15
  97. package/resources/entitlements/entitlements.js.map +1 -1
  98. package/resources/entitlements/entitlements.mjs +15 -15
  99. package/resources/entitlements/entitlements.mjs.map +1 -1
  100. package/resources/entitlements/files.d.mts +4 -4
  101. package/resources/entitlements/files.d.mts.map +1 -1
  102. package/resources/entitlements/files.d.ts +4 -4
  103. package/resources/entitlements/files.d.ts.map +1 -1
  104. package/resources/entitlements/files.js +6 -6
  105. package/resources/entitlements/files.js.map +1 -1
  106. package/resources/entitlements/files.mjs +6 -6
  107. package/resources/entitlements/files.mjs.map +1 -1
  108. package/resources/entitlements/index.d.mts +1 -1
  109. package/resources/entitlements/index.d.mts.map +1 -1
  110. package/resources/entitlements/index.d.ts +1 -1
  111. package/resources/entitlements/index.d.ts.map +1 -1
  112. package/resources/index.d.mts +15 -15
  113. package/resources/index.d.mts.map +1 -1
  114. package/resources/index.d.ts +15 -15
  115. package/resources/index.d.ts.map +1 -1
  116. package/resources/invoices/payments.d.mts +1 -1
  117. package/resources/invoices/payments.d.ts +1 -1
  118. package/resources/invoices/payments.js +4 -4
  119. package/resources/invoices/payments.mjs +4 -4
  120. package/resources/license-key-instances.d.mts +14 -14
  121. package/resources/license-key-instances.d.mts.map +1 -1
  122. package/resources/license-key-instances.d.ts +14 -14
  123. package/resources/license-key-instances.d.ts.map +1 -1
  124. package/resources/license-key-instances.js +12 -12
  125. package/resources/license-key-instances.js.map +1 -1
  126. package/resources/license-key-instances.mjs +12 -12
  127. package/resources/license-key-instances.mjs.map +1 -1
  128. package/resources/license-keys.d.mts +38 -38
  129. package/resources/license-keys.d.mts.map +1 -1
  130. package/resources/license-keys.d.ts +38 -38
  131. package/resources/license-keys.d.ts.map +1 -1
  132. package/resources/license-keys.js +16 -16
  133. package/resources/license-keys.js.map +1 -1
  134. package/resources/license-keys.mjs +16 -16
  135. package/resources/license-keys.mjs.map +1 -1
  136. package/resources/meters.d.mts +8 -8
  137. package/resources/meters.d.mts.map +1 -1
  138. package/resources/meters.d.ts +8 -8
  139. package/resources/meters.d.ts.map +1 -1
  140. package/resources/meters.js +3 -3
  141. package/resources/meters.js.map +1 -1
  142. package/resources/meters.mjs +3 -3
  143. package/resources/meters.mjs.map +1 -1
  144. package/resources/payments.d.mts +38 -32
  145. package/resources/payments.d.mts.map +1 -1
  146. package/resources/payments.d.ts +38 -32
  147. package/resources/payments.d.ts.map +1 -1
  148. package/resources/payments.js +6 -6
  149. package/resources/payments.js.map +1 -1
  150. package/resources/payments.mjs +6 -6
  151. package/resources/payments.mjs.map +1 -1
  152. package/resources/product-collections/groups/groups.d.mts +9 -9
  153. package/resources/product-collections/groups/groups.d.mts.map +1 -1
  154. package/resources/product-collections/groups/groups.d.ts +9 -9
  155. package/resources/product-collections/groups/groups.d.ts.map +1 -1
  156. package/resources/product-collections/groups/groups.js +7 -7
  157. package/resources/product-collections/groups/groups.js.map +1 -1
  158. package/resources/product-collections/groups/groups.mjs +7 -7
  159. package/resources/product-collections/groups/groups.mjs.map +1 -1
  160. package/resources/product-collections/groups/index.d.mts +2 -2
  161. package/resources/product-collections/groups/index.d.ts +2 -2
  162. package/resources/product-collections/groups/items.d.mts +12 -12
  163. package/resources/product-collections/groups/items.d.mts.map +1 -1
  164. package/resources/product-collections/groups/items.d.ts +12 -12
  165. package/resources/product-collections/groups/items.d.ts.map +1 -1
  166. package/resources/product-collections/groups/items.js +7 -7
  167. package/resources/product-collections/groups/items.js.map +1 -1
  168. package/resources/product-collections/groups/items.mjs +7 -7
  169. package/resources/product-collections/groups/items.mjs.map +1 -1
  170. package/resources/product-collections/index.d.mts +2 -2
  171. package/resources/product-collections/index.d.mts.map +1 -1
  172. package/resources/product-collections/index.d.ts +2 -2
  173. package/resources/product-collections/index.d.ts.map +1 -1
  174. package/resources/product-collections/product-collections.d.mts +86 -11
  175. package/resources/product-collections/product-collections.d.mts.map +1 -1
  176. package/resources/product-collections/product-collections.d.ts +86 -11
  177. package/resources/product-collections/product-collections.d.ts.map +1 -1
  178. package/resources/product-collections/product-collections.js +11 -11
  179. package/resources/product-collections/product-collections.js.map +1 -1
  180. package/resources/product-collections/product-collections.mjs +11 -11
  181. package/resources/product-collections/product-collections.mjs.map +1 -1
  182. package/resources/products/index.d.mts +2 -2
  183. package/resources/products/index.d.mts.map +1 -1
  184. package/resources/products/index.d.ts +2 -2
  185. package/resources/products/index.d.ts.map +1 -1
  186. package/resources/products/products.d.mts +21 -21
  187. package/resources/products/products.d.mts.map +1 -1
  188. package/resources/products/products.d.ts +21 -21
  189. package/resources/products/products.d.ts.map +1 -1
  190. package/resources/products/products.js +6 -6
  191. package/resources/products/products.js.map +1 -1
  192. package/resources/products/products.mjs +6 -6
  193. package/resources/products/products.mjs.map +1 -1
  194. package/resources/products/short-links.d.mts +11 -11
  195. package/resources/products/short-links.d.mts.map +1 -1
  196. package/resources/products/short-links.d.ts +11 -11
  197. package/resources/products/short-links.d.ts.map +1 -1
  198. package/resources/products/short-links.js +6 -6
  199. package/resources/products/short-links.js.map +1 -1
  200. package/resources/products/short-links.mjs +6 -6
  201. package/resources/products/short-links.mjs.map +1 -1
  202. package/resources/refunds.d.mts +24 -24
  203. package/resources/refunds.d.mts.map +1 -1
  204. package/resources/refunds.d.ts +24 -24
  205. package/resources/refunds.d.ts.map +1 -1
  206. package/resources/refunds.js +6 -6
  207. package/resources/refunds.js.map +1 -1
  208. package/resources/refunds.mjs +6 -6
  209. package/resources/refunds.mjs.map +1 -1
  210. package/resources/subscriptions.d.mts +86 -86
  211. package/resources/subscriptions.d.mts.map +1 -1
  212. package/resources/subscriptions.d.ts +86 -86
  213. package/resources/subscriptions.d.ts.map +1 -1
  214. package/resources/subscriptions.js +23 -23
  215. package/resources/subscriptions.js.map +1 -1
  216. package/resources/subscriptions.mjs +23 -23
  217. package/resources/subscriptions.mjs.map +1 -1
  218. package/resources/usage-events.d.mts +61 -61
  219. package/resources/usage-events.d.mts.map +1 -1
  220. package/resources/usage-events.d.ts +61 -61
  221. package/resources/usage-events.d.ts.map +1 -1
  222. package/resources/usage-events.js +56 -56
  223. package/resources/usage-events.js.map +1 -1
  224. package/resources/usage-events.mjs +56 -56
  225. package/resources/usage-events.mjs.map +1 -1
  226. package/resources/webhooks/index.d.mts +1 -1
  227. package/resources/webhooks/index.d.mts.map +1 -1
  228. package/resources/webhooks/index.d.ts +1 -1
  229. package/resources/webhooks/index.d.ts.map +1 -1
  230. package/resources/webhooks/webhooks.d.mts +12 -12
  231. package/resources/webhooks/webhooks.d.mts.map +1 -1
  232. package/resources/webhooks/webhooks.d.ts +12 -12
  233. package/resources/webhooks/webhooks.d.ts.map +1 -1
  234. package/resources/webhooks/webhooks.js +15 -15
  235. package/resources/webhooks/webhooks.js.map +1 -1
  236. package/resources/webhooks/webhooks.mjs +15 -15
  237. package/resources/webhooks/webhooks.mjs.map +1 -1
  238. package/src/client.ts +18 -18
  239. package/src/resources/addons.ts +13 -13
  240. package/src/resources/balances.ts +4 -2
  241. package/src/resources/brands.ts +4 -4
  242. package/src/resources/credit-entitlements/balances.ts +91 -91
  243. package/src/resources/credit-entitlements/credit-entitlements.ts +55 -55
  244. package/src/resources/credit-entitlements/index.ts +3 -3
  245. package/src/resources/customers/customers.ts +49 -49
  246. package/src/resources/customers/index.ts +1 -1
  247. package/src/resources/customers/wallets/index.ts +1 -1
  248. package/src/resources/customers/wallets/ledger-entries.ts +16 -16
  249. package/src/resources/customers/wallets/wallets.ts +1 -1
  250. package/src/resources/discounts.ts +52 -63
  251. package/src/resources/disputes.ts +4 -4
  252. package/src/resources/entitlements/entitlements.ts +36 -36
  253. package/src/resources/entitlements/files.ts +7 -7
  254. package/src/resources/entitlements/index.ts +1 -1
  255. package/src/resources/index.ts +18 -18
  256. package/src/resources/invoices/payments.ts +4 -4
  257. package/src/resources/license-key-instances.ts +25 -25
  258. package/src/resources/license-keys.ts +48 -48
  259. package/src/resources/meters.ts +15 -15
  260. package/src/resources/payments.ts +66 -59
  261. package/src/resources/product-collections/groups/groups.ts +16 -16
  262. package/src/resources/product-collections/groups/index.ts +2 -2
  263. package/src/resources/product-collections/groups/items.ts +19 -19
  264. package/src/resources/product-collections/index.ts +2 -2
  265. package/src/resources/product-collections/product-collections.ts +146 -26
  266. package/src/resources/products/index.ts +2 -2
  267. package/src/resources/products/products.ts +33 -33
  268. package/src/resources/products/short-links.ts +20 -20
  269. package/src/resources/refunds.ts +36 -36
  270. package/src/resources/subscriptions.ts +130 -130
  271. package/src/resources/usage-events.ts +64 -64
  272. package/src/resources/webhooks/index.ts +1 -1
  273. package/src/resources/webhooks/webhooks.ts +24 -24
  274. package/src/version.ts +1 -1
  275. package/version.d.mts +1 -1
  276. package/version.d.ts +1 -1
  277. package/version.js +1 -1
  278. package/version.mjs +1 -1
@@ -17,6 +17,16 @@ import { RequestOptions } from '../internal/request-options';
17
17
  import { path } from '../internal/utils/path';
18
18
 
19
19
  export class Subscriptions extends APIResource {
20
+ list(
21
+ query: SubscriptionListParams | null | undefined = {},
22
+ options?: RequestOptions,
23
+ ): PagePromise<SubscriptionListResponsesDefaultPageNumberPagination, SubscriptionListResponse> {
24
+ return this._client.getAPIList('/subscriptions', DefaultPageNumberPagination<SubscriptionListResponse>, {
25
+ query,
26
+ ...options,
27
+ });
28
+ }
29
+
20
30
  /**
21
31
  * @deprecated
22
32
  */
@@ -36,35 +46,6 @@ export class Subscriptions extends APIResource {
36
46
  return this._client.patch(path`/subscriptions/${subscriptionID}`, { body, ...options });
37
47
  }
38
48
 
39
- list(
40
- query: SubscriptionListParams | null | undefined = {},
41
- options?: RequestOptions,
42
- ): PagePromise<SubscriptionListResponsesDefaultPageNumberPagination, SubscriptionListResponse> {
43
- return this._client.getAPIList('/subscriptions', DefaultPageNumberPagination<SubscriptionListResponse>, {
44
- query,
45
- ...options,
46
- });
47
- }
48
-
49
- cancelChangePlan(subscriptionID: string, options?: RequestOptions): APIPromise<void> {
50
- return this._client.delete(path`/subscriptions/${subscriptionID}/change-plan/scheduled`, {
51
- ...options,
52
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
53
- });
54
- }
55
-
56
- changePlan(
57
- subscriptionID: string,
58
- body: SubscriptionChangePlanParams,
59
- options?: RequestOptions,
60
- ): APIPromise<void> {
61
- return this._client.post(path`/subscriptions/${subscriptionID}/change-plan`, {
62
- body,
63
- ...options,
64
- headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
65
- });
66
- }
67
-
68
49
  charge(
69
50
  subscriptionID: string,
70
51
  body: SubscriptionChargeParams,
@@ -73,24 +54,18 @@ export class Subscriptions extends APIResource {
73
54
  return this._client.post(path`/subscriptions/${subscriptionID}/charge`, { body, ...options });
74
55
  }
75
56
 
76
- previewChangePlan(
57
+ changePlan(
77
58
  subscriptionID: string,
78
- body: SubscriptionPreviewChangePlanParams,
59
+ body: SubscriptionChangePlanParams,
79
60
  options?: RequestOptions,
80
- ): APIPromise<SubscriptionPreviewChangePlanResponse> {
81
- return this._client.post(path`/subscriptions/${subscriptionID}/change-plan/preview`, {
61
+ ): APIPromise<void> {
62
+ return this._client.post(path`/subscriptions/${subscriptionID}/change-plan`, {
82
63
  body,
83
64
  ...options,
65
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
84
66
  });
85
67
  }
86
68
 
87
- retrieveCreditUsage(
88
- subscriptionID: string,
89
- options?: RequestOptions,
90
- ): APIPromise<SubscriptionRetrieveCreditUsageResponse> {
91
- return this._client.get(path`/subscriptions/${subscriptionID}/credit-usage`, options);
92
- }
93
-
94
69
  /**
95
70
  * Get detailed usage history for a subscription that includes usage-based billing
96
71
  * (metered components). This endpoint provides insights into customer usage
@@ -161,6 +136,31 @@ export class Subscriptions extends APIResource {
161
136
  ...options,
162
137
  });
163
138
  }
139
+
140
+ previewChangePlan(
141
+ subscriptionID: string,
142
+ body: SubscriptionPreviewChangePlanParams,
143
+ options?: RequestOptions,
144
+ ): APIPromise<SubscriptionPreviewChangePlanResponse> {
145
+ return this._client.post(path`/subscriptions/${subscriptionID}/change-plan/preview`, {
146
+ body,
147
+ ...options,
148
+ });
149
+ }
150
+
151
+ retrieveCreditUsage(
152
+ subscriptionID: string,
153
+ options?: RequestOptions,
154
+ ): APIPromise<SubscriptionRetrieveCreditUsageResponse> {
155
+ return this._client.get(path`/subscriptions/${subscriptionID}/credit-usage`, options);
156
+ }
157
+
158
+ cancelChangePlan(subscriptionID: string, options?: RequestOptions): APIPromise<void> {
159
+ return this._client.delete(path`/subscriptions/${subscriptionID}/change-plan/scheduled`, {
160
+ ...options,
161
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
162
+ });
163
+ }
164
164
  }
165
165
 
166
166
  export type SubscriptionListResponsesDefaultPageNumberPagination =
@@ -1146,6 +1146,38 @@ export interface SubscriptionUpdatePaymentMethodResponse {
1146
1146
  payment_link?: string | null;
1147
1147
  }
1148
1148
 
1149
+ export interface SubscriptionListParams extends DefaultPageNumberPaginationParams {
1150
+ /**
1151
+ * filter by Brand id
1152
+ */
1153
+ brand_id?: string;
1154
+
1155
+ /**
1156
+ * Get events after this created time
1157
+ */
1158
+ created_at_gte?: string;
1159
+
1160
+ /**
1161
+ * Get events created before this time
1162
+ */
1163
+ created_at_lte?: string;
1164
+
1165
+ /**
1166
+ * Filter by customer id
1167
+ */
1168
+ customer_id?: string;
1169
+
1170
+ /**
1171
+ * Filter by product id
1172
+ */
1173
+ product_id?: string;
1174
+
1175
+ /**
1176
+ * Filter by status
1177
+ */
1178
+ status?: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired';
1179
+ }
1180
+
1149
1181
  export interface SubscriptionCreateParams {
1150
1182
  /**
1151
1183
  * Billing address information for the subscription
@@ -1370,36 +1402,59 @@ export namespace SubscriptionUpdateParams {
1370
1402
  }
1371
1403
  }
1372
1404
 
1373
- export interface SubscriptionListParams extends DefaultPageNumberPaginationParams {
1405
+ export interface SubscriptionChargeParams {
1374
1406
  /**
1375
- * filter by Brand id
1407
+ * The product price. Represented in the lowest denomination of the currency (e.g.,
1408
+ * cents for USD). For example, to charge $1.00, pass `100`.
1376
1409
  */
1377
- brand_id?: string;
1410
+ product_price: number;
1378
1411
 
1379
1412
  /**
1380
- * Get events after this created time
1413
+ * Whether adaptive currency fees should be included in the product_price (true) or
1414
+ * added on top (false). This field is ignored if adaptive pricing is not enabled
1415
+ * for the business.
1381
1416
  */
1382
- created_at_gte?: string;
1417
+ adaptive_currency_fees_inclusive?: boolean | null;
1383
1418
 
1384
1419
  /**
1385
- * Get events created before this time
1420
+ * Specify how customer balance is used for the payment
1386
1421
  */
1387
- created_at_lte?: string;
1422
+ customer_balance_config?: SubscriptionChargeParams.CustomerBalanceConfig | null;
1388
1423
 
1389
1424
  /**
1390
- * Filter by customer id
1425
+ * Metadata for the payment. If not passed, the metadata of the subscription will
1426
+ * be taken
1391
1427
  */
1392
- customer_id?: string;
1428
+ metadata?: { [key: string]: string } | null;
1393
1429
 
1394
1430
  /**
1395
- * Filter by product id
1431
+ * Optional currency of the product price. If not specified, defaults to the
1432
+ * currency of the product.
1396
1433
  */
1397
- product_id?: string;
1434
+ product_currency?: MiscAPI.Currency | null;
1398
1435
 
1399
1436
  /**
1400
- * Filter by status
1437
+ * Optional product description override for billing and line items. If not
1438
+ * specified, the stored description of the product will be used.
1401
1439
  */
1402
- status?: 'pending' | 'active' | 'on_hold' | 'cancelled' | 'failed' | 'expired';
1440
+ product_description?: string | null;
1441
+ }
1442
+
1443
+ export namespace SubscriptionChargeParams {
1444
+ /**
1445
+ * Specify how customer balance is used for the payment
1446
+ */
1447
+ export interface CustomerBalanceConfig {
1448
+ /**
1449
+ * Allows Customer Credit to be purchased to settle payments
1450
+ */
1451
+ allow_customer_credits_purchase?: boolean | null;
1452
+
1453
+ /**
1454
+ * Allows Customer Credit Balance to be used to settle payments
1455
+ */
1456
+ allow_customer_credits_usage?: boolean | null;
1457
+ }
1403
1458
  }
1404
1459
 
1405
1460
  export interface SubscriptionChangePlanParams {
@@ -1473,58 +1528,38 @@ export interface SubscriptionChangePlanParams {
1473
1528
  on_payment_failure?: 'prevent_change' | 'apply_change' | null;
1474
1529
  }
1475
1530
 
1476
- export interface SubscriptionChargeParams {
1531
+ export interface SubscriptionRetrieveUsageHistoryParams extends DefaultPageNumberPaginationParams {
1477
1532
  /**
1478
- * The product price. Represented in the lowest denomination of the currency (e.g.,
1479
- * cents for USD). For example, to charge $1.00, pass `100`.
1533
+ * Filter by end date (inclusive)
1480
1534
  */
1481
- product_price: number;
1535
+ end_date?: string | null;
1482
1536
 
1483
1537
  /**
1484
- * Whether adaptive currency fees should be included in the product_price (true) or
1485
- * added on top (false). This field is ignored if adaptive pricing is not enabled
1486
- * for the business.
1538
+ * Filter by specific meter ID
1487
1539
  */
1488
- adaptive_currency_fees_inclusive?: boolean | null;
1540
+ meter_id?: string | null;
1489
1541
 
1490
1542
  /**
1491
- * Specify how customer balance is used for the payment
1543
+ * Filter by start date (inclusive)
1492
1544
  */
1493
- customer_balance_config?: SubscriptionChargeParams.CustomerBalanceConfig | null;
1545
+ start_date?: string | null;
1546
+ }
1494
1547
 
1495
- /**
1496
- * Metadata for the payment. If not passed, the metadata of the subscription will
1497
- * be taken
1498
- */
1499
- metadata?: { [key: string]: string } | null;
1548
+ export interface SubscriptionUpdatePaymentMethodParams {
1549
+ payment_method: SubscriptionUpdatePaymentMethodParams.New | SubscriptionUpdatePaymentMethodParams.Existing;
1550
+ }
1500
1551
 
1501
- /**
1502
- * Optional currency of the product price. If not specified, defaults to the
1503
- * currency of the product.
1504
- */
1505
- product_currency?: MiscAPI.Currency | null;
1552
+ export namespace SubscriptionUpdatePaymentMethodParams {
1553
+ export interface New {
1554
+ type: 'new';
1506
1555
 
1507
- /**
1508
- * Optional product description override for billing and line items. If not
1509
- * specified, the stored description of the product will be used.
1510
- */
1511
- product_description?: string | null;
1512
- }
1556
+ return_url?: string | null;
1557
+ }
1513
1558
 
1514
- export namespace SubscriptionChargeParams {
1515
- /**
1516
- * Specify how customer balance is used for the payment
1517
- */
1518
- export interface CustomerBalanceConfig {
1519
- /**
1520
- * Allows Customer Credit to be purchased to settle payments
1521
- */
1522
- allow_customer_credits_purchase?: boolean | null;
1559
+ export interface Existing {
1560
+ payment_method_id: string;
1523
1561
 
1524
- /**
1525
- * Allows Customer Credit Balance to be used to settle payments
1526
- */
1527
- allow_customer_credits_usage?: boolean | null;
1562
+ type: 'existing';
1528
1563
  }
1529
1564
  }
1530
1565
 
@@ -1599,41 +1634,6 @@ export interface SubscriptionPreviewChangePlanParams {
1599
1634
  on_payment_failure?: 'prevent_change' | 'apply_change' | null;
1600
1635
  }
1601
1636
 
1602
- export interface SubscriptionRetrieveUsageHistoryParams extends DefaultPageNumberPaginationParams {
1603
- /**
1604
- * Filter by end date (inclusive)
1605
- */
1606
- end_date?: string | null;
1607
-
1608
- /**
1609
- * Filter by specific meter ID
1610
- */
1611
- meter_id?: string | null;
1612
-
1613
- /**
1614
- * Filter by start date (inclusive)
1615
- */
1616
- start_date?: string | null;
1617
- }
1618
-
1619
- export interface SubscriptionUpdatePaymentMethodParams {
1620
- payment_method: SubscriptionUpdatePaymentMethodParams.New | SubscriptionUpdatePaymentMethodParams.Existing;
1621
- }
1622
-
1623
- export namespace SubscriptionUpdatePaymentMethodParams {
1624
- export interface New {
1625
- type: 'new';
1626
-
1627
- return_url?: string | null;
1628
- }
1629
-
1630
- export interface Existing {
1631
- payment_method_id: string;
1632
-
1633
- type: 'existing';
1634
- }
1635
- }
1636
-
1637
1637
  export declare namespace Subscriptions {
1638
1638
  export {
1639
1639
  type AddonCartResponseItem as AddonCartResponseItem,
@@ -1657,13 +1657,13 @@ export declare namespace Subscriptions {
1657
1657
  type SubscriptionUpdatePaymentMethodResponse as SubscriptionUpdatePaymentMethodResponse,
1658
1658
  type SubscriptionListResponsesDefaultPageNumberPagination as SubscriptionListResponsesDefaultPageNumberPagination,
1659
1659
  type SubscriptionRetrieveUsageHistoryResponsesDefaultPageNumberPagination as SubscriptionRetrieveUsageHistoryResponsesDefaultPageNumberPagination,
1660
+ type SubscriptionListParams as SubscriptionListParams,
1660
1661
  type SubscriptionCreateParams as SubscriptionCreateParams,
1661
1662
  type SubscriptionUpdateParams as SubscriptionUpdateParams,
1662
- type SubscriptionListParams as SubscriptionListParams,
1663
- type SubscriptionChangePlanParams as SubscriptionChangePlanParams,
1664
1663
  type SubscriptionChargeParams as SubscriptionChargeParams,
1665
- type SubscriptionPreviewChangePlanParams as SubscriptionPreviewChangePlanParams,
1664
+ type SubscriptionChangePlanParams as SubscriptionChangePlanParams,
1666
1665
  type SubscriptionRetrieveUsageHistoryParams as SubscriptionRetrieveUsageHistoryParams,
1667
1666
  type SubscriptionUpdatePaymentMethodParams as SubscriptionUpdatePaymentMethodParams,
1667
+ type SubscriptionPreviewChangePlanParams as SubscriptionPreviewChangePlanParams,
1668
1668
  };
1669
1669
  }
@@ -12,37 +12,47 @@ import { path } from '../internal/utils/path';
12
12
 
13
13
  export class UsageEvents extends APIResource {
14
14
  /**
15
- * Fetch detailed information about a single event using its unique event ID. This
16
- * endpoint is useful for:
17
- *
18
- * - Debugging specific event ingestion issues
19
- * - Retrieving event details for customer support
20
- * - Validating that events were processed correctly
21
- * - Getting the complete metadata for an event
22
- *
23
- * ## Event ID Format:
24
- *
25
- * The event ID should be the same value that was provided during event ingestion
26
- * via the `/events/ingest` endpoint. Event IDs are case-sensitive and must match
27
- * exactly.
15
+ * This endpoint allows you to ingest custom events that can be used for:
28
16
  *
29
- * ## Response Details:
17
+ * - Usage-based billing and metering
18
+ * - Analytics and reporting
19
+ * - Customer behavior tracking
30
20
  *
31
- * The response includes all event data including:
21
+ * ## Important Notes:
32
22
  *
33
- * - Complete metadata key-value pairs
34
- * - Original timestamp (preserved from ingestion)
35
- * - Customer and business association
36
- * - Event name and processing information
23
+ * - **Duplicate Prevention**:
24
+ * - Duplicate `event_id` values within the same request are rejected (entire
25
+ * request fails)
26
+ * - Subsequent requests with existing `event_id` values are ignored (idempotent
27
+ * behavior)
28
+ * - **Rate Limiting**: Maximum 1000 events per request
29
+ * - **Time Validation**: Events with timestamps older than 1 hour or more than 5
30
+ * minutes in the future will be rejected
31
+ * - **Metadata Limits**: Maximum 50 key-value pairs per event, keys max 100 chars,
32
+ * values max 500 chars
37
33
  *
38
34
  * ## Example Usage:
39
35
  *
40
- * ```text
41
- * GET /events/api_call_12345
36
+ * ```json
37
+ * {
38
+ * "events": [
39
+ * {
40
+ * "event_id": "api_call_12345",
41
+ * "customer_id": "cus_abc123",
42
+ * "event_name": "api_request",
43
+ * "timestamp": "2024-01-15T10:30:00Z",
44
+ * "metadata": {
45
+ * "endpoint": "/api/v1/users",
46
+ * "method": "GET",
47
+ * "tokens_used": "150"
48
+ * }
49
+ * }
50
+ * ]
51
+ * }
42
52
  * ```
43
53
  */
44
- retrieve(eventID: string, options?: RequestOptions): APIPromise<Event> {
45
- return this._client.get(path`/events/${eventID}`, options);
54
+ ingest(body: UsageEventIngestParams, options?: RequestOptions): APIPromise<UsageEventIngestResponse> {
55
+ return this._client.post('/events/ingest', { body, ...options });
46
56
  }
47
57
 
48
58
  /**
@@ -88,47 +98,37 @@ export class UsageEvents extends APIResource {
88
98
  }
89
99
 
90
100
  /**
91
- * This endpoint allows you to ingest custom events that can be used for:
101
+ * Fetch detailed information about a single event using its unique event ID. This
102
+ * endpoint is useful for:
92
103
  *
93
- * - Usage-based billing and metering
94
- * - Analytics and reporting
95
- * - Customer behavior tracking
104
+ * - Debugging specific event ingestion issues
105
+ * - Retrieving event details for customer support
106
+ * - Validating that events were processed correctly
107
+ * - Getting the complete metadata for an event
96
108
  *
97
- * ## Important Notes:
109
+ * ## Event ID Format:
98
110
  *
99
- * - **Duplicate Prevention**:
100
- * - Duplicate `event_id` values within the same request are rejected (entire
101
- * request fails)
102
- * - Subsequent requests with existing `event_id` values are ignored (idempotent
103
- * behavior)
104
- * - **Rate Limiting**: Maximum 1000 events per request
105
- * - **Time Validation**: Events with timestamps older than 1 hour or more than 5
106
- * minutes in the future will be rejected
107
- * - **Metadata Limits**: Maximum 50 key-value pairs per event, keys max 100 chars,
108
- * values max 500 chars
111
+ * The event ID should be the same value that was provided during event ingestion
112
+ * via the `/events/ingest` endpoint. Event IDs are case-sensitive and must match
113
+ * exactly.
114
+ *
115
+ * ## Response Details:
116
+ *
117
+ * The response includes all event data including:
118
+ *
119
+ * - Complete metadata key-value pairs
120
+ * - Original timestamp (preserved from ingestion)
121
+ * - Customer and business association
122
+ * - Event name and processing information
109
123
  *
110
124
  * ## Example Usage:
111
125
  *
112
- * ```json
113
- * {
114
- * "events": [
115
- * {
116
- * "event_id": "api_call_12345",
117
- * "customer_id": "cus_abc123",
118
- * "event_name": "api_request",
119
- * "timestamp": "2024-01-15T10:30:00Z",
120
- * "metadata": {
121
- * "endpoint": "/api/v1/users",
122
- * "method": "GET",
123
- * "tokens_used": "150"
124
- * }
125
- * }
126
- * ]
127
- * }
126
+ * ```text
127
+ * GET /events/api_call_12345
128
128
  * ```
129
129
  */
130
- ingest(body: UsageEventIngestParams, options?: RequestOptions): APIPromise<UsageEventIngestResponse> {
131
- return this._client.post('/events/ingest', { body, ...options });
130
+ retrieve(eventID: string, options?: RequestOptions): APIPromise<Event> {
131
+ return this._client.get(path`/events/${eventID}`, options);
132
132
  }
133
133
  }
134
134
 
@@ -185,6 +185,13 @@ export interface UsageEventIngestResponse {
185
185
  ingested_count: number;
186
186
  }
187
187
 
188
+ export interface UsageEventIngestParams {
189
+ /**
190
+ * List of events to be pushed
191
+ */
192
+ events: Array<EventInput>;
193
+ }
194
+
188
195
  export interface UsageEventListParams extends DefaultPageNumberPaginationParams {
189
196
  /**
190
197
  * Filter events by customer ID
@@ -214,20 +221,13 @@ export interface UsageEventListParams extends DefaultPageNumberPaginationParams
214
221
  start?: string;
215
222
  }
216
223
 
217
- export interface UsageEventIngestParams {
218
- /**
219
- * List of events to be pushed
220
- */
221
- events: Array<EventInput>;
222
- }
223
-
224
224
  export declare namespace UsageEvents {
225
225
  export {
226
226
  type Event as Event,
227
227
  type EventInput as EventInput,
228
228
  type UsageEventIngestResponse as UsageEventIngestResponse,
229
229
  type EventsDefaultPageNumberPagination as EventsDefaultPageNumberPagination,
230
- type UsageEventListParams as UsageEventListParams,
231
230
  type UsageEventIngestParams as UsageEventIngestParams,
231
+ type UsageEventListParams as UsageEventListParams,
232
232
  };
233
233
  }
@@ -46,8 +46,8 @@ export {
46
46
  type SubscriptionUpdatedWebhookEvent,
47
47
  type UnsafeUnwrapWebhookEvent,
48
48
  type UnwrapWebhookEvent,
49
+ type WebhookListParams,
49
50
  type WebhookCreateParams,
50
51
  type WebhookUpdateParams,
51
- type WebhookListParams,
52
52
  type WebhookDetailsCursorPagePagination,
53
53
  } from './webhooks';
@@ -21,6 +21,16 @@ import { path } from '../../internal/utils/path';
21
21
  export class Webhooks extends APIResource {
22
22
  headers: HeadersAPI.Headers = new HeadersAPI.Headers(this._client);
23
23
 
24
+ /**
25
+ * List all webhooks
26
+ */
27
+ list(
28
+ query: WebhookListParams | null | undefined = {},
29
+ options?: RequestOptions,
30
+ ): PagePromise<WebhookDetailsCursorPagePagination, WebhookDetails> {
31
+ return this._client.getAPIList('/webhooks', CursorPagePagination<WebhookDetails>, { query, ...options });
32
+ }
33
+
24
34
  /**
25
35
  * Create a new webhook
26
36
  */
@@ -35,23 +45,6 @@ export class Webhooks extends APIResource {
35
45
  return this._client.get(path`/webhooks/${webhookID}`, options);
36
46
  }
37
47
 
38
- /**
39
- * Patch a webhook by id
40
- */
41
- update(webhookID: string, body: WebhookUpdateParams, options?: RequestOptions): APIPromise<WebhookDetails> {
42
- return this._client.patch(path`/webhooks/${webhookID}`, { body, ...options });
43
- }
44
-
45
- /**
46
- * List all webhooks
47
- */
48
- list(
49
- query: WebhookListParams | null | undefined = {},
50
- options?: RequestOptions,
51
- ): PagePromise<WebhookDetailsCursorPagePagination, WebhookDetails> {
52
- return this._client.getAPIList('/webhooks', CursorPagePagination<WebhookDetails>, { query, ...options });
53
- }
54
-
55
48
  /**
56
49
  * Delete a webhook by id
57
50
  */
@@ -62,6 +55,13 @@ export class Webhooks extends APIResource {
62
55
  });
63
56
  }
64
57
 
58
+ /**
59
+ * Patch a webhook by id
60
+ */
61
+ update(webhookID: string, body: WebhookUpdateParams, options?: RequestOptions): APIPromise<WebhookDetails> {
62
+ return this._client.patch(path`/webhooks/${webhookID}`, { body, ...options });
63
+ }
64
+
65
65
  /**
66
66
  * Get webhook secret by id
67
67
  */
@@ -69,10 +69,6 @@ export class Webhooks extends APIResource {
69
69
  return this._client.get(path`/webhooks/${webhookID}/secret`, options);
70
70
  }
71
71
 
72
- unsafeUnwrap(body: string): UnsafeUnwrapWebhookEvent {
73
- return JSON.parse(body) as UnsafeUnwrapWebhookEvent;
74
- }
75
-
76
72
  unwrap(
77
73
  body: string,
78
74
  { headers, key }: { headers: Record<string, string>; key?: string },
@@ -85,6 +81,10 @@ export class Webhooks extends APIResource {
85
81
  }
86
82
  return JSON.parse(body) as UnwrapWebhookEvent;
87
83
  }
84
+
85
+ unsafeUnwrap(body: string): UnsafeUnwrapWebhookEvent {
86
+ return JSON.parse(body) as UnsafeUnwrapWebhookEvent;
87
+ }
88
88
  }
89
89
 
90
90
  export type WebhookDetailsCursorPagePagination = CursorPagePagination<WebhookDetails>;
@@ -2072,6 +2072,8 @@ export type UnwrapWebhookEvent =
2072
2072
  | SubscriptionRenewedWebhookEvent
2073
2073
  | SubscriptionUpdatedWebhookEvent;
2074
2074
 
2075
+ export interface WebhookListParams extends CursorPagePaginationParams {}
2076
+
2075
2077
  export interface WebhookCreateParams {
2076
2078
  /**
2077
2079
  * Url of the webhook
@@ -2146,8 +2148,6 @@ export interface WebhookUpdateParams {
2146
2148
  url?: string | null;
2147
2149
  }
2148
2150
 
2149
- export interface WebhookListParams extends CursorPagePaginationParams {}
2150
-
2151
2151
  Webhooks.Headers = Headers;
2152
2152
 
2153
2153
  export declare namespace Webhooks {
@@ -2196,9 +2196,9 @@ export declare namespace Webhooks {
2196
2196
  type UnsafeUnwrapWebhookEvent as UnsafeUnwrapWebhookEvent,
2197
2197
  type UnwrapWebhookEvent as UnwrapWebhookEvent,
2198
2198
  type WebhookDetailsCursorPagePagination as WebhookDetailsCursorPagePagination,
2199
+ type WebhookListParams as WebhookListParams,
2199
2200
  type WebhookCreateParams as WebhookCreateParams,
2200
2201
  type WebhookUpdateParams as WebhookUpdateParams,
2201
- type WebhookListParams as WebhookListParams,
2202
2202
  };
2203
2203
 
2204
2204
  export {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.32.1'; // x-release-please-version
1
+ export const VERSION = '2.33.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.32.1";
1
+ export declare const VERSION = "2.33.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.32.1";
1
+ export declare const VERSION = "2.33.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '2.32.1'; // x-release-please-version
4
+ exports.VERSION = '2.33.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.32.1'; // x-release-please-version
1
+ export const VERSION = '2.33.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map