@usehercules/sdk 1.3.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 (60) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE +1 -1
  3. package/package.json +1 -1
  4. package/resources/beta/pay/coupons.d.mts +1 -1
  5. package/resources/beta/pay/coupons.d.ts +1 -1
  6. package/resources/beta/pay/customers.d.mts +1 -1
  7. package/resources/beta/pay/customers.d.ts +1 -1
  8. package/resources/beta/pay/entitlements.d.mts +4 -22
  9. package/resources/beta/pay/entitlements.d.mts.map +1 -1
  10. package/resources/beta/pay/entitlements.d.ts +4 -22
  11. package/resources/beta/pay/entitlements.d.ts.map +1 -1
  12. package/resources/beta/pay/entitlements.js +3 -4
  13. package/resources/beta/pay/entitlements.js.map +1 -1
  14. package/resources/beta/pay/entitlements.mjs +3 -4
  15. package/resources/beta/pay/entitlements.mjs.map +1 -1
  16. package/resources/beta/pay/pay.d.mts +76 -16
  17. package/resources/beta/pay/pay.d.mts.map +1 -1
  18. package/resources/beta/pay/pay.d.ts +76 -16
  19. package/resources/beta/pay/pay.d.ts.map +1 -1
  20. package/resources/beta/pay/pay.js.map +1 -1
  21. package/resources/beta/pay/pay.mjs.map +1 -1
  22. package/resources/beta/pay/products/entitlements.d.mts +1 -1
  23. package/resources/beta/pay/products/entitlements.d.ts +1 -1
  24. package/resources/beta/pay/products/index.d.mts +1 -0
  25. package/resources/beta/pay/products/index.d.mts.map +1 -1
  26. package/resources/beta/pay/products/index.d.ts +1 -0
  27. package/resources/beta/pay/products/index.d.ts.map +1 -1
  28. package/resources/beta/pay/products/index.js +3 -1
  29. package/resources/beta/pay/products/index.js.map +1 -1
  30. package/resources/beta/pay/products/index.mjs +1 -0
  31. package/resources/beta/pay/products/index.mjs.map +1 -1
  32. package/resources/beta/pay/products/products.d.mts +45 -14
  33. package/resources/beta/pay/products/products.d.mts.map +1 -1
  34. package/resources/beta/pay/products/products.d.ts +45 -14
  35. package/resources/beta/pay/products/products.d.ts.map +1 -1
  36. package/resources/beta/pay/products/products.js +4 -0
  37. package/resources/beta/pay/products/products.js.map +1 -1
  38. package/resources/beta/pay/products/products.mjs +4 -0
  39. package/resources/beta/pay/products/products.mjs.map +1 -1
  40. package/resources/beta/pay/products/variants.d.mts +206 -0
  41. package/resources/beta/pay/products/variants.d.mts.map +1 -0
  42. package/resources/beta/pay/products/variants.d.ts +206 -0
  43. package/resources/beta/pay/products/variants.d.ts.map +1 -0
  44. package/resources/beta/pay/products/variants.js +56 -0
  45. package/resources/beta/pay/products/variants.js.map +1 -0
  46. package/resources/beta/pay/products/variants.mjs +52 -0
  47. package/resources/beta/pay/products/variants.mjs.map +1 -0
  48. package/src/resources/beta/pay/coupons.ts +1 -1
  49. package/src/resources/beta/pay/customers.ts +1 -1
  50. package/src/resources/beta/pay/entitlements.ts +4 -26
  51. package/src/resources/beta/pay/pay.ts +87 -17
  52. package/src/resources/beta/pay/products/entitlements.ts +1 -1
  53. package/src/resources/beta/pay/products/index.ts +10 -0
  54. package/src/resources/beta/pay/products/products.ts +70 -14
  55. package/src/resources/beta/pay/products/variants.ts +279 -0
  56. package/src/version.ts +1 -1
  57. package/version.d.mts +1 -1
  58. package/version.d.ts +1 -1
  59. package/version.js +1 -1
  60. package/version.mjs +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variants.d.mts","sourceRoot":"","sources":["../../../../src/resources/beta/pay/products/variants.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,WAAW,EAAE;OACtD,EAAE,cAAc,EAAE;AAGzB,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;OAIG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC;IAInG;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;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
