chargebee 2.43.0 → 2.45.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.
@@ -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: &#x60;#&#x60;, 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: &#x60;#&#x60;, 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 &#x60;period&#x60; and &#x60;period_unit&#x60;.
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
- If not specified, the coupon can be redeemed an indefinite number of times.
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
- status?:'archived' | 'expired' | 'deleted' | 'active';
95
-
96
- /**
97
- * @description The amount on the invoice to which the coupon is applied. \* invoice_amount - The coupon is applied to the invoice &#x60;sub_total&#x60;. \* each_specified_item - The coupon is applied to the &#x60;invoice.line_item.amount&#x60; that corresponds to the item price specified by &#x60;item_price_id&#x60;.
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, &#x60;resource_version&#x60; 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 &#x60;period_units&#x60;. 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
- * @description This API creates a new coupon for a specific promotion or offers.
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
- * @description If no Subscriptions/Invoices are linked to this Coupon, the Coupon will be deleted from your Chargebee site. This action cannot be undone.
213
-
214
- To ensure that existing Subscriptions/Invoices are not affected, Coupons associated with them will not be deleted, but moved to &quot;Archived&quot; 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&#x3D;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&#x3D;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&#x3D;2#coupon_redemptions) is not copied. It is set to &#x60;0&#x60; for the newly created coupon. Hence, if such a coupon had &#x60;expired&#x60; in the source site due to &#x60;redemptions&#x60; having reached [max_redemptions](./coupons?prod_cat_ver&#x3D;2#coupon_max_redemptions), it&#x27;s [status](./coupons?prod_cat_ver&#x3D;2#coupon_status) would be &#x60;active&#x60; 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 CreateForItemsResponse {
94
+ export interface CreateResponse {
240
95
  coupon:Coupon;
241
96
  }
242
- export interface CreateForItemsInputParam {
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: &#x60;#&#x60;, 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: &#x60;#&#x60;, 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 &#x60;sub_total&#x60;. \* 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 &#x60;invoice.line_item.amount&#x60; that corresponds to the item price specified by &#x60;item_price_id&#x60;. \* 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 &#x60;period&#x60; and &#x60;period_unit&#x60;.
314
-
315
- */
117
+ duration_type?:'one_time' | 'forever' | 'limited_period';
316
118
 
317
- duration_type?:'limited_period' | 'one_time' | 'forever';
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 &#x60;duration_type&#x60; is &#x60;limited_period&#x60;.
321
- **Note:** This parameter has been deprecated. Use &#x60;period&#x60; and &#x60;period_unit&#x60; instead.
322
-
323
- */
121
+ valid_till?:number;
324
122
 
