chargebee 2.42.0 → 2.44.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 +82 -0
- package/README.md +3 -0
- package/lib/chargebee.js +1 -1
- package/lib/resources/api_endpoints.js +47 -0
- package/package.json +1 -1
- package/types/core.d.ts +3 -2
- package/types/index.d.ts +6 -0
- package/types/resources/AttachedItem.d.ts +4 -0
- package/types/resources/Card.d.ts +5 -1
- package/types/resources/Coupon.d.ts +204 -522
- package/types/resources/Customer.d.ts +2 -2
- package/types/resources/DifferentialPrice.d.ts +4 -0
- package/types/resources/Estimate.d.ts +26 -7
- package/types/resources/Export.d.ts +16 -0
- package/types/resources/Invoice.d.ts +2 -2
- package/types/resources/Item.d.ts +17 -0
- package/types/resources/ItemFamily.d.ts +25 -100
- package/types/resources/ItemPrice.d.ts +91 -840
- package/types/resources/OmnichannelSubscription.d.ts +96 -0
- package/types/resources/OmnichannelTransaction.d.ts +26 -0
- package/types/resources/PaymentScheduleEstimate.d.ts +35 -0
- package/types/resources/PaymentScheduleScheme.d.ts +5 -1
- package/types/resources/PaymentSource.d.ts +25 -896
- package/types/resources/PriceVariant.d.ts +6 -0
- package/types/resources/PricingPageSession.d.ts +4 -0
- package/types/resources/Quote.d.ts +41 -38
- package/types/resources/QuotedSubscription.d.ts +53 -378
- package/types/resources/RecordedPurchase.d.ts +56 -0
- package/types/resources/Subscription.d.ts +729 -3247
- package/types/resources/Transaction.d.ts +99 -581
|
@@ -1,670 +1,429 @@
|
|
|
1
1
|
///<reference path='./../core.d.ts'/>
|
|
2
|
+
///<reference path='./../index.d.ts'/>
|
|
2
3
|
declare module 'chargebee' {
|
|
3
4
|
export interface Coupon {
|
|
4
5
|
[key : string] : any;
|
|
5
|
-
/**
|
|
6
|
-
* @description Used to uniquely identify the coupon in your website/application and to integrate with Chargebee.
|
|
7
|
-
**Note:**
|
|
8
|
-
|
|
9
6
|
|
|
10
|
-
When the coupon ID contains a special character; for example: `#`, the API returns an error.
|
|
11
|
-
Make sure that you [encode](https://www.urlencoder.org/) the coupon ID in the path parameter before making an API call.
|
|
12
|
-
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
7
|
id:string;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @description The display name used in web interface for identifying the coupon.
|
|
19
|
-
**Note:**
|
|
20
|
-
|
|
21
8
|
|
|
22
|
-
When the name of the coupon set contains a special character; for example: `#`, the API returns an error.
|
|
23
|
-
Make sure that you [encode](https://www.urlencoder.org/) the name of the coupon set in the path parameter before making an API call.
|
|
24
|
-
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
9
|
name:string;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @description Display name used in invoice. If it is not configured then name is used in invoice.
|
|
31
10
|
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
11
|
invoice_name?:string;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @description The type of deduction \* percentage - The specified percentage will be deducted. \* fixed_amount - The specified amount will be deducted.
|
|
38
12
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
discount_type:'fixed_amount' | 'percentage';
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @description The percentage of the original amount that should be deducted from it.
|
|
13
|
+
discount_type:'fixed_amount' | 'percentage' | 'offer_quantity';
|
|
45
14
|
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
15
|
discount_percentage?:number;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @description The value of the deduction. The format of this value depends on the [kind of currency](/docs/api#currencies).
|
|
52
16
|
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
17
|
discount_amount?:number;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @description The currency code ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html)) of the coupon. Applicable for *fixed_amount* coupons alone.
|
|
59
18
|
|
|
60
|
-
|
|
61
|
-
|
|
19
|
+
discount_quantity?:number;
|
|
20
|
+
|
|
62
21
|
currency_code?:string;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @description Specifies the time duration for which this coupon is attached to the subscription. \* forever - The coupon is attached to the subscription and applied on the invoices until explicitly removed. \* one_time - The coupon stays attached to the subscription till it is applied on an invoice **once** . It is removed after that from the subscription. \* limited_period - The discount is attached to the subscription and applied on the invoices for a limited duration. This duration starts from the point it is applied to an invoice for the first time and expires after a period specified by `period` and `period_unit`.
|
|
66
22
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
duration_type:'limited_period' | 'one_time' | 'forever';
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* @description Date upto which the coupon can be applied to new subscriptions.
|
|
23
|
+
duration_type:'one_time' | 'forever' | 'limited_period';
|
|
73
24
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
valid_till?:number;
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* @description Maximum number of times this coupon can be redeemed.
|
|
80
|
-
**Note:**
|
|
25
|
+
duration_month?:number;
|
|
81
26
|
|
|
27
|
+
valid_from?:number;
|
|
82
28
|
|
|
83
|
-
|
|
29
|
+
valid_till?:number;
|
|
84
30
|
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
31
|
max_redemptions?:number;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* @description Status of the coupon. \* expired - Cannot be applied to a subscription. A coupon may expire due to exceeding [max_redemptions](/docs/api/coupons?#coupon_max_redemptions) or [valid_till](/docs/api/coupons?#coupon_valid_till) date is past. Existing associations remain unaffected. \* archived - Cannot be applied to a subscription. Existing associations remain unaffected. \* active - Can be applied to a subscription. \* deleted - Indicates the coupon has been deleted.
|
|
91
32
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* @description The amount on the invoice to which the coupon is applied. \* invoice_amount - The coupon is applied to the invoice `sub_total`. \* each_specified_item - The coupon is applied to the `invoice.line_item.amount` that corresponds to the item price specified by `item_price_id`.
|
|
33
|
+
status?:'active' | 'expired' | 'archived' | 'deleted' | 'future';
|
|
34
|
+
|
|
35
|
+
apply_discount_on:'plans' | 'plans_and_addons' | 'plans_with_quantity' | 'not_applicable';
|
|
98
36
|
|
|
99
|
-
*/
|
|
100
|
-
|
|
101
37
|
apply_on:'invoice_amount' | 'each_specified_item';
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* @description Timestamp indicating when this coupon is created.
|
|
105
38
|
|
|
106
|
-
|
|
107
|
-
|
|
39
|
+
plan_constraint:'none' | 'all' | 'specific' | 'not_applicable';
|
|
40
|
+
|
|
41
|
+
addon_constraint:'none' | 'all' | 'specific' | 'not_applicable';
|
|
42
|
+
|
|
108
43
|
created_at:number;
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* @description Timestamp indicating when this coupon was archived.
|
|
112
44
|
|
|
113
|
-
*/
|
|
114
|
-
|
|
115
45
|
archived_at?:number;
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* @description The version number of this resource. For every change made to the resource, `resource_version` is updated with a new timestamp in milliseconds.
|
|
119
46
|
|
|
120
|
-
*/
|
|
121
|
-
|
|
122
47
|
resource_version?:number;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* @description Timestamp indicating when this coupon was last updated.
|
|
126
|
-
Note that this does not change when the [redemptions](/docs/api/coupons?#coupon_redemptions) attribute is changed. This attribute will be present only if the resource has been updated after 2016-11-09.
|
|
127
48
|
|
|
128
|
-
*/
|
|
129
|
-
|
|
130
49
|
updated_at?:number;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* @description The duration of time for which the coupon is attached to the subscription, in `period_units`. Applicable only when [duration_type](/docs/api/coupons?#coupon_duration_type) is [limited_period](/docs/api/coupons?#coupon_duration_type).
|
|
134
50
|
|
|
135
|
-
|
|
136
|
-
|
|
51
|
+
included_in_mrr?:boolean;
|
|
52
|
+
|
|
137
53
|
period?:number;
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* @description The unit of time for period. Applicable only when [duration_type](/docs/api/coupons?#coupon_duration_type) is [limited_period](/docs/api/coupons?#coupon_duration_type). \* month - A period of 1 calendar month. \* week - A period of 7 days. \* year - A period of 1 calendar year. \* day - A period of 24 hours.
|
|
141
54
|
|
|
142
|
-
*/
|
|
143
|
-
|
|
144
55
|
period_unit?:PeriodUnit;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* @description The number of times this coupon has been redeemed.
|
|
148
56
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
redemptions?:number;
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* @description A customer-facing note added to all invoices associated with this API resource. This note becomes one among [all the notes](/docs/api/invoices#invoice_notes) displayed on the invoice PDF.
|
|
57
|
+
plan_ids?:string[];
|
|
155
58
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
invoice_notes?:string;
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* @description The list of item constraints.
|
|
59
|
+
addon_ids?:string[];
|
|
162
60
|
|
|
163
|
-
*/
|
|
164
|
-
|
|
165
61
|
item_constraints?:Coupon.ItemConstraint[];
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* @description The list of item constraint criteria.
|
|
169
62
|
|
|
170
|
-
*/
|
|
171
|
-
|
|
172
63
|
item_constraint_criteria?:Coupon.ItemConstraintCriteria[];
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* @description List of constraints applicable on the redemption of this coupon.
|
|
176
64
|
|
|
177
|
-
|
|
178
|
-
|
|
65
|
+
redemptions?:number;
|
|
66
|
+
|
|
67
|
+
invoice_notes?:string;
|
|
68
|
+
|
|
69
|
+
meta_data?:object;
|
|
70
|
+
|
|
179
71
|
coupon_constraints?:Coupon.CouponConstraint[];
|
|
72
|
+
|
|
180
73
|
}
|
|
181
74
|
export namespace Coupon {
|
|
182
75
|
export class CouponResource {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
*/
|
|
187
|
-
|
|
76
|
+
create(input:CreateInputParam):ChargebeeRequest<CreateResponse>;
|
|
77
|
+
|
|
188
78
|
create_for_items(input:CreateForItemsInputParam):ChargebeeRequest<CreateForItemsResponse>;
|
|
189
79
|
|
|
190
|
-
|
|
191
|
-
* @description This API updates a coupon that is created for a specific promotion or offers.
|
|
192
|
-
|
|
193
|
-
*/
|
|
194
|
-
|
|
195
|
-
update_for_items(coupon_id:string, input?:UpdateForItemsInputParam):ChargebeeRequest<UpdateForItemsResponse>;
|
|
80
|
+
update_for_items(coupon_id:string, input:UpdateForItemsInputParam):ChargebeeRequest<UpdateForItemsResponse>;
|
|
196
81
|
|
|
197
|
-
/**
|
|
198
|
-
* @description List all the available coupons that are created for a specific promotion or offers. You can find list of coupon codes that are currently active, expired, archived or deleted.
|
|
199
|
-
|
|
200
|
-
*/
|
|
201
|
-
|
|
202
82
|
list(input?:ListInputParam):ChargebeeRequest<ListResponse>;
|
|
203
83
|
|
|
204
|
-
/**
|
|
205
|
-
* @description This API retrieves a specific coupon using the coupon ID.
|
|
206
|
-
|
|
207
|
-
*/
|
|
208
|
-
|
|
209
84
|
retrieve(coupon_id:string):ChargebeeRequest<RetrieveResponse>;
|
|
210
85
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
To ensure that existing Subscriptions/Invoices are not affected, Coupons associated with them will not be deleted, but moved to "Archived" state. Once a Coupon has been archived, it cannot be edited or used again unless [unarchived](coupons#unarchive_a_coupon). Unused Coupons codes are deleted.
|
|
215
|
-
|
|
216
|
-
*/
|
|
217
|
-
|
|
86
|
+
update(coupon_id:string, input?:UpdateInputParam):ChargebeeRequest<UpdateResponse>;
|
|
87
|
+
|
|
218
88
|
delete(coupon_id:string):ChargebeeRequest<DeleteResponse>;
|
|
219
89
|
|
|
220
|
-
/**
|
|
221
|
-
* @description Copies a coupon over from one site to another. Copying of [archived](./coupons?prod_cat_ver=2#coupon_status) coupons is not supported.
|
|
222
|
-
|
|
223
|
-
The item prices that are linked to the coupon in the source site are also linked to the coupon in the destination site. However, this will only work if those item prices exist and with the same [ids](./item_prices?prod_cat_ver=2#item_price_id), in the destination site. Hence, it is recommended that the item prices be copied over before copying the coupons.
|
|
224
|
-
|
|
225
|
-
The value for [redemptions](./coupons?prod_cat_ver=2#coupon_redemptions) is not copied. It is set to `0` for the newly created coupon. Hence, if such a coupon had `expired` in the source site due to `redemptions` having reached [max_redemptions](./coupons?prod_cat_ver=2#coupon_max_redemptions), it's [status](./coupons?prod_cat_ver=2#coupon_status) would be `active` in the destination site.
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
*/
|
|
229
|
-
|
|
230
90
|
copy(input:CopyInputParam):ChargebeeRequest<CopyResponse>;
|
|
231
91
|
|
|
232
|
-
/**
|
|
233
|
-
* @description This API unarchives a specific coupon using the coupon ID.
|
|
234
|
-
|
|
235
|
-
*/
|
|
236
|
-
|
|
237
92
|
unarchive(coupon_id:string):ChargebeeRequest<UnarchiveResponse>;
|
|
238
93
|
}
|
|
239
|
-
export interface
|
|
94
|
+
export interface CreateResponse {
|
|
240
95
|
coupon:Coupon;
|
|
241
96
|
}
|
|
242
|
-
export interface
|
|
243
|
-
[key : string] : any;
|
|
244
|
-
/**
|
|
245
|
-
* @description Used to uniquely identify the coupon in your website/application and to integrate with Chargebee.
|
|
246
|
-
**Note:**
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
When the coupon ID contains a special character; for example: `#`, the API returns an error.
|
|
250
|
-
Make sure that you [encode](https://www.urlencoder.org/) the coupon ID in the path parameter before making an API call.
|
|
251
|
-
.
|
|
252
|
-
|
|
253
|
-
*/
|
|
97
|
+
export interface CreateInputParam {
|
|
254
98
|
|
|
255
99
|
id:string;
|
|
256
100
|
|
|
257
|
-
/**
|
|
258
|
-
* @description The display name used in web interface for identifying the coupon.
|
|
259
|
-
**Note:**
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
When the name of the coupon set contains a special character; for example: `#`, the API returns an error.
|
|
263
|
-
Make sure that you [encode](https://www.urlencoder.org/) the name of the coupon set in the path parameter before making an API call.
|
|
264
|
-
.
|
|
265
|
-
|
|
266
|
-
*/
|
|
267
|
-
|
|
268
101
|
name:string;
|
|
269
102
|
|
|
270
|
-
/**
|
|
271
|
-
* @description Display name used in invoice. If it is not configured then name is used in invoice.
|
|
272
|
-
|
|
273
|
-
*/
|
|
274
|
-
|
|
275
103
|
invoice_name?:string;
|
|
276
104
|
|
|
277
|
-
|
|
278
|
-
* @description The type of deduction. \* percentage - The specified percentage will be deducted. \* fixed_amount - The specified amount will be deducted. \* offer_quantity - The specified units will be offered for free.
|
|
279
|
-
|
|
280
|
-
*/
|
|
281
|
-
|
|
282
|
-
discount_type?:'fixed_amount' | 'percentage';
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* @description The value of the deduction. The format of this value depends on the [kind of currency](/docs/api#currencies).
|
|
286
|
-
|
|
287
|
-
*/
|
|
105
|
+
discount_type?:'fixed_amount' | 'percentage' | 'offer_quantity';
|
|
288
106
|
|
|
289
107
|
discount_amount?:number;
|
|
290
108
|
|
|
291
|
-
/**
|
|
292
|
-
* @description The currency code ([ISO 4217 format](https://www.chargebee.com/docs/2.0/supported-currencies.html)) of the coupon. Applicable for *fixed_amount* coupons alone.
|
|
293
|
-
|
|
294
|
-
*/
|
|
295
|
-
|
|
296
109
|
currency_code?:string;
|
|
297
110
|
|
|
298
|
-
/**
|
|
299
|
-
* @description The percentage of the original amount that should be deducted from it.
|
|
300
|
-
|
|
301
|
-
*/
|
|
302
|
-
|
|
303
111
|
discount_percentage?:number;
|
|
304
112
|
|
|
305
|
-
|
|
306
|
-
* @description The amount on the invoice to which the coupon is applied. \* invoice_amount - The coupon is applied to the invoice `sub_total`. \* each_unit_of_specified_items - Discount will be applied to each unit of plan and addon items specified. \* each_specified_item - The coupon is applied to the `invoice.line_item.amount` that corresponds to the item price specified by `item_price_id`. \* specified_items_total - Discount will be applied to the total of plan and addon items specified.
|
|
307
|
-
|
|
308
|
-
*/
|
|
113
|
+
discount_quantity?:number;
|
|
309
114
|
|
|
310
115
|
apply_on:'invoice_amount' | 'each_specified_item';
|
|
311
116
|
|
|
312
|
-
|
|
313
|
-
* @description Specifies the time duration for which this coupon is attached to the subscription. \* forever - The coupon is attached to the subscription and applied on the invoices until explicitly removed. \* one_time - The coupon stays attached to the subscription till it is applied on an invoice **once** . It is removed after that from the subscription. \* limited_period - The discount is attached to the subscription and applied on the invoices for a limited duration. This duration starts from the point it is applied to an invoice for the first time and expires after a period specified by `period` and `period_unit`.
|
|
314
|
-
|
|
315
|
-
*/
|
|
117
|
+
duration_type?:'one_time' | 'forever' | 'limited_period';
|
|
316
118
|
|
|
317
|
-
|
|
119
|
+
duration_month?:number;
|
|
318
120
|
|
|
319
|
-
|
|
320
|
-
* @description **(Deprecated)** The duration of time in months for which the coupon is attached to the subscription. Applicable only when `duration_type` is `limited_period`.
|
|
321
|
-
**Note:** This parameter has been deprecated. Use `period` and `period_unit` instead.
|
|
322
|
-
|
|
323
|
-
*/
|
|
121
|
+
valid_till?:number;
|
|
324
122
|
|
|
325
|
-
|
|
123
|
+
max_redemptions?:number;
|
|
326
124
|
|
|
327
|
-
|
|
328
|
-
* @description Date upto which the coupon can be applied to new subscriptions.
|
|
329
|
-
|
|
330
|
-
*/
|
|
125
|
+
invoice_notes?:string;
|
|
331
126
|
|
|
332
|
-
|
|
127
|
+
meta_data?:object;
|
|
333
128
|
|
|
334
|
-
|
|
335
|
-
* @description Maximum number of times this coupon can be redeemed.
|
|
336
|
-
**Note:**
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
If not specified, the coupon can be redeemed an indefinite number of times.
|
|
340
|
-
.
|
|
341
|
-
|
|
342
|
-
*/
|
|
129
|
+
included_in_mrr?:boolean;
|
|
343
130
|
|
|
344
|
-
|
|
131
|
+
period?:number;
|
|
345
132
|
|
|
346
|
-
|
|
347
|
-
* @description A customer-facing note added to all invoices associated with this API resource. This note becomes one among [all the notes](/docs/api/invoices#invoice_notes) displayed on the invoice PDF.
|
|
348
|
-
|
|
349
|
-
*/
|
|
133
|
+
period_unit?:PeriodUnit;
|
|
350
134
|
|
|
351
|
-
|
|
135
|
+
plan_constraint?:'none' | 'all' | 'specific';
|
|
352
136
|
|
|
353
|
-
|
|
354
|
-
* @description A collection of key-value pairs that provides extra information about the coupon.
|
|
355
|
-
**Note:** There's a character limit of 65,535.
|
|
356
|
-
[Learn more](advanced-features?prod_cat_ver=2#metadata).
|
|
357
|
-
|
|
358
|
-
*/
|
|
137
|
+
addon_constraint?:'none' | 'all' | 'specific';
|
|
359
138
|
|
|
360
|
-
|
|
139
|
+
plan_ids?:string[];
|
|
361
140
|
|
|
362
|
-
|
|
363
|
-
* @description The coupon is included in MRR calculations for your site. This attribute is only applicable for coupons of `duration_type = one_time` and when the feature is enabled in Chargebee. Note: If the site-level setting is to exclude one-time coupons from MRR calculations, this value is always returned `false`.
|
|
364
|
-
|
|
365
|
-
*/
|
|
141
|
+
addon_ids?:string[];
|
|
366
142
|
|
|
367
|
-
|
|
143
|
+
status?:'active' | 'archived';
|
|
144
|
+
}
|
|
145
|
+
export interface CreateForItemsResponse {
|
|
146
|
+
coupon:Coupon;
|
|
147
|
+
}
|
|
148
|
+
export interface CreateForItemsInputParam {
|
|
149
|
+
[key : string] : any;
|
|
150
|
+
item_constraints:{constraint:'none' | 'all' | 'specific' | 'criteria',item_price_ids?:any[],item_type:'plan' | 'addon' | 'charge'}[];
|
|
368
151
|
|
|
369
|
-
|
|
370
|
-
* @description The duration of time for which the coupon is attached to the subscription, in `period_units`. Applicable only when [duration_type](/docs/api/coupons?#coupon_duration_type) is [limited_period](/docs/api/coupons?#coupon_duration_type).
|
|
371
|
-
|
|
372
|
-
*/
|
|
152
|
+
item_constraint_criteria?:{currencies?:any[],item_family_ids?:any[],item_price_periods?:any[],item_type?:'plan' | 'addon' | 'charge'}[];
|
|
373
153
|
|
|
374
|
-
|
|
154
|
+
coupon_constraints:{entity_type:'customer',type:'max_redemptions' | 'unique_by' | 'existing_customer' | 'new_customer',value?:string}[];
|
|
375
155
|
|
|
376
|
-
|
|
377
|
-
* @description The unit of time for period. Applicable only when [duration_type](/docs/api/coupons?#coupon_duration_type) is [limited_period](/docs/api/coupons?#coupon_duration_type). \* month - A period of 1 calendar month. \* week - A period of 7 days. \* year - A period of 1 calendar year. \* day - A period of 24 hours.
|
|
378
|
-
|
|
379
|
-
*/
|
|
156
|
+
id:string;
|
|
380
157
|
|
|
381
|
-
|
|
158
|
+
name:string;
|
|
382
159
|
|
|
383
|
-
|
|
384
|
-
* @description Status of the coupon. \* expired - Cannot be applied to a subscription. A coupon may expire due to exceeding [max_redemptions](/docs/api/coupons?#coupon_max_redemptions) or [valid_till](/docs/api/coupons?#coupon_valid_till) date is past. Existing associations remain unaffected. \* archived - Cannot be applied to a subscription. Existing associations remain unaffected. \* active - Can be applied to a subscription. \* deleted - Indicates the coupon has been deleted.
|
|
385
|
-
|
|
386
|
-
*/
|
|
160
|
+
invoice_name?:string;
|
|
387
161
|
|
|
388
|
-
|
|
162
|
+
discount_type?:'fixed_amount' | 'percentage' | 'offer_quantity';
|
|
389
163
|
|
|
390
|
-
|
|
391
|
-
* @description Parameters for item_constraints
|
|
392
|
-
|
|
393
|
-
*/
|
|
164
|
+
discount_amount?:number;
|
|
394
165
|
|
|
395
|
-
|
|
166
|
+
currency_code?:string;
|
|
396
167
|
|
|
397
|
-
|
|
398
|
-
* @description Parameters for item_constraint_criteria
|
|
399
|
-
|
|
400
|
-
*/
|
|
168
|
+
discount_percentage?:number;
|
|
401
169
|
|
|
402
|
-
|
|
170
|
+
discount_quantity?:number;
|
|
403
171
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
172
|
+
apply_on:'invoice_amount' | 'each_specified_item';
|
|
173
|
+
|
|
174
|
+
duration_type?:'one_time' | 'forever' | 'limited_period';
|
|
175
|
+
|
|
176
|
+
duration_month?:number;
|
|
177
|
+
|
|
178
|
+
valid_from?:number;
|
|
408
179
|
|
|
409
|
-
|
|
180
|
+
valid_till?:number;
|
|
181
|
+
|
|
182
|
+
max_redemptions?:number;
|
|
183
|
+
|
|
184
|
+
invoice_notes?:string;
|
|
185
|
+
|
|
186
|
+
meta_data?:object;
|
|
187
|
+
|
|
188
|
+
included_in_mrr?:boolean;
|
|
189
|
+
|
|
190
|
+
period?:number;
|
|
191
|
+
|
|
192
|
+
period_unit?:PeriodUnit;
|
|
193
|
+
|
|
194
|
+
status?:'active' | 'archived';
|
|
410
195
|
}
|
|
411
196
|
export interface UpdateForItemsResponse {
|
|
412
197
|
coupon:Coupon;
|
|
413
198
|
}
|
|
414
199
|
export interface UpdateForItemsInputParam {
|
|
415
200
|
[key : string] : any;
|
|
416
|
-
|
|
417
|
-
* @description The display name used in web interface for identifying the coupon.
|
|
418
|
-
**Note:**
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
When the name of the coupon set contains a special character; for example: `#`, the API returns an error.
|
|
422
|
-
Make sure that you [encode](https://www.urlencoder.org/) the name of the coupon set in the path parameter before making an API call.
|
|
423
|
-
.
|
|
424
|
-
|
|
425
|
-
*/
|
|
201
|
+
item_constraints:{constraint:'none' | 'all' | 'specific' | 'criteria',item_price_ids?:any[],item_type:'plan' | 'addon' | 'charge'}[];
|
|
426
202
|
|
|
427
|
-
|
|
203
|
+
item_constraint_criteria?:{currencies?:any[],item_family_ids?:any[],item_price_periods?:any[],item_type?:'plan' | 'addon' | 'charge'}[];
|
|
428
204
|
|
|
429
|
-
|
|
430
|
-
* @description Display name used in invoice. If it is not configured then name is used in invoice.
|
|
431
|
-
|
|
432
|
-
*/
|
|
205
|
+
coupon_constraints:{entity_type:'customer',type:'max_redemptions' | 'unique_by' | 'existing_customer' | 'new_customer',value?:string}[];
|
|
433
206
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* @description The type of deduction. \* percentage - The specified percentage will be deducted. \* fixed_amount - The specified amount will be deducted. \* offer_quantity - The specified units will be offered for free.
|
|
438
|
-
|
|
439
|
-
*/
|
|
207
|
+
name?:string;
|
|
440
208
|
|
|
441
|
-
|
|
209
|
+
invoice_name?:string;
|
|
442
210
|
|
|
443
|
-
|
|
444
|
-
* @description The value of the deduction. The format of this value depends on the [kind of currency](/docs/api#currencies).
|
|
445
|
-
|
|
446
|
-
*/
|
|
211
|
+
discount_type?:'fixed_amount' | 'percentage' | 'offer_quantity';
|
|
447
212
|
|
|
448
213
|
discount_amount?:number;
|
|
449
214
|
|
|
450
|
-
/**
|
|
451
|
-
* @description The currency code ([ISO 4217 format](https://www.chargebee.com/docs/2.0/supported-currencies.html)) of the coupon. Applicable for *fixed_amount* coupons alone.
|
|
452
|
-
|
|
453
|
-
*/
|
|
454
|
-
|
|
455
215
|
currency_code?:string;
|
|
456
216
|
|
|
457
|
-
/**
|
|
458
|
-
* @description The percentage of the original amount that should be deducted from it.
|
|
459
|
-
|
|
460
|
-
*/
|
|
461
|
-
|
|
462
217
|
discount_percentage?:number;
|
|
463
218
|
|
|
464
|
-
|
|
465
|
-
* @description The amount on the invoice to which the coupon is applied. \* invoice_amount - The coupon is applied to the invoice `sub_total`. \* each_unit_of_specified_items - Discount will be applied to each unit of plan and addon items specified. \* each_specified_item - The coupon is applied to the `invoice.line_item.amount` that corresponds to the item price specified by `item_price_id`. \* specified_items_total - Discount will be applied to the total of plan and addon items specified.
|
|
466
|
-
|
|
467
|
-
*/
|
|
219
|
+
discount_quantity?:number;
|
|
468
220
|
|
|
469
221
|
apply_on?:'invoice_amount' | 'each_specified_item';
|
|
470
222
|
|
|
471
|
-
|
|
472
|
-
* @description Specifies the time duration for which this coupon is attached to the subscription. \* forever - The coupon is attached to the subscription and applied on the invoices until explicitly removed. \* one_time - The coupon stays attached to the subscription till it is applied on an invoice **once** . It is removed after that from the subscription. \* limited_period - The discount is attached to the subscription and applied on the invoices for a limited duration. This duration starts from the point it is applied to an invoice for the first time and expires after a period specified by `period` and `period_unit`.
|
|
473
|
-
|
|
474
|
-
*/
|
|
475
|
-
|
|
476
|
-
duration_type?:'limited_period' | 'one_time' | 'forever';
|
|
477
|
-
|
|
478
|
-
/**
|
|
479
|
-
* @description **(Deprecated)** The duration of time in months for which the coupon is attached to the subscription. Applicable only when `duration_type` is `limited_period`.
|
|
480
|
-
**Note:** This parameter has been deprecated. Use `period` and `period_unit` instead.
|
|
481
|
-
|
|
482
|
-
*/
|
|
223
|
+
duration_type?:'one_time' | 'forever' | 'limited_period';
|
|
483
224
|
|
|
484
225
|
duration_month?:number;
|
|
485
226
|
|
|
486
|
-
|
|
487
|
-
* @description Date upto which the coupon can be applied to new subscriptions.
|
|
488
|
-
|
|
489
|
-
*/
|
|
227
|
+
valid_from?:number;
|
|
490
228
|
|
|
491
229
|
valid_till?:number;
|
|
492
230
|
|
|
493
|
-
/**
|
|
494
|
-
* @description Maximum number of times this coupon can be redeemed.
|
|
495
|
-
**Note:**
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
If not specified, the coupon can be redeemed an indefinite number of times.
|
|
499
|
-
.
|
|
500
|
-
|
|
501
|
-
*/
|
|
502
|
-
|
|
503
231
|
max_redemptions?:number;
|
|
504
232
|
|
|
505
|
-
/**
|
|
506
|
-
* @description A customer-facing note added to all invoices associated with this API resource. This note becomes one among [all the notes](/docs/api/invoices#invoice_notes) displayed on the invoice PDF.
|
|
507
|
-
|
|
508
|
-
*/
|
|
509
|
-
|
|
510
233
|
invoice_notes?:string;
|
|
511
234
|
|
|
512
|
-
/**
|
|
513
|
-
* @description A collection of key-value pairs that provides extra information about the coupon.
|
|
514
|
-
**Note:** There's a character limit of 65,535.
|
|
515
|
-
[Learn more](advanced-features?prod_cat_ver=2#metadata).
|
|
516
|
-
|
|
517
|
-
*/
|
|
518
|
-
|
|
519
235
|
meta_data?:object;
|
|
520
236
|
|
|
521
|
-
/**
|
|
522
|
-
* @description The coupon is included in MRR calculations for your site. This attribute is only applicable for coupons of `duration_type = one_time` and when the feature is enabled in Chargebee. Note: If the site-level setting is to exclude one-time coupons from MRR calculations, this value is always returned `false`.
|
|
523
|
-
|
|
524
|
-
*/
|
|
525
|
-
|
|
526
237
|
included_in_mrr?:boolean;
|
|
527
238
|
|
|
528
|
-
/**
|
|
529
|
-
* @description The duration of time for which the coupon is attached to the subscription, in `period_units`. Applicable only when [duration_type](/docs/api/coupons?#coupon_duration_type) is [limited_period](/docs/api/coupons?#coupon_duration_type).
|
|
530
|
-
|
|
531
|
-
*/
|
|
532
|
-
|
|
533
239
|
period?:number;
|
|
534
240
|
|
|
535
|
-
/**
|
|
536
|
-
* @description The unit of time for period. Applicable only when [duration_type](/docs/api/coupons?#coupon_duration_type) is [limited_period](/docs/api/coupons?#coupon_duration_type). \* month - A period of 1 calendar month. \* week - A period of 7 days. \* year - A period of 1 calendar year. \* day - A period of 24 hours.
|
|
537
|
-
|
|
538
|
-
*/
|
|
539
|
-
|
|
540
241
|
period_unit?:PeriodUnit;
|
|
242
|
+
}
|
|
243
|
+
export interface ListResponse {
|
|
244
|
+
list:{coupon:Coupon}[];
|
|
541
245
|
|
|
246
|
+
next_offset?:string;
|
|
247
|
+
}
|
|
248
|
+
export interface ListInputParam {
|
|
249
|
+
[key : string]: any;
|
|
542
250
|
/**
|
|
543
|
-
* @description
|
|
251
|
+
* @description The number of resources to be returned.
|
|
544
252
|
|
|
545
253
|
*/
|
|
546
|
-
|
|
547
|
-
|
|
254
|
+
|
|
255
|
+
limit?:number;
|
|
548
256
|
|
|
549
257
|
/**
|
|
550
|
-
* @description
|
|
258
|
+
* @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call.
|
|
551
259
|
|
|
552
260
|
*/
|
|
553
|
-
|
|
554
|
-
|
|
261
|
+
|
|
262
|
+
offset?:string;
|
|
555
263
|
|
|
556
264
|
/**
|
|
557
|
-
* @description Parameters for
|
|
265
|
+
* @description Parameters for addon
|
|
558
266
|
|
|
559
267
|
*/
|
|
268
|
+
|
|
269
|
+
addon?:{};
|
|
560
270
|
|
|
561
|
-
coupon_constraints?:{entity_type:'customer',type:'max_redemptions' | 'unique_by',value?:string}[];
|
|
562
|
-
}
|
|
563
|
-
export interface ListResponse {
|
|
564
271
|
/**
|
|
565
|
-
* @description
|
|
272
|
+
* @description Parameters for plan
|
|
566
273
|
|
|
567
274
|
*/
|
|
568
|
-
|
|
569
|
-
|
|
275
|
+
|
|
276
|
+
plan?:{};
|
|
570
277
|
|
|
571
278
|
/**
|
|
572
|
-
* @description
|
|
279
|
+
* @description Used to uniquely identify the coupon in your website/application and to integrate with Chargebee.
|
|
280
|
+
**Note:**
|
|
573
281
|
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
}
|
|
578
|
-
export interface ListInputParam {
|
|
579
|
-
[key : string]: any;
|
|
580
|
-
/**
|
|
581
|
-
* @description List all the available coupons that are created for a specific promotion or offers. You can find list of coupon codes that are currently active, expired, archived or deleted.
|
|
282
|
+
|
|
283
|
+
When the coupon ID contains a special character; for example: `#`, the API returns an error.
|
|
284
|
+
Make sure that you [encode](https://www.urlencoder.org/) the coupon ID in the path parameter before making an API call.
|
|
582
285
|
|
|
583
286
|
*/
|
|
584
287
|
|
|
585
|
-
|
|
288
|
+
id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
|
|
586
289
|
|
|
587
290
|
/**
|
|
588
|
-
* @description
|
|
291
|
+
* @description The display name used in web interface for identifying the coupon.
|
|
292
|
+
**Note:**
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
When the name of the coupon set contains a special character; for example: `#`, the API returns an error.
|
|
296
|
+
Make sure that you [encode](https://www.urlencoder.org/) the name of the coupon set in the path parameter before making an API call.
|
|
589
297
|
|
|
590
298
|
*/
|
|
591
299
|
|
|
592
|
-
|
|
300
|
+
name?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
|
|
593
301
|
|
|
594
302
|
/**
|
|
595
|
-
* @description
|
|
303
|
+
* @description The type of deduction
|
|
596
304
|
|
|
597
305
|
*/
|
|
598
306
|
|
|
599
|
-
|
|
307
|
+
discount_type?:{in?:string,is?:'fixed_amount' | 'percentage' | 'offer_quantity',is_not?:'fixed_amount' | 'percentage' | 'offer_quantity',not_in?:string};
|
|
600
308
|
|
|
601
309
|
/**
|
|
602
|
-
* @description
|
|
310
|
+
* @description Specifies the time duration for which this coupon is attached to the subscription.
|
|
603
311
|
|
|
604
312
|
*/
|
|
605
313
|
|
|
606
|
-
|
|
314
|
+
duration_type?:{in?:string,is?:'one_time' | 'forever' | 'limited_period',is_not?:'one_time' | 'forever' | 'limited_period',not_in?:string};
|
|
607
315
|
|
|
608
316
|
/**
|
|
609
|
-
* @description
|
|
317
|
+
* @description Status of the coupon.
|
|
610
318
|
|
|
611
319
|
*/
|
|
612
320
|
|
|
613
|
-
|
|
321
|
+
status?:{in?:string,is?:'active' | 'expired' | 'archived' | 'deleted' | 'future',is_not?:'active' | 'expired' | 'archived' | 'deleted' | 'future',not_in?:string};
|
|
614
322
|
|
|
615
323
|
/**
|
|
616
|
-
* @description
|
|
324
|
+
* @description The amount on the invoice to which the coupon is applied.
|
|
617
325
|
|
|
618
326
|
*/
|
|
619
327
|
|
|
620
|
-
|
|
328
|
+
apply_on?:{in?:string,is?:'invoice_amount' | 'each_specified_item',is_not?:'invoice_amount' | 'each_specified_item',not_in?:string};
|
|
621
329
|
|
|
622
330
|
/**
|
|
623
|
-
* @description
|
|
331
|
+
* @description Timestamp indicating when this coupon is created.
|
|
624
332
|
|
|
625
333
|
*/
|
|
626
334
|
|
|
627
|
-
|
|
335
|
+
created_at?:{after?:string,before?:string,between?:string,on?:string};
|
|
628
336
|
|
|
629
337
|
/**
|
|
630
|
-
* @description
|
|
338
|
+
* @description To filter based on updated at. This attribute will be present only if the resource has been updated after 2016-11-09.
|
|
631
339
|
|
|
632
340
|
*/
|
|
633
341
|
|
|
634
|
-
|
|
342
|
+
updated_at?:{after?:string,before?:string,between?:string,on?:string};
|
|
635
343
|
|
|
636
344
|
/**
|
|
637
|
-
* @description
|
|
345
|
+
* @description Plans the coupon can be applied to.
|
|
638
346
|
|
|
639
347
|
*/
|
|
640
348
|
|
|
641
|
-
|
|
349
|
+
plan_constraint?:{in?:string,is?:'none' | 'all' | 'specific' | 'not_applicable',is_not?:'none' | 'all' | 'specific' | 'not_applicable',not_in?:string};
|
|
642
350
|
|
|
643
351
|
/**
|
|
644
|
-
* @description
|
|
352
|
+
* @description Addons the coupon can be applied to.
|
|
645
353
|
|
|
646
354
|
*/
|
|
647
355
|
|
|
648
|
-
|
|
356
|
+
addon_constraint?:{in?:string,is?:'none' | 'all' | 'specific' | 'not_applicable',is_not?:'none' | 'all' | 'specific' | 'not_applicable',not_in?:string};
|
|
357
|
+
|
|
358
|
+
sort_by?:{asc?:'created_at',desc?:'created_at'};
|
|
649
359
|
|
|
650
360
|
/**
|
|
651
|
-
* @description
|
|
361
|
+
* @description The currency code ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html)) of the coupon. Applicable for *fixed_amount* coupons alone.
|
|
652
362
|
|
|
653
363
|
*/
|
|
654
364
|
|
|
655
|
-
|
|
365
|
+
currency_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
|
|
656
366
|
|
|
657
367
|
/**
|
|
658
|
-
* @description
|
|
368
|
+
* @description Item families for which this coupon is applicable.
|
|
659
369
|
|
|
660
370
|
*/
|
|
661
371
|
|
|
662
|
-
|
|
372
|
+
item_family?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
|
|
373
|
+
|
|
374
|
+
include_discounts?:boolean;
|
|
663
375
|
}
|
|
664
376
|
export interface RetrieveResponse {
|
|
665
377
|
coupon:Coupon;
|
|
666
378
|
}
|
|
667
379
|
|
|
380
|
+
export interface UpdateResponse {
|
|
381
|
+
coupon:Coupon;
|
|
382
|
+
}
|
|
383
|
+
export interface UpdateInputParam {
|
|
384
|
+
|
|
385
|
+
name?:string;
|
|
386
|
+
|
|
387
|
+
invoice_name?:string;
|
|
388
|
+
|
|
389
|
+
discount_type?:'fixed_amount' | 'percentage' | 'offer_quantity';
|
|
390
|
+
|
|
391
|
+
discount_amount?:number;
|
|
392
|
+
|
|
393
|
+
currency_code?:string;
|
|
394
|
+
|
|
395
|
+
discount_percentage?:number;
|
|
396
|
+
|
|
397
|
+
discount_quantity?:number;
|
|
398
|
+
|
|
399
|
+
apply_on?:'invoice_amount' | 'each_specified_item';
|
|
400
|
+
|
|
401
|
+
duration_type?:'one_time' | 'forever' | 'limited_period';
|
|
402
|
+
|
|
403
|
+
duration_month?:number;
|
|
404
|
+
|
|
405
|
+
valid_till?:number;
|
|
406
|
+
|
|
407
|
+
max_redemptions?:number;
|
|
408
|
+
|
|
409
|
+
invoice_notes?:string;
|
|
410
|
+
|
|
411
|
+
meta_data?:object;
|
|
412
|
+
|
|
413
|
+
included_in_mrr?:boolean;
|
|
414
|
+
|
|
415
|
+
period?:number;
|
|
416
|
+
|
|
417
|
+
period_unit?:PeriodUnit;
|
|
418
|
+
|
|
419
|
+
plan_constraint?:'none' | 'all' | 'specific';
|
|
420
|
+
|
|
421
|
+
addon_constraint?:'none' | 'all' | 'specific';
|
|
422
|
+
|
|
423
|
+
plan_ids?:string[];
|
|
424
|
+
|
|
425
|
+
addon_ids?:string[];
|
|
426
|
+
}
|
|
668
427
|
export interface DeleteResponse {
|
|
669
428
|
coupon:Coupon;
|
|
670
429
|
}
|
|
@@ -674,34 +433,12 @@ If not specified, the coupon can be redeemed an indefinite number of times.
|
|
|
674
433
|
}
|
|
675
434
|
export interface CopyInputParam {
|
|
676
435
|
|
|
677
|
-
/**
|
|
678
|
-
* @description Your Chargebee site name having the coupon to be copied.
|
|
679
|
-
**Note:** Unless you are copying from a twin site (acme \& acme-test are twin sites), [contact support](https://chargebee.freshdesk.com/support/home) to have this allow-listed.
|
|
680
|
-
|
|
681
|
-
*/
|
|
682
|
-
|
|
683
436
|
from_site:string;
|
|
684
437
|
|
|
685
|
-
/**
|
|
686
|
-
* @description Id of the coupon to be copied. The new coupon created in this site will have the same Id.
|
|
687
|
-
|
|
688
|
-
*/
|
|
689
|
-
|
|
690
438
|
id_at_from_site:string;
|
|
691
439
|
|
|
692
|
-
/**
|
|
693
|
-
* @description Id of copied coupon in this site.
|
|
694
|
-
|
|
695
|
-
*/
|
|
696
|
-
|
|
697
440
|
id?:string;
|
|
698
441
|
|
|
699
|
-
/**
|
|
700
|
-
* @description If copy action is performed as part of Chargebee site merge action, pass the value as true.
|
|
701
|
-
**Note:** If this parameter is passed true coupon state, redemptions, coupon set and coupon codes associated with this coupon will be copied.
|
|
702
|
-
|
|
703
|
-
*/
|
|
704
|
-
|
|
705
442
|
for_site_merging?:boolean;
|
|
706
443
|
}
|
|
707
444
|
export interface UnarchiveResponse {
|
|
@@ -709,80 +446,25 @@ If not specified, the coupon can be redeemed an indefinite number of times.
|
|
|
709
446
|
}
|
|
710
447
|
|
|
711
448
|
export interface ItemConstraint {
|
|
712
|
-
|
|
713
|
-
* @description Item type for which this criteria is applicable for. \* charge - Charge \* plan - Plan \* addon - Addon
|
|
714
|
-
|
|
715
|
-
*/
|
|
716
|
-
|
|
717
|
-
item_type:'charge' | 'addon' | 'plan';
|
|
718
|
-
|
|
719
|
-
/**
|
|
720
|
-
* @description Constraint applicable for the item \* specific - Coupon applicable to specific items. \* all - Coupon applicable to all items. \* criteria - Coupon applicable based on criteria. \* none - Coupon not applicable to any items.
|
|
721
|
-
|
|
722
|
-
*/
|
|
723
|
-
|
|
724
|
-
constraint:'all' | 'criteria' | 'none' | 'specific';
|
|
449
|
+
item_type:'plan' | 'addon' | 'charge';
|
|
725
450
|
|
|
726
|
-
|
|
727
|
-
* @description List of item price ids for which this coupon is applicable.
|
|
728
|
-
|
|
729
|
-
*/
|
|
451
|
+
constraint:'none' | 'all' | 'specific' | 'criteria';
|
|
730
452
|
|
|
731
453
|
item_price_ids?:any[];
|
|
732
454
|
}
|
|
733
455
|
export interface ItemConstraintCriteria {
|
|
734
|
-
|
|
735
|
-
* @description Item type for which this criteria is applicable for. \* charge - Charge is a type of item \* plan - Plan is a type of item \* addon - Addon is a type of item
|
|
736
|
-
|
|
737
|
-
*/
|
|
738
|
-
|
|
739
|
-
item_type:'charge' | 'addon' | 'plan';
|
|
740
|
-
|
|
741
|
-
/**
|
|
742
|
-
* @description List of currencies ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html)) for which this coupon is applicable.
|
|
743
|
-
|
|
744
|
-
*/
|
|
456
|
+
item_type:'plan' | 'addon' | 'charge';
|
|
745
457
|
|
|
746
458
|
currencies?:any[];
|
|
747
459
|
|
|
748
|
-
/**
|
|
749
|
-
* @description List of families for which this coupon is applicable.
|
|
750
|
-
|
|
751
|
-
*/
|
|
752
|
-
|
|
753
460
|
item_family_ids?:any[];
|
|
754
461
|
|
|
755
|
-
/**
|
|
756
|
-
* @description List of frequencies for which this coupon is applicable. Allowed frequencies are \[day, week, month, year\].
|
|
757
|
-
|
|
758
|
-
*/
|
|
759
|
-
|
|
760
462
|
item_price_periods?:any[];
|
|
761
463
|
}
|
|
762
464
|
export interface CouponConstraint {
|
|
763
|
-
/**
|
|
764
|
-
* @description The resource type for the constraint. This, along with `type` and `value`, helps define the specific rule applied. \* customer - The constraint is based on `customer` records.
|
|
765
|
-
|
|
766
|
-
*/
|
|
767
|
-
|
|
768
465
|
entity_type:'customer';
|
|
769
466
|
|
|
770
|
-
|
|
771
|
-
* @description Type of coupon constraints \* unique_by - Indicates - when `entity_type` is `customer` - that the coupon can be redeemed only once for every unique value of a specified `customer` attribute. The `customer` attribute is specified using `value`. For example, if `value` is `email`, then the coupon can be redeemed only once for every unique value of `customer.email`. In other words, when there are multiple `customer` records with the same value for `email`, once the coupon has been redeemed for one of those customer records, no further redemptions of the coupon are allowed for any of those `customer` records. \* max_redemptions - The coupon can be redeemed up to a set number of times for a specific resource type. The maximum redemptions are specified using `value`, and the resource type is specified using `entity_type`. For example, if `entity_type` is `customer` and `value` is `10` then the coupon can only be redeemed up to 10 times for any particular `customer` record.
|
|
772
|
-
|
|
773
|
-
*/
|
|
774
|
-
|
|
775
|
-
type:'max_redemptions' | 'unique_by';
|
|
776
|
-
|
|
777
|
-
/**
|
|
778
|
-
* @description The value of the coupon constraint. The possible values depend on the value of `constraints[type]`:
|
|
779
|
-
|
|
780
|
-
* When `type` is `unique_by`, then `value` can be `email` or `id`.
|
|
781
|
-
|
|
782
|
-
* When `type` is `max_redemptions`, then `value` can be any integer in the range `1` `coupon.max_redemptions`, inclusive.
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
*/
|
|
467
|
+
type:'max_redemptions' | 'unique_by' | 'existing_customer' | 'new_customer';
|
|
786
468
|
|
|
787
469
|
value?:string;
|
|
788
470
|
}
|