@@ -0,0 +1,206 @@
1
+ import { APIResource } from "../../../../core/resource.js";
2
+ import { APIPromise } from "../../../../core/api-promise.js";
3
+ import { CursorIDPage, type CursorIDPageParams, PagePromise } from "../../../../core/pagination.js";
4
+ import { RequestOptions } from "../../../../internal/request-options.js";
5
+ export declare class Variants extends APIResource {
6
+ /**
7
+ * Creates a new variant with pricing for a product. Use variants to offer multiple
8
+ * pricing tiers or configurations (e.g., Basic at $10/month, Pro at $25/month). A
9
+ * Stripe Price is automatically created.
10
+ */
11
+ create(productID: string, body: VariantCreateParams, options?: RequestOptions): APIPromise<Variant>;
12
+ /**
13
+ * Updates an existing variant. Use this to modify the name, description, or active
14
+ * status. Pricing cannot be changed after creation—create a new variant instead.
15
+ */
16
+ update(variantID: string, params: VariantUpdateParams, options?: RequestOptions): APIPromise<Variant>;
17
+ /**
18
+ * Retrieves all variants for a product. Variants represent different pricing tiers
19
+ * or configurations (e.g., Basic, Pro, Enterprise) within a single product.
20
+ */
21
+ list(productID: string, query?: VariantListParams | null | undefined, options?: RequestOptions): PagePromise<VariantsCursorIDPage, Variant>;
22
+ /**
23
+ * Archives a variant, preventing new subscriptions. The associated Stripe Price is
24
+ * also archived. Existing subscriptions remain active.
25
+ */
26
+ archive(variantID: string, params: VariantArchiveParams, options?: RequestOptions): APIPromise<Variant>;
27
+ /**
28
+ * Retrieves a variant by ID. Returns the variant object including pricing details
29
+ * and status.
30
+ */
31
+ get(variantID: string, params: VariantGetParams, options?: RequestOptions): APIPromise<Variant>;
32
+ }
33
+ export type VariantsCursorIDPage = CursorIDPage<Variant>;
34
+ /**
35
+ * A product variant representing a specific tier or configuration. Each variant
36
+ * has its own pricing. Variants allow a single product to have multiple pricing
37
+ * options (e.g., Basic, Pro, Enterprise tiers).
38
+ */
39
+ export interface Variant {
40
+ /**
41
+ * Unique identifier for the price
42
+ */
43
+ id: string;
44
+ /**
45
+ * Whether the variant is available for new purchases
46
+ */
47
+ active: boolean;
48
+ /**
49
+ * Timestamp when the variant was created
50
+ */
51
+ created: string;
52
+ /**
53
+ * Display name for the variant (e.g., Basic, Standard, Premium)
54
+ */
55
+ name: string;
56
+ /**
57
+ * Price configuration for a product. Can be one-time or recurring (subscription).
58
+ */
59
+ default_price?: Variant.DefaultPrice | null;
60
+ /**
61
+ * Detailed description of what this variant includes
62
+ */
63
+ description?: string | null;
64
+ }
65
+ export declare namespace Variant {
66
+ /**
67
+ * Price configuration for a product. Can be one-time or recurring (subscription).
68
+ */
69
+ interface DefaultPrice {
70
+ /**
71
+ * Unique identifier for the price
72
+ */
73
+ id: string;
74
+ /**
75
+ * How to handle the billing cycle when switching plans. 'now' resets to current
76
+ * time, 'unchanged' keeps the original anchor. Null for one-time prices.
77
+ */
78
+ billing_cycle_anchor: 'now' | 'unchanged' | null;
79
+ /**
80
+ * Three-letter ISO currency code (e.g., usd, eur)
81
+ */
82
+ currency: string;
83
+ /**
84
+ * Billing frequency for recurring prices: day, week, month, or year. Null for
85
+ * one-time prices.
86
+ */
87
+ interval: 'day' | 'week' | 'month' | 'year' | null;
88
+ /**
89
+ * Number of intervals between billings for recurring prices. Null for one-time
90
+ * prices.
91
+ */
92
+ interval_count: number | null;
93
+ /**
94
+ * How to handle prorations when switching plans. 'default' creates prorations,
95
+ * 'none' disables them. Null for one-time prices.
96
+ */
97
+ proration_behavior: 'default' | 'none' | null;
98
+ /**
99
+ * When to calculate proration. 'now' uses current time, 'start_of_period' uses the
100
+ * billing period start. Null for one-time prices or to use Stripe's default.
101
+ */
102
+ proration_date: 'now' | 'start_of_period' | null;
103
+ /**
104
+ * Price type: one_time for single purchases, recurring for subscriptions
105
+ */
106
+ type: 'one_time' | 'recurring';
107
+ /**
108
+ * Price amount in the smallest currency unit (e.g., cents)
109
+ */
110
+ unit_amount: number | null;
111
+ }
112
+ }
113
+ export interface VariantCreateParams {
114
+ /**
115
+ * Display name for the variant (e.g., Basic, Standard, Premium)
116
+ */
117
+ name: string;
118
+ /**
119
+ * Price amount in the smallest currency unit (e.g., cents). Use 0 for free
120
+ * variants.
121
+ */
122
+ unit_amount: number;
123
+ /**
124
+ * Optional custom ID for the variant. If not provided, one will be generated.
125
+ */
126
+ id?: string;
127
+ /**
128
+ * Default billing cycle anchor behavior when switching to this price. 'now' resets
129
+ * to current time, 'unchanged' keeps original anchor. Only applies to recurring
130
+ * prices.
131
+ */
132
+ billing_cycle_anchor?: 'now' | 'unchanged';
133
+ /**
134
+ * Three-letter ISO currency code
135
+ */
136
+ currency?: string;
137
+ /**
138
+ * Detailed description of what this variant includes
139
+ */
140
+ description?: string;
141
+ /**
142
+ * Billing frequency for recurring prices: day, week, month, or year. Required for
143
+ * recurring type, ignored for one_time.
144
+ */
145
+ interval?: 'day' | 'week' | 'month' | 'year';
146
+ /**
147
+ * Number of intervals between billings for recurring prices. Required for
148
+ * recurring type, ignored for one_time.
149
+ */
150
+ interval_count?: number;
151
+ /**
152
+ * Default proration behavior when switching to this price. 'default' creates
153
+ * prorations, 'none' disables them. Only applies to recurring prices.
154
+ */
155
+ proration_behavior?: 'default' | 'none';
156
+ /**
157
+ * Default proration date calculation when switching to this price. 'now' uses
158
+ * current time, 'start_of_period' uses billing period start. Only applies to
159
+ * recurring prices.
160
+ */
161
+ proration_date?: 'now' | 'start_of_period';
162
+ /**
163
+ * Price type: one_time for single purchases, recurring for subscriptions
164
+ */
165
+ type?: 'one_time' | 'recurring';
166
+ }
167
+ export interface VariantUpdateParams {
168
+ /**
169
+ * Path param: The unique identifier of the product
170
+ */
171
+ product_id: string;
172
+ /**
173
+ * Body param: Whether the variant is available for new purchases
174
+ */
175
+ active?: boolean;
176
+ /**
177
+ * Body param: Detailed description of what this variant includes
178
+ */
179
+ description?: string;
180
+ /**
181
+ * Body param: Display name for the variant
182
+ */
183
+ name?: string;
184
+ }
185
+ export interface VariantListParams extends CursorIDPageParams {
186
+ /**
187
+ * Filter by active status
188
+ */
189
+ active?: 'true' | 'false';
190
+ }
191
+ export interface VariantArchiveParams {
192
+ /**
193
+ * The unique identifier of the product
194
+ */
195
+ product_id: string;
196
+ }
197
+ export interface VariantGetParams {
198
+ /**
199
+ * The unique identifier of the product
200
+ */
201
+ product_id: string;
202
+ }
203
+ export declare namespace Variants {
204
+ export { type Variant as Variant, type VariantsCursorIDPage as VariantsCursorIDPage, type VariantCreateParams as VariantCreateParams, type VariantUpdateParams as VariantUpdateParams, type VariantListParams as VariantListParams, type VariantArchiveParams as VariantArchiveParams, type VariantGetParams as VariantGetParams, };
205
+ }
206
+ //# sourceMappingURL=variants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../../src/resources/beta/pay/products/variants.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,WAAW,EAAE;OACtD,EAAE,cAAc,EAAE;AAGzB,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;OAIG;IACH,MAAM,CAAC,SAAS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B;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Variants = void 0;
5
+ const resource_1 = require("../../../../core/resource.js");
6
+ const pagination_1 = require("../../../../core/pagination.js");
7
+ const path_1 = require("../../../../internal/utils/path.js");
8
+ class Variants extends resource_1.APIResource {
9
+ /**
10
+ * Creates a new variant with pricing for a product. Use variants to offer multiple
11
+ * pricing tiers or configurations (e.g., Basic at $10/month, Pro at $25/month). A
12
+ * Stripe Price is automatically created.
13
+ */
14
+ create(productID, body, options) {
15
+ return this._client.post((0, path_1.path) `/v1/pay/products/${productID}/variants`, { body, ...options });
16
+ }
17
+ /**
18
+ * Updates an existing variant. Use this to modify the name, description, or active
19
+ * status. Pricing cannot be changed after creation—create a new variant instead.
20
+ */
21
+ update(variantID, params, options) {
22
+ const { product_id, ...body } = params;
23
+ return this._client.patch((0, path_1.path) `/v1/pay/products/${product_id}/variants/${variantID}`, {
24
+ body,
25
+ ...options,
26
+ });
27
+ }
28
+ /**
29
+ * Retrieves all variants for a product. Variants represent different pricing tiers
30
+ * or configurations (e.g., Basic, Pro, Enterprise) within a single product.
31
+ */
32
+ list(productID, query = {}, options) {
33
+ return this._client.getAPIList((0, path_1.path) `/v1/pay/products/${productID}/variants`, (pagination_1.CursorIDPage), {
34
+ query,
35
+ ...options,
36
+ });
37
+ }
38
+ /**
39
+ * Archives a variant, preventing new subscriptions. The associated Stripe Price is
40
+ * also archived. Existing subscriptions remain active.
41
+ */
42
+ archive(variantID, params, options) {
43
+ const { product_id } = params;
44
+ return this._client.delete((0, path_1.path) `/v1/pay/products/${product_id}/variants/${variantID}`, options);
45
+ }
46
+ /**
47
+ * Retrieves a variant by ID. Returns the variant object including pricing details
48
+ * and status.
49
+ */
50
+ get(variantID, params, options) {
51
+ const { product_id } = params;
52
+ return this._client.get((0, path_1.path) `/v1/pay/products/${product_id}/variants/${variantID}`, options);
53
+ }
54
+ }
55
+ exports.Variants = Variants;
56
+ //# sourceMappingURL=variants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variants.js","sourceRoot":"","sources":["../../../../src/resources/beta/pay/products/variants.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,2DAAwD;AAExD,+DAAiG;AAEjG,6DAAuD;AAEvD,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;OAIG;IACH,MAAM,CAAC,SAAiB,EAAE,IAAyB,EAAE,OAAwB;QAC3E,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,oBAAoB,SAAS,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,SAAiB,EAAE,MAA2B,EAAE,OAAwB;QAC7E,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACvC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAA,WAAI,EAAA,oBAAoB,UAAU,aAAa,SAAS,EAAE,EAAE;YACpF,IAAI;YACJ,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,IAAI,CACF,SAAiB,EACjB,QAA8C,EAAE,EAChD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAA,WAAI,EAAA,oBAAoB,SAAS,WAAW,EAAE,CAAA,yBAAqB,CAAA,EAAE;YAClG,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,SAAiB,EAAE,MAA4B,EAAE,OAAwB;QAC/E,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,oBAAoB,UAAU,aAAa,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;IAClG,CAAC;IAED;;;OAGG;IACH,GAAG,CAAC,SAAiB,EAAE,MAAwB,EAAE,OAAwB;QACvE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,oBAAoB,UAAU,aAAa,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/F,CAAC;CACF;AAtDD,4BAsDC"}
@@ -0,0 +1,52 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../../../core/resource.mjs";
3
+ import { CursorIDPage } from "../../../../core/pagination.mjs";
4
+ import { path } from "../../../../internal/utils/path.mjs";
5
+ export class Variants extends APIResource {
6
+ /**
7
+ * Creates a new variant with pricing for a product. Use variants to offer multiple
8
+ * pricing tiers or configurations (e.g., Basic at $10/month, Pro at $25/month). A
9
+ * Stripe Price is automatically created.
10
+ */
11
+ create(productID, body, options) {
12
+ return this._client.post(path `/v1/pay/products/${productID}/variants`, { body, ...options });
13
+ }
14
+ /**
15
+ * Updates an existing variant. Use this to modify the name, description, or active
16
+ * status. Pricing cannot be changed after creation—create a new variant instead.
17
+ */
18
+ update(variantID, params, options) {
19
+ const { product_id, ...body } = params;
20
+ return this._client.patch(path `/v1/pay/products/${product_id}/variants/${variantID}`, {
21
+ body,
22
+ ...options,
23
+ });
24
+ }
25
+ /**
26
+ * Retrieves all variants for a product. Variants represent different pricing tiers
27
+ * or configurations (e.g., Basic, Pro, Enterprise) within a single product.
28
+ */
29
+ list(productID, query = {}, options) {
30
+ return this._client.getAPIList(path `/v1/pay/products/${productID}/variants`, (CursorIDPage), {
31
+ query,
32
+ ...options,
33
+ });
34
+ }
35
+ /**
36
+ * Archives a variant, preventing new subscriptions. The associated Stripe Price is
37
+ * also archived. Existing subscriptions remain active.
38
+ */
39
+ archive(variantID, params, options) {
40
+ const { product_id } = params;
41
+ return this._client.delete(path `/v1/pay/products/${product_id}/variants/${variantID}`, options);
42
+ }
43
+ /**
44
+ * Retrieves a variant by ID. Returns the variant object including pricing details
45
+ * and status.
46
+ */
47
+ get(variantID, params, options) {
48
+ const { product_id } = params;
49
+ return this._client.get(path `/v1/pay/products/${product_id}/variants/${variantID}`, options);
50
+ }
51
+ }
52
+ //# sourceMappingURL=variants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variants.mjs","sourceRoot":"","sources":["../../../../src/resources/beta/pay/products/variants.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,YAAY,EAAwC;OAEtD,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;OAIG;IACH,MAAM,CAAC,SAAiB,EAAE,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<Coupon>;
67
67
  */
