@usehercules/sdk 1.7.0 → 1.8.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.
- package/CHANGELOG.md +21 -0
- package/README.md +17 -16
- package/package.json +1 -1
- package/resources/beta/beta.d.mts +4 -4
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +4 -4
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +4 -4
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +4 -4
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/commerce/commerce.d.mts +201 -0
- package/resources/beta/commerce/commerce.d.mts.map +1 -0
- package/resources/beta/commerce/commerce.d.ts +201 -0
- package/resources/beta/commerce/commerce.d.ts.map +1 -0
- package/resources/beta/{pay/pay.js → commerce/commerce.js} +10 -14
- package/resources/beta/commerce/commerce.js.map +1 -0
- package/resources/beta/{pay/pay.mjs → commerce/commerce.mjs} +8 -12
- package/resources/beta/commerce/commerce.mjs.map +1 -0
- package/resources/beta/commerce/coupons.d.mts +333 -0
- package/resources/beta/commerce/coupons.d.mts.map +1 -0
- package/resources/beta/commerce/coupons.d.ts +333 -0
- package/resources/beta/commerce/coupons.d.ts.map +1 -0
- package/resources/beta/{pay → commerce}/coupons.js +8 -5
- package/resources/beta/commerce/coupons.js.map +1 -0
- package/resources/beta/{pay → commerce}/coupons.mjs +8 -5
- package/resources/beta/commerce/coupons.mjs.map +1 -0
- package/resources/beta/commerce/customers.d.mts +407 -0
- package/resources/beta/commerce/customers.d.mts.map +1 -0
- package/resources/beta/commerce/customers.d.ts +407 -0
- package/resources/beta/commerce/customers.d.ts.map +1 -0
- package/resources/beta/{pay → commerce}/customers.js +9 -6
- package/resources/beta/commerce/customers.js.map +1 -0
- package/resources/beta/{pay → commerce}/customers.mjs +9 -6
- package/resources/beta/commerce/customers.mjs.map +1 -0
- package/resources/beta/commerce/index.d.mts +5 -0
- package/resources/beta/commerce/index.d.mts.map +1 -0
- package/resources/beta/commerce/index.d.ts +5 -0
- package/resources/beta/commerce/index.d.ts.map +1 -0
- package/resources/beta/{pay → commerce}/index.js +3 -5
- package/resources/beta/commerce/index.js.map +1 -0
- package/resources/beta/{pay → commerce}/index.mjs +1 -2
- package/resources/beta/commerce/index.mjs.map +1 -0
- package/resources/beta/commerce/products/index.d.mts +4 -0
- package/resources/beta/commerce/products/index.d.mts.map +1 -0
- package/resources/beta/commerce/products/index.d.ts +4 -0
- package/resources/beta/commerce/products/index.d.ts.map +1 -0
- package/resources/beta/{pay → commerce}/products/index.js +3 -3
- package/resources/beta/commerce/products/index.js.map +1 -0
- package/resources/beta/{pay → commerce}/products/index.mjs +1 -1
- package/resources/beta/commerce/products/index.mjs.map +1 -0
- package/resources/beta/commerce/products/products.d.mts +967 -0
- package/resources/beta/commerce/products/products.d.mts.map +1 -0
- package/resources/beta/commerce/products/products.d.ts +967 -0
- package/resources/beta/commerce/products/products.d.ts.map +1 -0
- package/resources/beta/{pay → commerce}/products/products.js +16 -12
- package/resources/beta/commerce/products/products.js.map +1 -0
- package/resources/beta/{pay → commerce}/products/products.mjs +16 -12
- package/resources/beta/commerce/products/products.mjs.map +1 -0
- package/resources/beta/commerce/products/resources.d.mts +160 -0
- package/resources/beta/commerce/products/resources.d.mts.map +1 -0
- package/resources/beta/commerce/products/resources.d.ts +160 -0
- package/resources/beta/commerce/products/resources.d.ts.map +1 -0
- package/resources/beta/commerce/products/resources.js +41 -0
- package/resources/beta/commerce/products/resources.js.map +1 -0
- package/resources/beta/commerce/products/resources.mjs +37 -0
- package/resources/beta/commerce/products/resources.mjs.map +1 -0
- package/resources/beta/commerce/products/variants.d.mts +798 -0
- package/resources/beta/commerce/products/variants.d.mts.map +1 -0
- package/resources/beta/commerce/products/variants.d.ts +798 -0
- package/resources/beta/commerce/products/variants.d.ts.map +1 -0
- package/resources/beta/{pay → commerce}/products/variants.js +5 -8
- package/resources/beta/commerce/products/variants.js.map +1 -0
- package/resources/beta/{pay → commerce}/products/variants.mjs +5 -8
- package/resources/beta/commerce/products/variants.mjs.map +1 -0
- package/resources/beta/commerce/products.d.mts.map +1 -0
- package/resources/beta/commerce/products.d.ts.map +1 -0
- package/resources/beta/commerce/products.js.map +1 -0
- package/resources/beta/commerce/products.mjs.map +1 -0
- package/resources/beta/commerce.d.mts +2 -0
- package/resources/beta/commerce.d.mts.map +1 -0
- package/resources/beta/commerce.d.ts +2 -0
- package/resources/beta/commerce.d.ts.map +1 -0
- package/resources/beta/{pay.js → commerce.js} +2 -2
- package/resources/beta/commerce.js.map +1 -0
- package/resources/beta/{pay.mjs → commerce.mjs} +2 -2
- package/resources/beta/commerce.mjs.map +1 -0
- package/resources/beta/index.d.mts +1 -1
- package/resources/beta/index.d.mts.map +1 -1
- package/resources/beta/index.d.ts +1 -1
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js +3 -3
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/push-notifications/push-notifications.d.mts +8 -9
- package/resources/push-notifications/push-notifications.d.mts.map +1 -1
- package/resources/push-notifications/push-notifications.d.ts +8 -9
- package/resources/push-notifications/push-notifications.d.ts.map +1 -1
- package/resources/push-notifications/push-notifications.js +5 -6
- package/resources/push-notifications/push-notifications.js.map +1 -1
- package/resources/push-notifications/push-notifications.mjs +5 -6
- package/resources/push-notifications/push-notifications.mjs.map +1 -1
- package/src/resources/beta/beta.ts +18 -18
- package/src/resources/beta/{pay/pay.ts → commerce/commerce.ts} +82 -85
- package/src/resources/beta/commerce/coupons.ts +440 -0
- package/src/resources/beta/commerce/customers.ts +532 -0
- package/src/resources/beta/commerce/index.ts +47 -0
- package/src/resources/beta/commerce/products/index.ts +37 -0
- package/src/resources/beta/commerce/products/products.ts +1199 -0
- package/src/resources/beta/commerce/products/resources.ts +213 -0
- package/src/resources/beta/commerce/products/variants.ts +984 -0
- package/src/resources/beta/{pay.ts → commerce.ts} +1 -1
- package/src/resources/beta/index.ts +8 -8
- package/src/resources/push-notifications/push-notifications.ts +8 -9
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/resources/beta/pay/coupons.d.mts +0 -156
- package/resources/beta/pay/coupons.d.mts.map +0 -1
- package/resources/beta/pay/coupons.d.ts +0 -156
- package/resources/beta/pay/coupons.d.ts.map +0 -1
- package/resources/beta/pay/coupons.js.map +0 -1
- package/resources/beta/pay/coupons.mjs.map +0 -1
- package/resources/beta/pay/customers.d.mts +0 -160
- package/resources/beta/pay/customers.d.mts.map +0 -1
- package/resources/beta/pay/customers.d.ts +0 -160
- package/resources/beta/pay/customers.d.ts.map +0 -1
- package/resources/beta/pay/customers.js.map +0 -1
- package/resources/beta/pay/customers.mjs.map +0 -1
- package/resources/beta/pay/entitlements.d.mts +0 -76
- package/resources/beta/pay/entitlements.d.mts.map +0 -1
- package/resources/beta/pay/entitlements.d.ts +0 -76
- package/resources/beta/pay/entitlements.d.ts.map +0 -1
- package/resources/beta/pay/entitlements.js +0 -41
- package/resources/beta/pay/entitlements.js.map +0 -1
- package/resources/beta/pay/entitlements.mjs +0 -37
- package/resources/beta/pay/entitlements.mjs.map +0 -1
- package/resources/beta/pay/index.d.mts +0 -6
- package/resources/beta/pay/index.d.mts.map +0 -1
- package/resources/beta/pay/index.d.ts +0 -6
- package/resources/beta/pay/index.d.ts.map +0 -1
- package/resources/beta/pay/index.js.map +0 -1
- package/resources/beta/pay/index.mjs.map +0 -1
- package/resources/beta/pay/pay.d.mts +0 -206
- package/resources/beta/pay/pay.d.mts.map +0 -1
- package/resources/beta/pay/pay.d.ts +0 -206
- package/resources/beta/pay/pay.d.ts.map +0 -1
- package/resources/beta/pay/pay.js.map +0 -1
- package/resources/beta/pay/pay.mjs.map +0 -1
- package/resources/beta/pay/products/entitlements.d.mts +0 -53
- package/resources/beta/pay/products/entitlements.d.mts.map +0 -1
- package/resources/beta/pay/products/entitlements.d.ts +0 -53
- package/resources/beta/pay/products/entitlements.d.ts.map +0 -1
- package/resources/beta/pay/products/entitlements.js +0 -38
- package/resources/beta/pay/products/entitlements.js.map +0 -1
- package/resources/beta/pay/products/entitlements.mjs +0 -34
- package/resources/beta/pay/products/entitlements.mjs.map +0 -1
- package/resources/beta/pay/products/index.d.mts +0 -4
- package/resources/beta/pay/products/index.d.mts.map +0 -1
- package/resources/beta/pay/products/index.d.ts +0 -4
- package/resources/beta/pay/products/index.d.ts.map +0 -1
- package/resources/beta/pay/products/index.js.map +0 -1
- package/resources/beta/pay/products/index.mjs.map +0 -1
- package/resources/beta/pay/products/products.d.mts +0 -183
- package/resources/beta/pay/products/products.d.mts.map +0 -1
- package/resources/beta/pay/products/products.d.ts +0 -183
- package/resources/beta/pay/products/products.d.ts.map +0 -1
- package/resources/beta/pay/products/products.js.map +0 -1
- package/resources/beta/pay/products/products.mjs.map +0 -1
- package/resources/beta/pay/products/variants.d.mts +0 -206
- package/resources/beta/pay/products/variants.d.mts.map +0 -1
- package/resources/beta/pay/products/variants.d.ts +0 -206
- package/resources/beta/pay/products/variants.d.ts.map +0 -1
- package/resources/beta/pay/products/variants.js.map +0 -1
- package/resources/beta/pay/products/variants.mjs.map +0 -1
- package/resources/beta/pay/products.d.mts.map +0 -1
- package/resources/beta/pay/products.d.ts.map +0 -1
- package/resources/beta/pay/products.js.map +0 -1
- package/resources/beta/pay/products.mjs.map +0 -1
- package/resources/beta/pay.d.mts +0 -2
- package/resources/beta/pay.d.mts.map +0 -1
- package/resources/beta/pay.d.ts +0 -2
- package/resources/beta/pay.d.ts.map +0 -1
- package/resources/beta/pay.js.map +0 -1
- package/resources/beta/pay.mjs.map +0 -1
- package/src/resources/beta/pay/coupons.ts +0 -218
- package/src/resources/beta/pay/customers.ts +0 -229
- package/src/resources/beta/pay/entitlements.ts +0 -113
- package/src/resources/beta/pay/index.ts +0 -46
- package/src/resources/beta/pay/products/entitlements.ts +0 -93
- package/src/resources/beta/pay/products/index.ts +0 -28
- package/src/resources/beta/pay/products/products.ts +0 -280
- package/src/resources/beta/pay/products/variants.ts +0 -279
- /package/resources/beta/{pay → commerce}/products.d.mts +0 -0
- /package/resources/beta/{pay → commerce}/products.d.ts +0 -0
- /package/resources/beta/{pay → commerce}/products.js +0 -0
- /package/resources/beta/{pay → commerce}/products.mjs +0 -0
- /package/src/resources/beta/{pay → commerce}/products.ts +0 -0
|
@@ -0,0 +1,440 @@
|
|
|
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<CouponCreateResponse> {
|
|
17
|
+
return this._client.post('/v1/commerce/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<CouponUpdateResponse> {
|
|
29
|
+
return this._client.patch(path`/v1/commerce/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<CouponListResponsesCursorIDPage, CouponListResponse> {
|
|
40
|
+
return this._client.getAPIList('/v1/commerce/coupons', CursorIDPage<CouponListResponse>, {
|
|
41
|
+
query,
|
|
42
|
+
...options,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Permanently deletes a coupon. The promo code can no longer be used. Existing
|
|
48
|
+
* discounts applied to active subscriptions are not affected.
|
|
49
|
+
*/
|
|
50
|
+
delete(couponID: string, options?: RequestOptions): APIPromise<void> {
|
|
51
|
+
return this._client.delete(path`/v1/commerce/coupons/${couponID}`, {
|
|
52
|
+
...options,
|
|
53
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Retrieves a coupon by ID. Returns the coupon object including discount details
|
|
59
|
+
* and redemption statistics.
|
|
60
|
+
*/
|
|
61
|
+
get(couponID: string, options?: RequestOptions): APIPromise<CouponGetResponse> {
|
|
62
|
+
return this._client.get(path`/v1/commerce/coupons/${couponID}`, options);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type CouponListResponsesCursorIDPage = CursorIDPage<CouponListResponse>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* A discount coupon that customers can apply during checkout using a promo code
|
|
70
|
+
*/
|
|
71
|
+
export interface CouponCreateResponse {
|
|
72
|
+
/**
|
|
73
|
+
* Unique identifier for the topic subscription
|
|
74
|
+
*/
|
|
75
|
+
id: string;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Whether the coupon is currently active and can be redeemed
|
|
79
|
+
*/
|
|
80
|
+
active: boolean;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The promo code customers enter to apply the discount
|
|
84
|
+
*/
|
|
85
|
+
code: string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Timestamp when the coupon was created
|
|
89
|
+
*/
|
|
90
|
+
created: string;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* How long the discount applies: once (first payment only), repeating (for
|
|
94
|
+
* duration_in_months), or forever
|
|
95
|
+
*/
|
|
96
|
+
duration: 'once' | 'repeating' | 'forever';
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Number of times this coupon has been successfully redeemed
|
|
100
|
+
*/
|
|
101
|
+
times_redeemed: number;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Fixed discount amount in the smallest currency unit (e.g., cents). Mutually
|
|
105
|
+
* exclusive with percent_off.
|
|
106
|
+
*/
|
|
107
|
+
amount_off?: number | null;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Three-letter ISO currency code for amount_off discounts
|
|
111
|
+
*/
|
|
112
|
+
currency?: string | null;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Number of months the discount applies when duration is 'repeating'
|
|
116
|
+
*/
|
|
117
|
+
duration_in_months?: number | null;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Maximum number of times this coupon can be redeemed across all customers
|
|
121
|
+
*/
|
|
122
|
+
max_redemptions?: number | null;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Display name for the coupon (shown to customers)
|
|
126
|
+
*/
|
|
127
|
+
name?: string | null;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Percentage discount (1-100). Mutually exclusive with amount_off.
|
|
131
|
+
*/
|
|
132
|
+
percent_off?: number | null;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Expiration date after which the coupon can no longer be redeemed
|
|
136
|
+
*/
|
|
137
|
+
redeem_by?: string | null;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* A discount coupon that customers can apply during checkout using a promo code
|
|
142
|
+
*/
|
|
143
|
+
export interface CouponUpdateResponse {
|
|
144
|
+
/**
|
|
145
|
+
* Unique identifier for the topic subscription
|
|
146
|
+
*/
|
|
147
|
+
id: string;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Whether the coupon is currently active and can be redeemed
|
|
151
|
+
*/
|
|
152
|
+
active: boolean;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The promo code customers enter to apply the discount
|
|
156
|
+
*/
|
|
157
|
+
code: string;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Timestamp when the coupon was created
|
|
161
|
+
*/
|
|
162
|
+
created: string;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* How long the discount applies: once (first payment only), repeating (for
|
|
166
|
+
* duration_in_months), or forever
|
|
167
|
+
*/
|
|
168
|
+
duration: 'once' | 'repeating' | 'forever';
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Number of times this coupon has been successfully redeemed
|
|
172
|
+
*/
|
|
173
|
+
times_redeemed: number;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Fixed discount amount in the smallest currency unit (e.g., cents). Mutually
|
|
177
|
+
* exclusive with percent_off.
|
|
178
|
+
*/
|
|
179
|
+
amount_off?: number | null;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Three-letter ISO currency code for amount_off discounts
|
|
183
|
+
*/
|
|
184
|
+
currency?: string | null;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Number of months the discount applies when duration is 'repeating'
|
|
188
|
+
*/
|
|
189
|
+
duration_in_months?: number | null;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Maximum number of times this coupon can be redeemed across all customers
|
|
193
|
+
*/
|
|
194
|
+
max_redemptions?: number | null;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Display name for the coupon (shown to customers)
|
|
198
|
+
*/
|
|
199
|
+
name?: string | null;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Percentage discount (1-100). Mutually exclusive with amount_off.
|
|
203
|
+
*/
|
|
204
|
+
percent_off?: number | null;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Expiration date after which the coupon can no longer be redeemed
|
|
208
|
+
*/
|
|
209
|
+
redeem_by?: string | null;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* A discount coupon that customers can apply during checkout using a promo code
|
|
214
|
+
*/
|
|
215
|
+
export interface CouponListResponse {
|
|
216
|
+
/**
|
|
217
|
+
* Unique identifier for the topic subscription
|
|
218
|
+
*/
|
|
219
|
+
id: string;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Whether the coupon is currently active and can be redeemed
|
|
223
|
+
*/
|
|
224
|
+
active: boolean;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* The promo code customers enter to apply the discount
|
|
228
|
+
*/
|
|
229
|
+
code: string;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Timestamp when the coupon was created
|
|
233
|
+
*/
|
|
234
|
+
created: string;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* How long the discount applies: once (first payment only), repeating (for
|
|
238
|
+
* duration_in_months), or forever
|
|
239
|
+
*/
|
|
240
|
+
duration: 'once' | 'repeating' | 'forever';
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Number of times this coupon has been successfully redeemed
|
|
244
|
+
*/
|
|
245
|
+
times_redeemed: number;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Fixed discount amount in the smallest currency unit (e.g., cents). Mutually
|
|
249
|
+
* exclusive with percent_off.
|
|
250
|
+
*/
|
|
251
|
+
amount_off?: number | null;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Three-letter ISO currency code for amount_off discounts
|
|
255
|
+
*/
|
|
256
|
+
currency?: string | null;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Number of months the discount applies when duration is 'repeating'
|
|
260
|
+
*/
|
|
261
|
+
duration_in_months?: number | null;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Maximum number of times this coupon can be redeemed across all customers
|
|
265
|
+
*/
|
|
266
|
+
max_redemptions?: number | null;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Display name for the coupon (shown to customers)
|
|
270
|
+
*/
|
|
271
|
+
name?: string | null;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Percentage discount (1-100). Mutually exclusive with amount_off.
|
|
275
|
+
*/
|
|
276
|
+
percent_off?: number | null;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Expiration date after which the coupon can no longer be redeemed
|
|
280
|
+
*/
|
|
281
|
+
redeem_by?: string | null;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* A discount coupon that customers can apply during checkout using a promo code
|
|
286
|
+
*/
|
|
287
|
+
export interface CouponGetResponse {
|
|
288
|
+
/**
|
|
289
|
+
* Unique identifier for the topic subscription
|
|
290
|
+
*/
|
|
291
|
+
id: string;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Whether the coupon is currently active and can be redeemed
|
|
295
|
+
*/
|
|
296
|
+
active: boolean;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* The promo code customers enter to apply the discount
|
|
300
|
+
*/
|
|
301
|
+
code: string;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Timestamp when the coupon was created
|
|
305
|
+
*/
|
|
306
|
+
created: string;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* How long the discount applies: once (first payment only), repeating (for
|
|
310
|
+
* duration_in_months), or forever
|
|
311
|
+
*/
|
|
312
|
+
duration: 'once' | 'repeating' | 'forever';
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Number of times this coupon has been successfully redeemed
|
|
316
|
+
*/
|
|
317
|
+
times_redeemed: number;
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Fixed discount amount in the smallest currency unit (e.g., cents). Mutually
|
|
321
|
+
* exclusive with percent_off.
|
|
322
|
+
*/
|
|
323
|
+
amount_off?: number | null;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Three-letter ISO currency code for amount_off discounts
|
|
327
|
+
*/
|
|
328
|
+
currency?: string | null;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Number of months the discount applies when duration is 'repeating'
|
|
332
|
+
*/
|
|
333
|
+
duration_in_months?: number | null;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Maximum number of times this coupon can be redeemed across all customers
|
|
337
|
+
*/
|
|
338
|
+
max_redemptions?: number | null;
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Display name for the coupon (shown to customers)
|
|
342
|
+
*/
|
|
343
|
+
name?: string | null;
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Percentage discount (1-100). Mutually exclusive with amount_off.
|
|
347
|
+
*/
|
|
348
|
+
percent_off?: number | null;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Expiration date after which the coupon can no longer be redeemed
|
|
352
|
+
*/
|
|
353
|
+
redeem_by?: string | null;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export interface CouponCreateParams {
|
|
357
|
+
/**
|
|
358
|
+
* The promo code customers will enter to apply the discount
|
|
359
|
+
*/
|
|
360
|
+
code: string;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Optional custom ID for the coupon. If not provided, one will be generated.
|
|
364
|
+
*/
|
|
365
|
+
id?: string;
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Fixed discount in the smallest currency unit (e.g., cents). Mutually exclusive
|
|
369
|
+
* with percent_off.
|
|
370
|
+
*/
|
|
371
|
+
amount_off?: number;
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Three-letter ISO currency code for amount_off discounts
|
|
375
|
+
*/
|
|
376
|
+
currency?: string;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* How long the discount applies: once (first payment only), repeating (for
|
|
380
|
+
* duration_in_months), or forever
|
|
381
|
+
*/
|
|
382
|
+
duration?: 'once' | 'repeating' | 'forever';
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Number of months the discount applies when duration is 'repeating'
|
|
386
|
+
*/
|
|
387
|
+
duration_in_months?: number;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Maximum number of times this coupon can be redeemed
|
|
391
|
+
*/
|
|
392
|
+
max_redemptions?: number;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Display name for the coupon (shown to customers)
|
|
396
|
+
*/
|
|
397
|
+
name?: string;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Percentage discount (1-100). Mutually exclusive with amount_off.
|
|
401
|
+
*/
|
|
402
|
+
percent_off?: number;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Expiration date after which the coupon can no longer be redeemed
|
|
406
|
+
*/
|
|
407
|
+
redeem_by?: string;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export interface CouponUpdateParams {
|
|
411
|
+
/**
|
|
412
|
+
* Whether the coupon is active and can be redeemed
|
|
413
|
+
*/
|
|
414
|
+
active?: boolean;
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Display name for the coupon
|
|
418
|
+
*/
|
|
419
|
+
name?: string;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export interface CouponListParams extends CursorIDPageParams {
|
|
423
|
+
/**
|
|
424
|
+
* Filter by active status
|
|
425
|
+
*/
|
|
426
|
+
active?: boolean;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
export declare namespace Coupons {
|
|
430
|
+
export {
|
|
431
|
+
type CouponCreateResponse as CouponCreateResponse,
|
|
432
|
+
type CouponUpdateResponse as CouponUpdateResponse,
|
|
433
|
+
type CouponListResponse as CouponListResponse,
|
|
434
|
+
type CouponGetResponse as CouponGetResponse,
|
|
435
|
+
type CouponListResponsesCursorIDPage as CouponListResponsesCursorIDPage,
|
|
436
|
+
type CouponCreateParams as CouponCreateParams,
|
|
437
|
+
type CouponUpdateParams as CouponUpdateParams,
|
|
438
|
+
type CouponListParams as CouponListParams,
|
|
439
|
+
};
|
|
440
|
+
}
|