@usehercules/sdk 1.2.0 → 1.4.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 (209) hide show
  1. package/CHANGELOG.md +129 -0
  2. package/LICENSE +1 -1
  3. package/README.md +14 -20
  4. package/client.d.mts +6 -3
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +6 -3
  7. package/client.d.ts.map +1 -1
  8. package/client.js +1 -1
  9. package/client.js.map +1 -1
  10. package/client.mjs +1 -1
  11. package/client.mjs.map +1 -1
  12. package/package.json +1 -1
  13. package/resources/beta/beta.d.mts +4 -4
  14. package/resources/beta/beta.d.mts.map +1 -1
  15. package/resources/beta/beta.d.ts +4 -4
  16. package/resources/beta/beta.d.ts.map +1 -1
  17. package/resources/beta/beta.js +4 -4
  18. package/resources/beta/beta.js.map +1 -1
  19. package/resources/beta/beta.mjs +4 -4
  20. package/resources/beta/beta.mjs.map +1 -1
  21. package/resources/beta/index.d.mts +1 -1
  22. package/resources/beta/index.d.mts.map +1 -1
  23. package/resources/beta/index.d.ts +1 -1
  24. package/resources/beta/index.d.ts.map +1 -1
  25. package/resources/beta/index.js +3 -3
  26. package/resources/beta/index.js.map +1 -1
  27. package/resources/beta/index.mjs +1 -1
  28. package/resources/beta/index.mjs.map +1 -1
  29. package/resources/beta/pay/coupons.d.mts +156 -0
  30. package/resources/beta/pay/coupons.d.mts.map +1 -0
  31. package/resources/beta/pay/coupons.d.ts +156 -0
  32. package/resources/beta/pay/coupons.d.ts.map +1 -0
  33. package/resources/beta/pay/coupons.js +51 -0
  34. package/resources/beta/pay/coupons.js.map +1 -0
  35. package/resources/beta/pay/coupons.mjs +47 -0
  36. package/resources/beta/pay/coupons.mjs.map +1 -0
  37. package/resources/beta/pay/customers.d.mts +160 -0
  38. package/resources/beta/pay/customers.d.mts.map +1 -0
  39. package/resources/beta/pay/customers.d.ts +160 -0
  40. package/resources/beta/pay/customers.d.ts.map +1 -0
  41. package/resources/beta/pay/customers.js +60 -0
  42. package/resources/beta/pay/customers.js.map +1 -0
  43. package/resources/beta/pay/customers.mjs +56 -0
  44. package/resources/beta/pay/customers.mjs.map +1 -0
  45. package/resources/beta/{subscriptions → pay}/entitlements.d.mts +25 -19
  46. package/resources/beta/pay/entitlements.d.mts.map +1 -0
  47. package/resources/beta/{subscriptions → pay}/entitlements.d.ts +25 -19
  48. package/resources/beta/pay/entitlements.d.ts.map +1 -0
  49. package/resources/beta/pay/entitlements.js +41 -0
  50. package/resources/beta/pay/entitlements.js.map +1 -0
  51. package/resources/beta/pay/entitlements.mjs +37 -0
  52. package/resources/beta/pay/entitlements.mjs.map +1 -0
  53. package/resources/beta/{subscriptions → pay}/index.d.mts +2 -2
  54. package/resources/beta/pay/index.d.mts.map +1 -0
  55. package/resources/beta/{subscriptions → pay}/index.d.ts +2 -2
  56. package/resources/beta/pay/index.d.ts.map +1 -0
  57. package/resources/beta/{subscriptions → pay}/index.js +5 -5
  58. package/resources/beta/pay/index.js.map +1 -0
  59. package/resources/beta/{subscriptions → pay}/index.mjs +2 -2
  60. package/resources/beta/pay/index.mjs.map +1 -0
  61. package/resources/beta/pay/pay.d.mts +206 -0
  62. package/resources/beta/pay/pay.d.mts.map +1 -0
  63. package/resources/beta/pay/pay.d.ts +206 -0
  64. package/resources/beta/pay/pay.d.ts.map +1 -0
  65. package/resources/beta/pay/pay.js +54 -0
  66. package/resources/beta/pay/pay.js.map +1 -0
  67. package/resources/beta/pay/pay.mjs +49 -0
  68. package/resources/beta/pay/pay.mjs.map +1 -0
  69. package/resources/beta/pay/products/entitlements.d.mts +53 -0
  70. package/resources/beta/pay/products/entitlements.d.mts.map +1 -0
  71. package/resources/beta/pay/products/entitlements.d.ts +53 -0
  72. package/resources/beta/pay/products/entitlements.d.ts.map +1 -0
  73. package/resources/beta/pay/products/entitlements.js +38 -0
  74. package/resources/beta/pay/products/entitlements.js.map +1 -0
  75. package/resources/beta/pay/products/entitlements.mjs +34 -0
  76. package/resources/beta/pay/products/entitlements.mjs.map +1 -0
  77. package/resources/beta/pay/products/index.d.mts +4 -0
  78. package/resources/beta/pay/products/index.d.mts.map +1 -0
  79. package/resources/beta/pay/products/index.d.ts +4 -0
  80. package/resources/beta/pay/products/index.d.ts.map +1 -0
  81. package/resources/beta/pay/products/index.js +11 -0
  82. package/resources/beta/pay/products/index.js.map +1 -0
  83. package/resources/beta/{subscriptions/plans → pay/products}/index.mjs +2 -1
  84. package/resources/beta/pay/products/index.mjs.map +1 -0
  85. package/resources/beta/pay/products/products.d.mts +183 -0
  86. package/resources/beta/pay/products/products.d.mts.map +1 -0
  87. package/resources/beta/pay/products/products.d.ts +183 -0
  88. package/resources/beta/pay/products/products.d.ts.map +1 -0
  89. package/resources/beta/pay/products/products.js +61 -0
  90. package/resources/beta/pay/products/products.js.map +1 -0
  91. package/resources/beta/pay/products/products.mjs +56 -0
  92. package/resources/beta/pay/products/products.mjs.map +1 -0
  93. package/resources/beta/pay/products/variants.d.mts +206 -0
  94. package/resources/beta/pay/products/variants.d.mts.map +1 -0
  95. package/resources/beta/pay/products/variants.d.ts +206 -0
  96. package/resources/beta/pay/products/variants.d.ts.map +1 -0
  97. package/resources/beta/pay/products/variants.js +56 -0
  98. package/resources/beta/pay/products/variants.js.map +1 -0
  99. package/resources/beta/pay/products/variants.mjs +52 -0
  100. package/resources/beta/pay/products/variants.mjs.map +1 -0
  101. package/resources/beta/pay/products.d.mts +2 -0
  102. package/resources/beta/pay/products.d.mts.map +1 -0
  103. package/resources/beta/pay/products.d.ts +2 -0
  104. package/resources/beta/pay/products.d.ts.map +1 -0
  105. package/resources/beta/{subscriptions/plans.js → pay/products.js} +2 -2
  106. package/resources/beta/pay/products.js.map +1 -0
  107. package/resources/beta/{subscriptions.mjs → pay/products.mjs} +2 -2
  108. package/resources/beta/pay/products.mjs.map +1 -0
  109. package/resources/beta/pay.d.mts +2 -0
  110. package/resources/beta/pay.d.mts.map +1 -0
  111. package/resources/beta/pay.d.ts +2 -0
  112. package/resources/beta/pay.d.ts.map +1 -0
  113. package/resources/beta/{subscriptions.js → pay.js} +2 -2
  114. package/resources/beta/pay.js.map +1 -0
  115. package/resources/beta/{subscriptions/plans.mjs → pay.mjs} +2 -2
  116. package/resources/beta/pay.mjs.map +1 -0
  117. package/src/client.ts +6 -4
  118. package/src/resources/beta/beta.ts +18 -18
  119. package/src/resources/beta/index.ts +8 -8
  120. package/src/resources/beta/pay/coupons.ts +218 -0
  121. package/src/resources/beta/pay/customers.ts +229 -0
  122. package/src/resources/beta/{subscriptions → pay}/entitlements.ts +29 -29
  123. package/src/resources/beta/{subscriptions → pay}/index.ts +15 -15
  124. package/src/resources/beta/pay/pay.ts +326 -0
  125. package/src/resources/beta/{subscriptions/plans → pay/products}/entitlements.ts +26 -21
  126. package/src/resources/beta/pay/products/index.ts +28 -0
  127. package/src/resources/beta/pay/products/products.ts +280 -0
  128. package/src/resources/beta/pay/products/variants.ts +279 -0
  129. package/src/resources/beta/{subscriptions.ts → pay/products.ts} +1 -1
  130. package/src/resources/beta/{subscriptions/plans.ts → pay.ts} +1 -1
  131. package/src/version.ts +1 -1
  132. package/version.d.mts +1 -1
  133. package/version.d.ts +1 -1
  134. package/version.js +1 -1
  135. package/version.mjs +1 -1
  136. package/resources/beta/subscriptions/coupons.d.mts +0 -124
  137. package/resources/beta/subscriptions/coupons.d.mts.map +0 -1
  138. package/resources/beta/subscriptions/coupons.d.ts +0 -124
  139. package/resources/beta/subscriptions/coupons.d.ts.map +0 -1
  140. package/resources/beta/subscriptions/coupons.js +0 -45
  141. package/resources/beta/subscriptions/coupons.js.map +0 -1
  142. package/resources/beta/subscriptions/coupons.mjs +0 -41
  143. package/resources/beta/subscriptions/coupons.mjs.map +0 -1
  144. package/resources/beta/subscriptions/customers.d.mts +0 -93
  145. package/resources/beta/subscriptions/customers.d.mts.map +0 -1
  146. package/resources/beta/subscriptions/customers.d.ts +0 -93
  147. package/resources/beta/subscriptions/customers.d.ts.map +0 -1
  148. package/resources/beta/subscriptions/customers.js +0 -57
  149. package/resources/beta/subscriptions/customers.js.map +0 -1
  150. package/resources/beta/subscriptions/customers.mjs +0 -53
  151. package/resources/beta/subscriptions/customers.mjs.map +0 -1
  152. package/resources/beta/subscriptions/entitlements.d.mts.map +0 -1
  153. package/resources/beta/subscriptions/entitlements.d.ts.map +0 -1
  154. package/resources/beta/subscriptions/entitlements.js +0 -38
  155. package/resources/beta/subscriptions/entitlements.js.map +0 -1
  156. package/resources/beta/subscriptions/entitlements.mjs +0 -34
  157. package/resources/beta/subscriptions/entitlements.mjs.map +0 -1
  158. package/resources/beta/subscriptions/index.d.mts.map +0 -1
  159. package/resources/beta/subscriptions/index.d.ts.map +0 -1
  160. package/resources/beta/subscriptions/index.js.map +0 -1
  161. package/resources/beta/subscriptions/index.mjs.map +0 -1
  162. package/resources/beta/subscriptions/plans/entitlements.d.mts +0 -48
  163. package/resources/beta/subscriptions/plans/entitlements.d.mts.map +0 -1
  164. package/resources/beta/subscriptions/plans/entitlements.d.ts +0 -48
  165. package/resources/beta/subscriptions/plans/entitlements.d.ts.map +0 -1
  166. package/resources/beta/subscriptions/plans/entitlements.js +0 -34
  167. package/resources/beta/subscriptions/plans/entitlements.js.map +0 -1
  168. package/resources/beta/subscriptions/plans/entitlements.mjs +0 -30
  169. package/resources/beta/subscriptions/plans/entitlements.mjs.map +0 -1
  170. package/resources/beta/subscriptions/plans/index.d.mts +0 -3
  171. package/resources/beta/subscriptions/plans/index.d.mts.map +0 -1
  172. package/resources/beta/subscriptions/plans/index.d.ts +0 -3
  173. package/resources/beta/subscriptions/plans/index.d.ts.map +0 -1
  174. package/resources/beta/subscriptions/plans/index.js +0 -9
  175. package/resources/beta/subscriptions/plans/index.js.map +0 -1
  176. package/resources/beta/subscriptions/plans/index.mjs.map +0 -1
  177. package/resources/beta/subscriptions/plans/plans.d.mts +0 -87
  178. package/resources/beta/subscriptions/plans/plans.d.mts.map +0 -1
  179. package/resources/beta/subscriptions/plans/plans.d.ts +0 -87
  180. package/resources/beta/subscriptions/plans/plans.d.ts.map +0 -1
  181. package/resources/beta/subscriptions/plans/plans.js +0 -49
  182. package/resources/beta/subscriptions/plans/plans.js.map +0 -1
  183. package/resources/beta/subscriptions/plans/plans.mjs +0 -44
  184. package/resources/beta/subscriptions/plans/plans.mjs.map +0 -1
  185. package/resources/beta/subscriptions/plans.d.mts +0 -2
  186. package/resources/beta/subscriptions/plans.d.mts.map +0 -1
  187. package/resources/beta/subscriptions/plans.d.ts +0 -2
  188. package/resources/beta/subscriptions/plans.d.ts.map +0 -1
  189. package/resources/beta/subscriptions/plans.js.map +0 -1
  190. package/resources/beta/subscriptions/plans.mjs.map +0 -1
  191. package/resources/beta/subscriptions/subscriptions.d.mts +0 -130
  192. package/resources/beta/subscriptions/subscriptions.d.mts.map +0 -1
  193. package/resources/beta/subscriptions/subscriptions.d.ts +0 -130
  194. package/resources/beta/subscriptions/subscriptions.d.ts.map +0 -1
  195. package/resources/beta/subscriptions/subscriptions.js +0 -47
  196. package/resources/beta/subscriptions/subscriptions.js.map +0 -1
  197. package/resources/beta/subscriptions/subscriptions.mjs +0 -42
  198. package/resources/beta/subscriptions/subscriptions.mjs.map +0 -1
  199. package/resources/beta/subscriptions.d.mts +0 -2
  200. package/resources/beta/subscriptions.d.mts.map +0 -1
  201. package/resources/beta/subscriptions.d.ts +0 -2
  202. package/resources/beta/subscriptions.d.ts.map +0 -1
  203. package/resources/beta/subscriptions.js.map +0 -1
  204. package/resources/beta/subscriptions.mjs.map +0 -1
  205. package/src/resources/beta/subscriptions/coupons.ts +0 -185
  206. package/src/resources/beta/subscriptions/customers.ts +0 -168
  207. package/src/resources/beta/subscriptions/plans/index.ts +0 -18
  208. package/src/resources/beta/subscriptions/plans/plans.ts +0 -159
  209. package/src/resources/beta/subscriptions/subscriptions.ts +0 -241