68
68
  export interface Coupon {
69
69
  /**
70
- * Unique identifier for the entitlement
70
+ * Unique identifier for the price
71
71
  */
72
72
  id: string;
73
73
 
@@ -82,7 +82,7 @@ export type CustomersCursorIDPage = CursorIDPage<Customer>;
82
82
  */
83
83
  export interface Customer {
84
84
  /**
85
- * Unique identifier for the entitlement
85
+ * Unique identifier for the price
86
86
  */
87
87
  id: string;
88
88
 
@@ -19,7 +19,7 @@ export class Entitlements extends APIResource {
19
19
 
20
20
  /**
21
21
  * Updates an existing entitlement. Use this to modify the name or deactivate the
22
- * entitlement. The key cannot be changed after creation.
22
+ * entitlement.
23
23
  */
24
24
  update(
25
25
  entitlementID: string,
@@ -31,8 +31,7 @@ export class Entitlements extends APIResource {
31
31
 
32
32
  /**
33
33
  * Retrieves a paginated list of all entitlements. Entitlements represent features
34
- * or capabilities in your app that can be gated by subscription. Use the key
35
- * filter to find a specific entitlement by its key.
34
+ * or capabilities in your app that can be gated by subscription.
36
35
  */
37
36
  list(
38
37
  query: EntitlementListParams | null | undefined = {},
@@ -43,7 +42,7 @@ export class Entitlements extends APIResource {
43
42
 
44
43
  /**
45
44
  * Retrieves an entitlement by ID. Returns the entitlement object including its
46
- * lookup key and active status.
45
+ * active status.
47
46
  */
48
47
  get(entitlementID: string, options?: RequestOptions): APIPromise<Entitlement> {
49
48
  return this._client.get(path`/v1/pay/entitlements/${entitlementID}`, options);
@@ -57,7 +56,7 @@ export type EntitlementsCursorIDPage = CursorIDPage<Entitlement>;
57
56
  */
58
57
  export interface Entitlement {
59
58
  /**
60
- * Unique identifier for the entitlement
59
+ * Unique identifier for the price
61
60
  */
62
61
  id: string;
63
62
 
@@ -66,16 +65,6 @@ export interface Entitlement {
66
65
  */
67
66
  active: boolean;
68
67
 
69
- /**
70
- * Unique key to identify the entitlement when checking access in your app
71
- */
72
- key: string;
73
-
74
- /**
75
- * Whether this is a live mode entitlement (vs test mode)
76
- */
77
- livemode: boolean;
78
-
79
68
  /**
80
69
  * Display name for the entitlement (e.g., API Access, Premium Support)
81
70
  */
@@ -83,12 +72,6 @@ export interface Entitlement {
83
72
  }
84
73
 
85
74
  export interface EntitlementCreateParams {
86
- /**
87
- * Unique key to identify the entitlement when checking access. Use a descriptive,
88
- * stable key (e.g., api_access, premium_support).
89
- */
90
- key: string;
91
-
92
75
  /**
93
76
  * Display name for the entitlement (e.g., API Access, Premium Support)
94
77
  */
@@ -117,11 +100,6 @@ export interface EntitlementListParams extends CursorIDPageParams {
117
100
  * Filter by archived status
118
101
  */
119
102
  archived?: 'true' | 'false';
120
-
121
- /**
122
- * Filter by exact key match
123
- */
124
- key?: string;
125
103
  }
126
104
 
127
105
  export declare namespace Entitlements {
@@ -108,34 +108,76 @@ export interface PayCancelResponse {
108
108
  */
109
109
  export interface PayCheckResponse {
110
110
  /**
111
- * Whether the customer has the entitlement
112
- */
113
- has_entitlement: boolean;
114
-
115
- /**
116
- * The entitlement key that was checked
111
+ * The entitlement ID that was checked
117
112
  */
118
- key: string;
113
+ entitlement_id: string;
119
114
 
120
115
  /**
121
- * The active entitlement ID if present
116
+ * Whether the customer has the entitlement
122
117
  */
123
- entitlement_id?: string | null;
118
+ has_entitlement: boolean;
124
119
  }
125
120
 
126
121
  /**
127
- * Checkout session response
122
+ * Checkout response. For new customers, returns a checkout URL. For existing
123
+ * subscribers, returns the updated subscription.
128
124
  */
129
125
  export interface PayCheckoutResponse {
130
126
  /**
131
- * The checkout session ID
127
+ * The checkout session ID (for checkout action) or subscription ID (for update
128
+ * action)
132
129
  */
133
130
  id: string;
134
131
 
135
132
  /**
136
- * The checkout URL to redirect the customer to
133
+ * The action taken: 'checkout' for new subscriptions (redirect to URL), 'update'
134
+ * for subscription changes (already applied)
135
+ */
136
+ action: 'checkout' | 'update';
137
+
138
+ /**
139
+ * The checkout mode: subscription for recurring prices, payment for one-time
140
+ * prices. Only present for 'checkout' action.
141
+ */
142
+ mode?: 'subscription' | 'payment' | null;
143
+
144
+ /**
145
+ * The updated subscription details. Only present for 'update' action.
146
+ */
147
+ subscription?: PayCheckoutResponse.Subscription | null;
148
+
149
+ /**
150
+ * The checkout URL to redirect the customer to. Only present for 'checkout'
151
+ * action.
152
+ */
153
+ url?: string | null;
154
+ }
155
+
156
+ export namespace PayCheckoutResponse {
157
+ /**
158
+ * The updated subscription details. Only present for 'update' action.
137
159
  */
138
- url: string;
160
+ export interface Subscription {
161
+ /**
162
+ * The subscription ID
163
+ */
164
+ id: string;
165
+
166
+ /**
167
+ * The product ID
168
+ */
169
+ product_id: string;
170
+
171
+ /**
172
+ * The subscription status
173
+ */
174
+ status: string;
175
+
176
+ /**
177
+ * The variant ID if applicable
178
+ */
179
+ variant_id?: string | null;
180
+ }
139
181
  }
140
182
 
141
183
  export interface PayCancelParams {
@@ -163,9 +205,9 @@ export interface PayCheckParams {
163
205
  customer_id: string;
164
206
 
165
207
  /**
166
- * The entitlement key to check for access
208
+ * The entitlement ID to check for access
167
209
  */
168
- entitlement_key: string;
210
+ entitlement_id: string;
169
211
  }
170
212
 
171
213
  export interface PayCheckoutParams {
@@ -175,15 +217,23 @@ export interface PayCheckoutParams {
175
217
  customer_id: string;
176
218
 
177
219
  /**
178
- * The product ID to subscribe to
220
+ * The product ID to purchase
179
221
  */
180
222
  product_id: string;
181
223
 
182
224
  /**
183
- * Optional custom ID for the subscription. If not provided, one will be generated.
225
+ * Optional custom ID for the subscription or payment. If not provided, one will be
226
+ * generated.
184
227
  */
185
228
  id?: string;
186
229
 
230
+ /**
231
+ * Override billing cycle anchor behavior for subscription updates. 'now' resets to
232
+ * current time, 'unchanged' keeps original anchor. If not provided, uses the
233
+ * price's configured default.
234
+ */
235
+ billing_cycle_anchor?: 'now' | 'unchanged';
236
+
187
237
  /**
188
238
  * URL to redirect on cancel
189
239
  */
@@ -194,10 +244,30 @@ export interface PayCheckoutParams {
194
244
  */
195
245
  promotion_code?: string;
196
246
 
247
+ /**
248
+ * Override proration behavior for subscription updates. 'default' creates
249
+ * prorations, 'none' disables them. If not provided, uses the price's configured
250
+ * default.
251
+ */
252
+ proration_behavior?: 'default' | 'none';
253
+
254
+ /**
255
+ * Override proration date calculation for subscription updates. 'now' uses current
256
+ * time, 'start_of_period' uses billing period start. If not provided, uses the
257
+ * price's configured default.
258
+ */
259
+ proration_date?: 'now' | 'start_of_period';
260
+
197
261
  /**
198
262
  * URL to redirect on success
199
263
  */
200
264
  success_url?: string;
265
+
266
+ /**
267
+ * Optional variant ID to specify a particular pricing tier. If not provided, the
268
+ * product's default price is used.
269
+ */
270
+ variant_id?: string;
201
271
  }
202
272
 
203
273
  Pay.Customers = Customers;
@@ -59,7 +59,7 @@ export type ProductEntitlementsCursorIDPage = CursorIDPage<ProductEntitlement>;
59
59
  */
60
60
  export interface ProductEntitlement {
61
61
  /**
62
- * Unique identifier for the entitlement
62
+ * Unique identifier for the price
63
63
  */
64
64
  id: string;
65
65
 
@@ -16,3 +16,13 @@ export {
16
16
  type ProductListParams,
17
17
  type ProductsCursorIDPage,
18
18
  } from './products';
19
+ export {
20
+ Variants,
21
+ type Variant,
22
+ type VariantCreateParams,
23
+ type VariantUpdateParams,
24
+ type VariantListParams,
25
+ type VariantArchiveParams,
26
+ type VariantGetParams,
27
+ type VariantsCursorIDPage,
28
+ } from './variants';