@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,218 @@
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 { buildHeaders } from '../../../internal/headers';
7
+ import { RequestOptions } from '../../../internal/request-options';
8
+ import { path } from '../../../internal/utils/path';
9
+
10
+ export class Coupons extends APIResource {
11
+ /**
12
+ * Creates a discount coupon with a promo code. Coupons can offer percentage or
13
+ * fixed-amount discounts and can be limited by redemption count or expiration
14
+ * date. Customers can apply coupons during checkout.
15
+ */
16
+ create(body: CouponCreateParams, options?: RequestOptions): APIPromise<Coupon> {
17
+ return this._client.post('/v1/pay/coupons', { body, ...options });
18
+ }
19
+
20
+ /**
21
+ * Updates an existing coupon. Use this to modify the display name or deactivate
22
+ * the coupon. Discount amounts and codes cannot be changed after creation.
23
+ */
24
+ update(
25
+ couponID: string,
26
+ body: CouponUpdateParams | null | undefined = {},
27
+ options?: RequestOptions,
28
+ ): APIPromise<Coupon> {
29
+ return this._client.patch(path`/v1/pay/coupons/${couponID}`, { body, ...options });
30
+ }
31
+
32
+ /**
33
+ * Retrieves a paginated list of all coupons. Coupons provide discounts that
34
+ * customers can apply during checkout using a promo code.
35
+ */
36
+ list(
37
+ query: CouponListParams | null | undefined = {},
38
+ options?: RequestOptions,
39
+ ): PagePromise<CouponsCursorIDPage, Coupon> {
40
+ return this._client.getAPIList('/v1/pay/coupons', CursorIDPage<Coupon>, { query, ...options });
41
+ }
42
+
43
+ /**
44
+ * Permanently deletes a coupon. The promo code can no longer be used. Existing
45
+ * discounts applied to active subscriptions are not affected.
46
+ */
47
+ delete(couponID: string, options?: RequestOptions): APIPromise<void> {
48
+ return this._client.delete(path`/v1/pay/coupons/${couponID}`, {
49
+ ...options,
50
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
51
+ });
52
+ }
53
+
54
+ /**
55
+ * Retrieves a coupon by ID. Returns the coupon object including discount details
56
+ * and redemption statistics.
57
+ */
58
+ get(couponID: string, options?: RequestOptions): APIPromise<Coupon> {
59
+ return this._client.get(path`/v1/pay/coupons/${couponID}`, options);
60
+ }
61
+ }
62
+
63
+ export type CouponsCursorIDPage = CursorIDPage<Coupon>;
64
+
65
+ /**
66
+ * A discount coupon that customers can apply during checkout using a promo code
67
+ */
68
+ export interface Coupon {
69
+ /**
70
+ * Unique identifier for the price
71
+ */
72
+ id: string;
73
+
74
+ /**
75
+ * Whether the coupon is currently active and can be redeemed
76
+ */
77
+ active: boolean;
78
+
79
+ /**
80
+ * The promo code customers enter to apply the discount
81
+ */
82
+ code: string;
83
+
84
+ /**
85
+ * Timestamp when the coupon was created
86
+ */
87
+ created: string;
88
+
89
+ /**
90
+ * How long the discount applies: once (first payment only), repeating (for
91
+ * duration_in_months), or forever
92
+ */
93
+ duration: 'once' | 'repeating' | 'forever';
94
+
95
+ /**
96
+ * Number of times this coupon has been successfully redeemed
97
+ */
98
+ times_redeemed: number;
99
+
100
+ /**
101
+ * Fixed discount amount in the smallest currency unit (e.g., cents). Mutually
102
+ * exclusive with percent_off.
103
+ */
104
+ amount_off?: number | null;
105
+
106
+ /**
107
+ * Three-letter ISO currency code for amount_off discounts
108
+ */
109
+ currency?: string | null;
110
+
111
+ /**
112
+ * Number of months the discount applies when duration is 'repeating'
113
+ */
114
+ duration_in_months?: number | null;
115
+
116
+ /**
117
+ * Maximum number of times this coupon can be redeemed across all customers
118
+ */
119
+ max_redemptions?: number | null;
120
+
121
+ /**
122
+ * Display name for the coupon (shown to customers)
123
+ */
124
+ name?: string | null;
125
+
126
+ /**
127
+ * Percentage discount (1-100). Mutually exclusive with amount_off.
128
+ */
129
+ percent_off?: number | null;
130
+
131
+ /**
132
+ * Expiration date after which the coupon can no longer be redeemed
133
+ */
134
+ redeem_by?: string | null;
135
+ }
136
+
137
+ export interface CouponCreateParams {
138
+ /**
139
+ * The promo code customers will enter to apply the discount
140
+ */
141
+ code: string;
142
+
143
+ /**
144
+ * Optional custom ID for the coupon. If not provided, one will be generated.
145
+ */
146
+ id?: string;
147
+
148
+ /**
149
+ * Fixed discount in the smallest currency unit (e.g., cents). Mutually exclusive
150
+ * with percent_off.
151
+ */
152
+ amount_off?: number;
153
+
154
+ /**
155
+ * Three-letter ISO currency code for amount_off discounts
156
+ */
157
+ currency?: string;
158
+
159
+ /**
160
+ * How long the discount applies: once (first payment only), repeating (for
161
+ * duration_in_months), or forever
162
+ */
163
+ duration?: 'once' | 'repeating' | 'forever';
164
+
165
+ /**
166
+ * Number of months the discount applies when duration is 'repeating'
167
+ */
168
+ duration_in_months?: number;
169
+
170
+ /**
171
+ * Maximum number of times this coupon can be redeemed
172
+ */
173
+ max_redemptions?: number;
174
+
175
+ /**
176
+ * Display name for the coupon (shown to customers)
177
+ */
178
+ name?: string;
179
+
180
+ /**
181
+ * Percentage discount (1-100). Mutually exclusive with amount_off.
182
+ */
183
+ percent_off?: number;
184
+
185
+ /**
186
+ * Expiration date after which the coupon can no longer be redeemed
187
+ */
188
+ redeem_by?: string;
189
+ }
190
+
191
+ export interface CouponUpdateParams {
192
+ /**
193
+ * Whether the coupon is active and can be redeemed
194
+ */
195
+ active?: boolean;
196
+
197
+ /**
198
+ * Display name for the coupon
199
+ */
200
+ name?: string;
201
+ }
202
+
203
+ export interface CouponListParams extends CursorIDPageParams {
204
+ /**
205
+ * Filter by active status
206
+ */
207
+ active?: boolean;
208
+ }
209
+
210
+ export declare namespace Coupons {
211
+ export {
212
+ type Coupon as Coupon,
213
+ type CouponsCursorIDPage as CouponsCursorIDPage,
214
+ type CouponCreateParams as CouponCreateParams,
215
+ type CouponUpdateParams as CouponUpdateParams,
216
+ type CouponListParams as CouponListParams,
217
+ };
218
+ }
@@ -0,0 +1,229 @@
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 { buildHeaders } from '../../../internal/headers';
7
+ import { RequestOptions } from '../../../internal/request-options';
8
+ import { path } from '../../../internal/utils/path';
9
+
10
+ export class Customers extends APIResource {
11
+ /**
12
+ * Creates a new billable customer. A customer represents the entity in your app
13
+ * that will be charged—typically a user, organization, or project. Hercules
14
+ * recommends creating a customer immediately after creating the corresponding
15
+ * entity in your app.
16
+ */
17
+ create(body: CustomerCreateParams | null | undefined = {}, options?: RequestOptions): APIPromise<Customer> {
18
+ return this._client.post('/v1/pay/customers', { body, ...options });
19
+ }
20
+
21
+ /**
22
+ * Updates an existing customer. Use this to modify contact information or billing
23
+ * address. Only provided fields are updated; omitted fields remain unchanged.
24
+ */
25
+ update(
26
+ customerID: string,
27
+ body: CustomerUpdateParams | null | undefined = {},
28
+ options?: RequestOptions,
29
+ ): APIPromise<Customer> {
30
+ return this._client.patch(path`/v1/pay/customers/${customerID}`, { body, ...options });
31
+ }
32
+
33
+ /**
34
+ * Retrieves a paginated list of all customers. Customers are the billable entities
35
+ * in your app—typically users, organizations, or projects.
36
+ */
37
+ list(
38
+ query: CustomerListParams | null | undefined = {},
39
+ options?: RequestOptions,
40
+ ): PagePromise<CustomersCursorIDPage, Customer> {
41
+ return this._client.getAPIList('/v1/pay/customers', CursorIDPage<Customer>, { query, ...options });
42
+ }
43
+
44
+ /**
45
+ * Permanently deletes a customer. This also cancels any active subscriptions. This
46
+ * action cannot be undone.
47
+ */
48
+ delete(customerID: string, options?: RequestOptions): APIPromise<void> {
49
+ return this._client.delete(path`/v1/pay/customers/${customerID}`, {
50
+ ...options,
51
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
52
+ });
53
+ }
54
+
55
+ /**
56
+ * Generates a URL to a hosted billing portal where the customer can view invoices,
57
+ * update payment methods, and manage billing details. Redirect the customer to the
58
+ * returned URL.
59
+ */
60
+ billingPortal(
61
+ customerID: string,
62
+ body: CustomerBillingPortalParams | null | undefined = {},
63
+ options?: RequestOptions,
64
+ ): APIPromise<CustomerBillingPortalResponse> {
65
+ return this._client.post(path`/v1/pay/customers/${customerID}/billing_portal`, { body, ...options });
66
+ }
67
+
68
+ /**
69
+ * Retrieves a customer by ID. Returns the customer object including contact
70
+ * information and billing address.
71
+ */
72
+ get(customerID: string, options?: RequestOptions): APIPromise<Customer> {
73
+ return this._client.get(path`/v1/pay/customers/${customerID}`, options);
74
+ }
75
+ }
76
+
77
+ export type CustomersCursorIDPage = CursorIDPage<Customer>;
78
+
79
+ /**
80
+ * A billable customer. Represents the entity in your app that will be
81
+ * charged—typically a user, organization, or project.
82
+ */
83
+ export interface Customer {
84
+ /**
85
+ * Unique identifier for the price
86
+ */
87
+ id: string;
88
+
89
+ /**
90
+ * Timestamp when the customer was created
91
+ */
92
+ created: string;
93
+
94
+ /**
95
+ * The customer's billing address
96
+ */
97
+ address?: CustomerAddress | null;
98
+
99
+ /**
100
+ * The customer's email address for receipts and notifications
101
+ */
102
+ email?: string | null;
103
+
104
+ /**
105
+ * The customer's full name
106
+ */
107
+ name?: string | null;
108
+
109
+ /**
110
+ * The customer's phone number
111
+ */
112
+ phone?: string | null;
113
+ }
114
+
115
+ /**
116
+ * The customer's billing address
117
+ */
118
+ export interface CustomerAddress {
119
+ /**
120
+ * City name
121
+ */
122
+ city?: string | null;
123
+
124
+ /**
125
+ * Two-letter ISO country code
126
+ */
127
+ country?: string | null;
128
+
129
+ /**
130
+ * Street address line 1
131
+ */
132
+ line1?: string | null;
133
+
134
+ /**
135
+ * Street address line 2 (apartment, suite, etc.)
136
+ */
137
+ line2?: string | null;
138
+
139
+ /**
140
+ * Postal or ZIP code
141
+ */
142
+ postal_code?: string | null;
143
+
144
+ /**
145
+ * State, province, or region
146
+ */
147
+ state?: string | null;
148
+ }
149
+
150
+ /**
151
+ * Response containing the billing portal URL
152
+ */
153
+ export interface CustomerBillingPortalResponse {
154
+ /**
155
+ * URL to redirect the customer to for the billing portal
156
+ */
157
+ url: string;
158
+ }
159
+
160
+ export interface CustomerCreateParams {
161
+ /**
162
+ * Optional custom ID for the customer. If not provided, one will be generated.
163
+ */
164
+ id?: string;
165
+
166
+ /**
167
+ * The customer's billing address
168
+ */
169
+ address?: CustomerAddress;
170
+
171
+ /**
172
+ * The customer's email address for receipts and notifications
173
+ */
174
+ email?: string;
175
+
176
+ /**
177
+ * The customer's full name
178
+ */
179
+ name?: string;
180
+
181
+ /**
182
+ * The customer's phone number
183
+ */
184
+ phone?: string;
185
+ }
186
+
187
+ export interface CustomerUpdateParams {
188
+ /**
189
+ * The customer's billing address
190
+ */
191
+ address?: CustomerAddress;
192
+
193
+ /**
194
+ * The customer's email address for receipts and notifications
195
+ */
196
+ email?: string;
197
+
198
+ /**
199
+ * The customer's full name
200
+ */
201
+ name?: string;
202
+
203
+ /**
204
+ * The customer's phone number
205
+ */
206
+ phone?: string;
207
+ }
208
+
209
+ export interface CustomerListParams extends CursorIDPageParams {}
210
+
211
+ export interface CustomerBillingPortalParams {
212
+ /**
213
+ * URL to redirect the customer to after they exit the billing portal
214
+ */
215
+ return_url?: string;
216
+ }
217
+
218
+ export declare namespace Customers {
219
+ export {
220
+ type Customer as Customer,
221
+ type CustomerAddress as CustomerAddress,
222
+ type CustomerBillingPortalResponse as CustomerBillingPortalResponse,
223
+ type CustomersCursorIDPage as CustomersCursorIDPage,
224
+ type CustomerCreateParams as CustomerCreateParams,
225
+ type CustomerUpdateParams as CustomerUpdateParams,
226
+ type CustomerListParams as CustomerListParams,
227
+ type CustomerBillingPortalParams as CustomerBillingPortalParams,
228
+ };
229
+ }
@@ -8,84 +8,89 @@ import { path } from '../../../internal/utils/path';
8
8
 