@@ -0,0 +1,280 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../../core/resource';
4
+ import * as EntitlementsAPI from './entitlements';
5
+ import {
6
+ EntitlementAttachParams,
7
+ EntitlementListParams,
8
+ EntitlementRemoveParams,
9
+ Entitlements,
10
+ ProductEntitlement,
11
+ ProductEntitlementsCursorIDPage,
12
+ } from './entitlements';
13
+ import * as VariantsAPI from './variants';
14
+ import {
15
+ Variant,
16
+ VariantArchiveParams,
17
+ VariantCreateParams,
18
+ VariantGetParams,
19
+ VariantListParams,
20
+ VariantUpdateParams,
21
+ Variants,
22
+ VariantsCursorIDPage,
23
+ } from './variants';
24
+ import { APIPromise } from '../../../../core/api-promise';
25
+ import { CursorIDPage, type CursorIDPageParams, PagePromise } from '../../../../core/pagination';
26
+ import { RequestOptions } from '../../../../internal/request-options';
27
+ import { path } from '../../../../internal/utils/path';
28
+
29
+ export class Products extends APIResource {
30
+ entitlements: EntitlementsAPI.Entitlements = new EntitlementsAPI.Entitlements(this._client);
31
+ variants: VariantsAPI.Variants = new VariantsAPI.Variants(this._client);
32
+
33
+ /**
34
+ * Creates a new subscription product with a recurring price. Common examples
35
+ * include Free, Pro, Business, or Teams tiers. After creating a product, attach
36
+ * entitlements to define which features customers on this product can access.
37
+ */
38
+ create(body: ProductCreateParams, options?: RequestOptions): APIPromise<Product> {
39
+ return this._client.post('/v1/pay/products', { body, ...options });
40
+ }
41
+
42
+ /**
43
+ * Updates an existing product. Use this to modify the product name, description,
44
+ * or active status. Pricing cannot be changed after creation—create a new product
45
+ * instead.
46
+ */
47
+ update(
48
+ productID: string,
49
+ body: ProductUpdateParams | null | undefined = {},
50
+ options?: RequestOptions,
51
+ ): APIPromise<Product> {
52
+ return this._client.patch(path`/v1/pay/products/${productID}`, { body, ...options });
53
+ }
54
+
55
+ /**
56
+ * Retrieves a paginated list of subscription products. Products define the pricing
57
+ * and billing intervals for subscriptions. Each product can have entitlements
58
+ * attached that grant features to subscribed customers.
59
+ */
60
+ list(
61
+ query: ProductListParams | null | undefined = {},
62
+ options?: RequestOptions,
63
+ ): PagePromise<ProductsCursorIDPage, Product> {
64
+ return this._client.getAPIList('/v1/pay/products', CursorIDPage<Product>, { query, ...options });
65
+ }
66
+
67
+ /**
68
+ * Archives a product, preventing new subscriptions. Existing subscriptions remain
69
+ * active. Use this instead of deletion to preserve subscription history.
70
+ */
71
+ archive(productID: string, options?: RequestOptions): APIPromise<Product> {
72
+ return this._client.delete(path`/v1/pay/products/${productID}`, options);
73
+ }
74
+
75
+ /**
76
+ * Retrieves a product by ID. Returns the product object including pricing details
77
+ * and status.
78
+ */
79
+ get(productID: string, options?: RequestOptions): APIPromise<Product> {
80
+ return this._client.get(path`/v1/pay/products/${productID}`, options);
81
+ }
82
+ }
83
+
84
+ export type ProductsCursorIDPage = CursorIDPage<Product>;
85
+
86
+ /**
87
+ * A product that customers can purchase. Products can be one-time purchases or
88
+ * recurring subscriptions. Attach entitlements to a product to grant features to
89
+ * customers.
90
+ */
91
+ export interface Product {
92
+ /**
93
+ * Unique identifier for the price
94
+ */
95
+ id: string;
96
+
97
+ /**
98
+ * Whether the product is available for new purchases
99
+ */
100
+ active: boolean;
101
+
102
+ /**
103
+ * Timestamp when the product was created
104
+ */
105
+ created: string;
106
+
107
+ /**
108
+ * Display name for the product (e.g., Pro, Business, Teams)
109
+ */
110
+ name: string;
111
+
112
+ /**
113
+ * Price configuration for a product. Can be one-time or recurring (subscription).
114
+ */
115
+ default_price?: Product.DefaultPrice | null;
116
+
117
+ /**
118
+ * Detailed description of what the product includes
119
+ */
120
+ description?: string | null;
121
+ }
122
+
123
+ export namespace Product {
124
+ /**
125
+ * Price configuration for a product. Can be one-time or recurring (subscription).
126
+ */
127
+ export interface DefaultPrice {
128
+ /**
129
+ * Unique identifier for the price
130
+ */
131
+ id: string;
132
+
133
+ /**
134
+ * How to handle the billing cycle when switching plans. 'now' resets to current
135
+ * time, 'unchanged' keeps the original anchor. Null for one-time prices.
136
+ */
137
+ billing_cycle_anchor: 'now' | 'unchanged' | null;
138
+
139
+ /**
140
+ * Three-letter ISO currency code (e.g., usd, eur)
141
+ */
142
+ currency: string;
143
+
144
+ /**
145
+ * Billing frequency for recurring prices: day, week, month, or year. Null for
146
+ * one-time prices.
147
+ */
148
+ interval: 'day' | 'week' | 'month' | 'year' | null;
149
+
150
+ /**
151
+ * Number of intervals between billings for recurring prices. Null for one-time
152
+ * prices.
153
+ */
154
+ interval_count: number | null;
155
+
156
+ /**
157
+ * How to handle prorations when switching plans. 'default' creates prorations,
158
+ * 'none' disables them. Null for one-time prices.
159
+ */
160
+ proration_behavior: 'default' | 'none' | null;
161
+
162
+ /**
163
+ * When to calculate proration. 'now' uses current time, 'start_of_period' uses the
164
+ * billing period start. Null for one-time prices or to use Stripe's default.
165
+ */
166
+ proration_date: 'now' | 'start_of_period' | null;
167
+
168
+ /**
169
+ * Price type: one_time for single purchases, recurring for subscriptions
170
+ */
171
+ type: 'one_time' | 'recurring';
172
+
173
+ /**
174
+ * Price amount in the smallest currency unit (e.g., cents)
175
+ */
176
+ unit_amount: number | null;
177
+ }
178
+ }
179
+
180
+ export interface ProductCreateParams {
181
+ /**
182
+ * Display name for the product (e.g., Pro, Business, Teams)
183
+ */
184
+ name: string;
185
+
186
+ /**
187
+ * Price amount in the smallest currency unit (e.g., cents). Use 0 for free
188
+ * products.
189
+ */
190
+ unit_amount: number;
191
+
192
+ /**
193
+ * Optional custom ID for the product. If not provided, one will be generated.
194
+ */
195
+ id?: string;
196
+
197
+ /**
198
+ * Three-letter ISO currency code
199
+ */
200
+ currency?: string;
201
+
202
+ /**
203
+ * Detailed description of what the product includes
204
+ */
205
+ description?: string;
206
+
207
+ /**
208
+ * Billing frequency for recurring prices: day, week, month, or year. Required for
209
+ * recurring type, ignored for one_time.
210
+ */
211
+ interval?: 'day' | 'week' | 'month' | 'year';
212
+
213
+ /**
214
+ * Number of intervals between billings for recurring prices. Required for
215
+ * recurring type, ignored for one_time.
216
+ */
217
+ interval_count?: number;
218
+
219
+ /**
220
+ * Price type: one_time for single purchases, recurring for subscriptions
221
+ */
222
+ type?: 'one_time' | 'recurring';
223
+ }
224
+
225
+ export interface ProductUpdateParams {
226
+ /**
227
+ * Whether the product is available for new subscriptions
228
+ */
229
+ active?: boolean;
230
+
231
+ /**
232
+ * Detailed description of what the product includes
233
+ */
234
+ description?: string;
235
+
236
+ /**
237
+ * Display name for the product
238
+ */
239
+ name?: string;
240
+ }
241
+
242
+ export interface ProductListParams extends CursorIDPageParams {
243
+ /**
244
+ * Filter by active status
245
+ */
246
+ active?: 'true' | 'false';
247
+ }
248
+
249
+ Products.Entitlements = Entitlements;
250
+ Products.Variants = Variants;
251
+
252
+ export declare namespace Products {
253
+ export {
254
+ type Product as Product,
255
+ type ProductsCursorIDPage as ProductsCursorIDPage,
256
+ type ProductCreateParams as ProductCreateParams,
257
+ type ProductUpdateParams as ProductUpdateParams,
258
+ type ProductListParams as ProductListParams,
259
+ };
260
+
261
+ export {
262
+ Entitlements as Entitlements,
263
+ type ProductEntitlement as ProductEntitlement,
264
+ type ProductEntitlementsCursorIDPage as ProductEntitlementsCursorIDPage,
265
+ type EntitlementListParams as EntitlementListParams,
266
+ type EntitlementAttachParams as EntitlementAttachParams,
267
+ type EntitlementRemoveParams as EntitlementRemoveParams,
268
+ };
269
+
270
+ export {
271
+ Variants as Variants,
272
+ type Variant as Variant,
273
+ type VariantsCursorIDPage as VariantsCursorIDPage,
274
+ type VariantCreateParams as VariantCreateParams,
275
+ type VariantUpdateParams as VariantUpdateParams,
276
+ type VariantListParams as VariantListParams,
277
+ type VariantArchiveParams as VariantArchiveParams,
278
+ type VariantGetParams as VariantGetParams,
279
+ };
280
+ }
@@ -0,0 +1,279 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../../core/resource';
4
+ import { APIPromise } from '../../../../core/api-promise';
5
+ import { CursorIDPage, type CursorIDPageParams, PagePromise } from '../../../../core/pagination';
6
+ import { RequestOptions } from '../../../../internal/request-options';
7
+ import { path } from '../../../../internal/utils/path';
8
+
9
+ export class Variants extends APIResource {
10
+ /**
11
+ * Creates a new variant with pricing for a product. Use variants to offer multiple
12
+ * pricing tiers or configurations (e.g., Basic at $10/month, Pro at $25/month). A
13
+ * Stripe Price is automatically created.
14
+ */
15
+ create(productID: string, body: VariantCreateParams, options?: RequestOptions): APIPromise<Variant> {
16
+ return this._client.post(path`/v1/pay/products/${productID}/variants`, { body, ...options });
17
+ }
18
+
19
+ /**
20
+ * Updates an existing variant. Use this to modify the name, description, or active
21
+ * status. Pricing cannot be changed after creation—create a new variant instead.
22
+ */
23
+ update(variantID: string, params: VariantUpdateParams, options?: RequestOptions): APIPromise<Variant> {
24
+ const { product_id, ...body } = params;
25
+ return this._client.patch(path`/v1/pay/products/${product_id}/variants/${variantID}`, {
26
+ body,
27
+ ...options,
28
+ });
29
+ }
30
+
31
+ /**
32
+ * Retrieves all variants for a product. Variants represent different pricing tiers
33
+ * or configurations (e.g., Basic, Pro, Enterprise) within a single product.
34
+ */
35
+ list(
36
+ productID: string,
37
+ query: VariantListParams | null | undefined = {},
38
+ options?: RequestOptions,
39
+ ): PagePromise<VariantsCursorIDPage, Variant> {
40
+ return this._client.getAPIList(path`/v1/pay/products/${productID}/variants`, CursorIDPage<Variant>, {
41
+ query,
42
+ ...options,
43
+ });
44
+ }
45
+
46
+ /**
47
+ * Archives a variant, preventing new subscriptions. The associated Stripe Price is
48
+ * also archived. Existing subscriptions remain active.
49
+ */
50
+ archive(variantID: string, params: VariantArchiveParams, options?: RequestOptions): APIPromise<Variant> {
51
+ const { product_id } = params;
52
+ return this._client.delete(path`/v1/pay/products/${product_id}/variants/${variantID}`, options);
53
+ }
54
+
55
+ /**
56
+ * Retrieves a variant by ID. Returns the variant object including pricing details
57
+ * and status.
58
+ */
59
+ get(variantID: string, params: VariantGetParams, options?: RequestOptions): APIPromise<Variant> {
60
+ const { product_id } = params;
61
+ return this._client.get(path`/v1/pay/products/${product_id}/variants/${variantID}`, options);
62
+ }
63
+ }
64
+
65
+ export type VariantsCursorIDPage = CursorIDPage<Variant>;
66
+
67
+ /**
68
+ * A product variant representing a specific tier or configuration. Each variant
69
+ * has its own pricing. Variants allow a single product to have multiple pricing
70
+ * options (e.g., Basic, Pro, Enterprise tiers).
71
+ */
72
+ export interface Variant {
73
+ /**
74
+ * Unique identifier for the price
75
+ */
76
+ id: string;
77
+
78
+ /**
79
+ * Whether the variant is available for new purchases
80
+ */
81
+ active: boolean;
82
+
83
+ /**
84
+ * Timestamp when the variant was created
85
+ */
86
+ created: string;
87
+
88
+ /**
89
+ * Display name for the variant (e.g., Basic, Standard, Premium)
90
+ */
91
+ name: string;
92
+
93
+ /**
94
+ * Price configuration for a product. Can be one-time or recurring (subscription).
95
+ */
96
+ default_price?: Variant.DefaultPrice | null;
97
+
98
+ /**
99
+ * Detailed description of what this variant includes
100
+ */
101
+ description?: string | null;
102
+ }
103
+
104
+ export namespace Variant {
105
+ /**
106
+ * Price configuration for a product. Can be one-time or recurring (subscription).
107
+ */
108
+ export interface DefaultPrice {
109
+ /**
110
+ * Unique identifier for the price
111
+ */
112
+ id: string;
113
+
114
+ /**
115
+ * How to handle the billing cycle when switching plans. 'now' resets to current
116
+ * time, 'unchanged' keeps the original anchor. Null for one-time prices.
117
+ */
118
+ billing_cycle_anchor: 'now' | 'unchanged' | null;
119
+
120
+ /**
121
+ * Three-letter ISO currency code (e.g., usd, eur)
122
+ */
123
+ currency: string;
124
+
125
+ /**
126
+ * Billing frequency for recurring prices: day, week, month, or year. Null for
127
+ * one-time prices.
128
+ */
129
+ interval: 'day' | 'week' | 'month' | 'year' | null;
130
+
131
+ /**
132
+ * Number of intervals between billings for recurring prices. Null for one-time
133
+ * prices.
134
+ */
135
+ interval_count: number | null;
136
+
137
+ /**
138
+ * How to handle prorations when switching plans. 'default' creates prorations,
139
+ * 'none' disables them. Null for one-time prices.
140
+ */
141
+ proration_behavior: 'default' | 'none' | null;
142
+
143
+ /**
144
+ * When to calculate proration. 'now' uses current time, 'start_of_period' uses the
145
+ * billing period start. Null for one-time prices or to use Stripe's default.
146
+ */
147
+ proration_date: 'now' | 'start_of_period' | null;
148
+
149
+ /**
150
+ * Price type: one_time for single purchases, recurring for subscriptions
151
+ */
152
+ type: 'one_time' | 'recurring';
153
+
154
+ /**
155
+ * Price amount in the smallest currency unit (e.g., cents)
156
+ */
157
+ unit_amount: number | null;
158
+ }
159
+ }
160
+
161
+ export interface VariantCreateParams {
162
+ /**
163
+ * Display name for the variant (e.g., Basic, Standard, Premium)
164
+ */
165
+ name: string;
166
+
167
+ /**
168
+ * Price amount in the smallest currency unit (e.g., cents). Use 0 for free
169
+ * variants.
170
+ */
171
+ unit_amount: number;
172
+
173
+ /**
174
+ * Optional custom ID for the variant. If not provided, one will be generated.
175
+ */
176
+ id?: string;
177
+
178
+ /**
179
+ * Default billing cycle anchor behavior when switching to this price. 'now' resets
180
+ * to current time, 'unchanged' keeps original anchor. Only applies to recurring
181
+ * prices.
182
+ */
183
+ billing_cycle_anchor?: 'now' | 'unchanged';
184
+
185
+ /**
186
+ * Three-letter ISO currency code
187
+ */
188
+ currency?: string;
189
+
190
+ /**
191
+ * Detailed description of what this variant includes
192
+ */
193
+ description?: string;
194
+
195
+ /**
196
+ * Billing frequency for recurring prices: day, week, month, or year. Required for
197
+ * recurring type, ignored for one_time.
198
+ */
199
+ interval?: 'day' | 'week' | 'month' | 'year';
200
+
201
+ /**
202
+ * Number of intervals between billings for recurring prices. Required for
203
+ * recurring type, ignored for one_time.
204
+ */
205
+ interval_count?: number;
206
+
207
+ /**
208
+ * Default proration behavior when switching to this price. 'default' creates
209
+ * prorations, 'none' disables them. Only applies to recurring prices.
210
+ */
211
+ proration_behavior?: 'default' | 'none';
212
+
213
+ /**
214
+ * Default proration date calculation when switching to this price. 'now' uses
215
+ * current time, 'start_of_period' uses billing period start. Only applies to
216
+ * recurring prices.
217
+ */
218
+ proration_date?: 'now' | 'start_of_period';
219
+
220
+ /**
221
+ * Price type: one_time for single purchases, recurring for subscriptions
222
+ */
223
+ type?: 'one_time' | 'recurring';
224
+ }
225
+
226
+ export interface VariantUpdateParams {
227
+ /**
228
+ * Path param: The unique identifier of the product
229
+ */
230
+ product_id: string;
231
+
232
+ /**
233
+ * Body param: Whether the variant is available for new purchases
234
+ */
235
+ active?: boolean;
236
+
237
+ /**
238
+ * Body param: Detailed description of what this variant includes
239
+ */
240
+ description?: string;
241
+
242
+ /**
243
+ * Body param: Display name for the variant
244
+ */
245
+ name?: string;
246
+ }
247
+
248
+ export interface VariantListParams extends CursorIDPageParams {
249
+ /**
250
+ * Filter by active status
251
+ */
252
+ active?: 'true' | 'false';
253
+ }
254
+
255
+ export interface VariantArchiveParams {
256
+ /**
257
+ * The unique identifier of the product
258
+ */
259
+ product_id: string;
260
+ }
261
+
262
+ export interface VariantGetParams {
263
+ /**
264
+ * The unique identifier of the product
265
+ */
266
+ product_id: string;
267
+ }
268
+
269
+ export declare namespace Variants {
270
+ export {
271
+ type Variant as Variant,
272
+ type VariantsCursorIDPage as VariantsCursorIDPage,
273
+ type VariantCreateParams as VariantCreateParams,
274
+ type VariantUpdateParams as VariantUpdateParams,
275
+ type VariantListParams as VariantListParams,
276
+ type VariantArchiveParams as VariantArchiveParams,
277
+ type VariantGetParams as VariantGetParams,
278
+ };
279
+ }
@@ -1,3 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export * from './subscriptions/index';
3
+ export * from './products/index';
@@ -1,3 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export * from './plans/index';
3
+ export * from './pay/index';
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.2.0'; // x-release-please-version
1
+ export const VERSION = '1.4.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.2.0";
1
+ export declare const VERSION = "1.4.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.2.0";
1
+ export declare const VERSION = "1.4.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 = '1.2.0'; // x-release-please-version
4
+ exports.VERSION = '1.4.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.2.0'; // x-release-please-version
1
+ export const VERSION = '1.4.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map