325
- duration_month?:number;
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
- valid_till?:number;
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
- max_redemptions?:number;
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
- invoice_notes?:string;
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&#x27;s a character limit of 65,535.
356
- [Learn more](advanced-features?prod_cat_ver&#x3D;2#metadata).
357
-
358
- */
137
+ addon_constraint?:'none' | 'all' | 'specific';
359
138
 
360
- meta_data?:object;
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 &#x60;duration_type &#x3D; one_time&#x60; 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 &#x60;false&#x60;.
364
-
365
- */
141
+ addon_ids?:string[];
366
142
 
367
- included_in_mrr?:boolean;
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 &#x60;period_units&#x60;. 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
- period?:number;
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
- period_unit?:PeriodUnit;
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
- status?:'archived' | 'active';
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
- item_constraints?:{constraint:'all' | 'criteria' | 'none' | 'specific',item_price_ids?:any[],item_type:'charge' | 'addon' | 'plan'}[];
166
+ currency_code?:string;
396
167
 
397
- /**
398
- * @description Parameters for item_constraint_criteria
399
-
400
- */
168
+ discount_percentage?:number;
401
169
 
402
- item_constraint_criteria?:{currencies?:any[],item_family_ids?:any[],item_price_periods?:any[],item_type?:'charge' | 'addon' | 'plan'}[];
170
+ discount_quantity?:number;
403
171
 
404
- /**
405
- * @description Parameters for &#x60;coupon_constraints&#x60;. Multiple &#x60;coupon_constraints&#x60; can be passed by specifying unique indices.
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
- coupon_constraints?:{entity_type:'customer',type:'max_redemptions' | 'unique_by',value?:string}[];
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: &#x60;#&#x60;, 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
- name?:string;
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
- invoice_name?:string;
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
- discount_type?:'fixed_amount' | 'percentage';
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 &#x60;sub_total&#x60;. \* 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 &#x60;invoice.line_item.amount&#x60; that corresponds to the item price specified by &#x60;item_price_id&#x60;. \* 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 &#x60;period&#x60; and &#x60;period_unit&#x60;.
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 &#x60;duration_type&#x60; is &#x60;limited_period&#x60;.
480
- **Note:** This parameter has been deprecated. Use &#x60;period&#x60; and &#x60;period_unit&#x60; 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&#x27;s a character limit of 65,535.
515
- [Learn more](advanced-features?prod_cat_ver&#x3D;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 &#x60;duration_type &#x3D; one_time&#x60; 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 &#x60;false&#x60;.
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 &#x60;period_units&#x60;. 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 Parameters for item_constraints
251
+ * @description The number of resources to be returned.
544
252
 
545
253
  */
546
-
547
- item_constraints?:{constraint:'all' | 'criteria' | 'none' | 'specific',item_price_ids?:any[],item_type:'charge' | 'addon' | 'plan'}[];
254
+
255
+ limit?:number;
548
256
 
549
257
  /**
550
- * @description Parameters for item_constraint_criteria
258
+ * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \&#x60;offset\&#x60; to the value of \&#x60;next_offset\&#x60; obtained in the previous iteration of the API call.
551
259
 
552
260
  */
553
-
554
- item_constraint_criteria?:{currencies?:any[],item_family_ids?:any[],item_price_periods?:any[],item_type?:'charge' | 'addon' | 'plan'}[];
261
+
262
+ offset?:string;
555
263
 
556
264
  /**
557
- * @description Parameters for &#x60;coupon_constraints&#x60;. Multiple &#x60;coupon_constraints&#x60; can be passed by specifying unique indices.
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 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.
272
+ * @description Parameters for plan
566
273
 
567
274
  */
568
-
569
- list:{coupon:Coupon}[];
275
+
276
+ plan?:{};
570
277
 
571
278
  /**
572
- * @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.
279
+ * @description Used to uniquely identify the coupon in your website/application and to integrate with Chargebee.
280
+ **Note:**
573
281
 
574
- */
575
-
576
- next_offset?:string;
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: &#x60;#&#x60;, 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
- limit?:number;
288
+ id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
586
289
 
587
290
  /**
588
- * @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.
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: &#x60;#&#x60;, 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
- offset?:string;
300
+ name?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
593
301
 
594
302
  /**
595
- * @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.
303
+ * @description The type of deduction
596
304
 
597
305
  */
598
306
 
599
- id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
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 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.
310
+ * @description Specifies the time duration for which this coupon is attached to the subscription.
603
311
 
604
312
  */
605
313
 
606
- name?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
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 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.
317
+ * @description Status of the coupon.
610
318
 
611
319
  */
612
320
 
613
- discount_type?:{in?:string,is?:'fixed_amount' | 'percentage',is_not?:'fixed_amount' | 'percentage',not_in?:string};
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 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.
324
+ * @description The amount on the invoice to which the coupon is applied.
617
325
 
618
326
  */
619
327
 
620
- duration_type?:{in?:string,is?:'limited_period' | 'one_time' | 'forever',is_not?:'limited_period' | 'one_time' | 'forever',not_in?:string};
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 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.
331
+ * @description Timestamp indicating when this coupon is created.
624
332
 
625
333
  */
626
334
 
627
- status?:{in?:string,is?:'archived' | 'expired' | 'deleted' | 'active',is_not?:'archived' | 'expired' | 'deleted' | 'active',not_in?:string};
335
+ created_at?:{after?:string,before?:string,between?:string,on?:string};
628
336
 
629
337
  /**
630
- * @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.
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
- apply_on?:{in?:string,is?:'invoice_amount' | 'each_specified_item',is_not?:'invoice_amount' | 'each_specified_item',not_in?:string};
342
+ updated_at?:{after?:string,before?:string,between?:string,on?:string};
635
343
 
636
344
  /**
637
- * @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.
345
+ * @description Plans the coupon can be applied to.
638
346
 
639
347
  */
640
348
 
641
- created_at?:{after?:string,before?:string,between?:string,on?:string};
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 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.
352
+ * @description Addons the coupon can be applied to.
645
353
 
646
354
  */
647
355
 
648
- updated_at?:{after?:string,before?:string,between?:string,on?:string};
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 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.
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
- sort_by?:{asc?:'created_at',desc?:'created_at'};
365
+ currency_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
656
366
 
657
367
  /**
658
- * @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.
368
+ * @description Item families for which this coupon is applicable.
659
369
 
660
370
  */
661
371
 
662
- currency_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
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 \&amp; 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 &#x60;type&#x60; and &#x60;value&#x60;, helps define the specific rule applied. \* customer - The constraint is based on &#x60;customer&#x60; records.
765
-
766
- */
767
-
768
465
  entity_type:'customer';
769
466
 
770
- /**
771
- * @description Type of coupon constraints \* unique_by - Indicates - when &#x60;entity_type&#x60; is &#x60;customer&#x60; - that the coupon can be redeemed only once for every unique value of a specified &#x60;customer&#x60; attribute. The &#x60;customer&#x60; attribute is specified using &#x60;value&#x60;. For example, if &#x60;value&#x60; is &#x60;email&#x60;, then the coupon can be redeemed only once for every unique value of &#x60;customer.email&#x60;. In other words, when there are multiple &#x60;customer&#x60; records with the same value for &#x60;email&#x60;, once the coupon has been redeemed for one of those customer records, no further redemptions of the coupon are allowed for any of those &#x60;customer&#x60; 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 &#x60;value&#x60;, and the resource type is specified using &#x60;entity_type&#x60;. For example, if &#x60;entity_type&#x60; is &#x60;customer&#x60; and &#x60;value&#x60; is &#x60;10&#x60; then the coupon can only be redeemed up to 10 times for any particular &#x60;customer&#x60; 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 &#x60;constraints[type]&#x60;:
779
-
780
- * When &#x60;type&#x60; is &#x60;unique_by&#x60;, then &#x60;value&#x60; can be &#x60;email&#x60; or &#x60;id&#x60;.
781
-
782
- * When &#x60;type&#x60; is &#x60;max_redemptions&#x60;, then &#x60;value&#x60; can be any integer in the range &#x60;1&#x60; &#x60;coupon.max_redemptions&#x60;, inclusive.
783
-
784
-
785
- */
467
+ type:'max_redemptions' | 'unique_by' | 'existing_customer' | 'new_customer';
786
468
 
787
469
  value?:string;
788
470
  }