9
9
  export class Entitlements extends APIResource {
10
10
  /**
11
- * Create Entitlement
11
+ * Creates a new feature entitlement. Entitlements represent features or
12
+ * capabilities in your app that can be gated by subscription. After creating an
13
+ * entitlement, attach it to one or more plans to grant access to customers on
14
+ * those plans.
12
15
  */
13
16
  create(body: EntitlementCreateParams, options?: RequestOptions): APIPromise<Entitlement> {
14
- return this._client.post('/v1/subscriptions/entitlements', { body, ...options });
17
+ return this._client.post('/v1/pay/entitlements', { body, ...options });
15
18
  }
16
19
 
17
20
  /**
18
- * Update Entitlement
21
+ * Updates an existing entitlement. Use this to modify the name or deactivate the
22
+ * entitlement.
19
23
  */
20
24
  update(
21
25
  entitlementID: string,
22
26
  body: EntitlementUpdateParams | null | undefined = {},
23
27
  options?: RequestOptions,
24
28
  ): APIPromise<Entitlement> {
25
- return this._client.patch(path`/v1/subscriptions/entitlements/${entitlementID}`, { body, ...options });
29
+ return this._client.patch(path`/v1/pay/entitlements/${entitlementID}`, { body, ...options });
26
30
  }
27
31
 
28
32
  /**
29
- * List Entitlements
33
+ * Retrieves a paginated list of all entitlements. Entitlements represent features
34
+ * or capabilities in your app that can be gated by subscription.
30
35
  */
31
36
  list(
32
37
  query: EntitlementListParams | null | undefined = {},
33
38
  options?: RequestOptions,
34
39
  ): PagePromise<EntitlementsCursorIDPage, Entitlement> {
35
- return this._client.getAPIList('/v1/subscriptions/entitlements', CursorIDPage<Entitlement>, {
36
- query,
37
- ...options,
38
- });
40
+ return this._client.getAPIList('/v1/pay/entitlements', CursorIDPage<Entitlement>, { query, ...options });
39
41
  }
40
42
 
41
43
  /**
42
- * Get Entitlement
44
+ * Retrieves an entitlement by ID. Returns the entitlement object including its
45
+ * active status.
43
46
  */
44
47
  get(entitlementID: string, options?: RequestOptions): APIPromise<Entitlement> {
45
- return this._client.get(path`/v1/subscriptions/entitlements/${entitlementID}`, options);
48
+ return this._client.get(path`/v1/pay/entitlements/${entitlementID}`, options);
46
49
  }
47
50
  }
48
51
 
49
52
  export type EntitlementsCursorIDPage = CursorIDPage<Entitlement>;
50
53
 
51
54
  /**
52
- * An entitlement that can be attached to products
55
+ * The entitlement attached to the product
53
56
  */
54
57
  export interface Entitlement {
55
58
  /**
56
- * An id for a data item
59
+ * Unique identifier for the price
57
60
  */
58
61
  id: string;
59
62
 
63
+ /**
64
+ * Whether the entitlement is active and can be attached to products
65
+ */
60
66
  active: boolean;
61
67
 
62
- livemode: boolean;
63
-
64
- lookup_key: string;
65
-
68
+ /**
69
+ * Display name for the entitlement (e.g., API Access, Premium Support)
70
+ */
66
71
  name: string;
67
72
  }
68
73
 
69
74
  export interface EntitlementCreateParams {
70
75
  /**
71
- * A unique key to identify the entitlement in your system
76
+ * Display name for the entitlement (e.g., API Access, Premium Support)
72
77
  */
73
- lookup_key: string;
78
+ name: string;
74
79
 
75
80
  /**
76
- * The name of the entitlement
81
+ * Optional custom ID for the entitlement. If not provided, one will be generated.
77
82
  */
78
- name: string;
83
+ id?: string;
79
84
  }
80
85
 
81
86
  export interface EntitlementUpdateParams {
82
87
  /**
83
- * Whether the entitlement is active
88
+ * Whether the entitlement is active. Deactivating removes it from access checks.
84
89
  */
85
90
  active?: boolean;
86
91
 
87
92
  /**
88
- * The name of the entitlement
93
+ * Display name for the entitlement
89
94
  */
90
95
  name?: string;
91
96
  }
@@ -94,12 +99,7 @@ export interface EntitlementListParams extends CursorIDPageParams {
94
99
  /**
95
100
  * Filter by archived status
96
101
  */
97
- archived?: boolean;
98
-
99
- /**
100
- * Filter by lookup key
101
- */
102
- lookup_key?: string;
102
+ archived?: 'true' | 'false';
103
103
  }
104
104
 
105
105
  export declare namespace Entitlements {
@@ -28,19 +28,19 @@ export {
28
28
  type EntitlementsCursorIDPage,
29
29
  } from './entitlements';
30
30
  export {
31
- Plans,
32
- type Plan,
33
- type PlanCreateParams,
34
- type PlanUpdateParams,
35
- type PlanListParams,
36
- type PlansCursorIDPage,
37
- } from './plans/index';
31
+ Pay,
32
+ type PayCancelResponse,
33
+ type PayCheckResponse,
34
+ type PayCheckoutResponse,
35
+ type PayCancelParams,
36
+ type PayCheckParams,
37
+ type PayCheckoutParams,
38
+ } from './pay';
38
39
  export {
39
- Subscriptions,
40
- type SubscriptionCancelResponse,
41
- type SubscriptionCheckResponse,
42
- type SubscriptionCheckoutResponse,
43
- type SubscriptionCancelParams,
44
- type SubscriptionCheckParams,
45
- type SubscriptionCheckoutParams,
46
- } from './subscriptions';
40
+ Products,
41
+ type Product,
42
+ type ProductCreateParams,
43
+ type ProductUpdateParams,
44
+ type ProductListParams,
45
+ type ProductsCursorIDPage,
46
+ } from './products/index';