chargebee 2.28.0 → 2.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.yml +81 -0
  2. package/.github/ISSUE_TEMPLATE/config.yml +6 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.yml +34 -0
  4. package/.github/PULL_REQUEST_TEMPLATE.md +8 -0
  5. package/.github/workflows/greeting.yml +47 -0
  6. package/CHANGELOG.md +47 -0
  7. package/SECURITY.md +8 -0
  8. package/lib/chargebee.js +1 -1
  9. package/lib/resources/api_endpoints.js +0 -7
  10. package/package.json +1 -1
  11. package/types/core.d.ts +4 -4
  12. package/types/resources/AttachedItem.d.ts +88 -88
  13. package/types/resources/Card.d.ts +68 -68
  14. package/types/resources/Comment.d.ts +50 -44
  15. package/types/resources/Coupon.d.ts +242 -207
  16. package/types/resources/CouponSet.d.ts +72 -68
  17. package/types/resources/CreditNote.d.ts +612 -236
  18. package/types/resources/Customer.d.ts +655 -513
  19. package/types/resources/DifferentialPrice.d.ts +99 -74
  20. package/types/resources/EntitlementOverride.d.ts +27 -12
  21. package/types/resources/Estimate.d.ts +450 -450
  22. package/types/resources/Event.d.ts +30 -12
  23. package/types/resources/Export.d.ts +200 -200
  24. package/types/resources/Feature.d.ts +66 -35
  25. package/types/resources/Gift.d.ts +54 -44
  26. package/types/resources/HostedPage.d.ts +381 -381
  27. package/types/resources/InAppSubscription.d.ts +94 -90
  28. package/types/resources/Invoice.d.ts +1242 -660
  29. package/types/resources/Item.d.ts +148 -142
  30. package/types/resources/ItemEntitlement.d.ts +36 -36
  31. package/types/resources/ItemFamily.d.ts +45 -45
  32. package/types/resources/ItemPrice.d.ts +317 -273
  33. package/types/resources/PaymentIntent.d.ts +60 -60
  34. package/types/resources/PaymentVoucher.d.ts +74 -59
  35. package/types/resources/PortalSession.d.ts +45 -20
  36. package/types/resources/PromotionalCredit.d.ts +68 -68
  37. package/types/resources/Purchase.d.ts +3 -3
  38. package/types/resources/Quote.d.ts +652 -363
  39. package/types/resources/QuoteLineGroup.d.ts +245 -0
  40. package/types/resources/QuotedCharge.d.ts +170 -0
  41. package/types/resources/QuotedSubscription.d.ts +219 -0
  42. package/types/resources/SiteMigrationDetail.d.ts +7 -7
  43. package/types/resources/Subscription.d.ts +1219 -932
  44. package/types/resources/SubscriptionEntitlement.d.ts +33 -12
  45. package/types/resources/ThirdPartyPaymentMethod.d.ts +1 -1
  46. package/types/resources/TimeMachine.d.ts +15 -15
  47. package/types/resources/Token.d.ts +23 -23
  48. package/types/resources/Transaction.d.ts +229 -112
  49. package/types/resources/UnbilledCharge.d.ts +112 -67
  50. package/types/resources/Usage.d.ts +46 -47
  51. package/types/resources/VirtualBankAccount.d.ts +66 -66
@@ -1,7 +1,7 @@
1
1
  ///<reference path='./../core.d.ts'/>
2
2
  declare module 'chargebee' {
3
3
  export interface Coupon {
4
-
4
+ [key : string] : any;
5
5
  /**
6
6
  * @description Used to uniquely identify the coupon in your website/application and to integrate with Chargebee.
7
7
  **Note:**
@@ -181,11 +181,11 @@ Note that this does not change when the [redemptions](/docs/api/coupons?#coupon_
181
181
  export namespace Coupon {
182
182
  export class CouponResource {
183
183
  /**
184
- * @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.
184
+ * @description This API creates a new coupon for a specific promotion or offers.
185
185
 
186
186
  */
187
187
 
188
- list(input?:ListInputParam):ChargebeeRequest<ListResponse>;
188
+ create_for_items(input:CreateForItemsInputParam):ChargebeeRequest<CreateForItemsResponse>;
189
189
 
190
190
  /**
191
191
  * @description This API updates a coupon that is created for a specific promotion or offers.
@@ -195,11 +195,18 @@ Note that this does not change when the [redemptions](/docs/api/coupons?#coupon_
195
195
  update_for_items(coupon_id:string, input?:UpdateForItemsInputParam):ChargebeeRequest<UpdateForItemsResponse>;
196
196
 
197
197
  /**
198
- * @description This API unarchives a specific coupon using the coupon ID.
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
199
 
200
200
  */
201
201
 
202
- unarchive(coupon_id:string):ChargebeeRequest<UnarchiveResponse>;
202
+ list(input?:ListInputParam):ChargebeeRequest<ListResponse>;
203
+
204
+ /**
205
+ * @description This API retrieves a specific coupon using the coupon ID.
206
+
207
+ */
208
+
209
+ retrieve(coupon_id:string):ChargebeeRequest<RetrieveResponse>;
203
210
 
204
211
  /**
205
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.
@@ -223,149 +230,189 @@ The value for [redemptions](./coupons?prod_cat_ver&#x3D;2#coupon_redemptions) is
223
230
  copy(input:CopyInputParam):ChargebeeRequest<CopyResponse>;
224
231
 
225
232
  /**
226
- * @description This API retrieves a specific coupon using the coupon ID.
233
+ * @description This API unarchives a specific coupon using the coupon ID.
227
234
 
228
235
  */
229
236
 
230
- retrieve(coupon_id:string):ChargebeeRequest<RetrieveResponse>;
231
-
237
+ unarchive(coupon_id:string):ChargebeeRequest<UnarchiveResponse>;
238
+ }
239
+ export interface CreateForItemsResponse {
240
+ coupon:Coupon;
241
+ }
242
+ export interface CreateForItemsInputParam {
243
+ [key : string] : any;
232
244
  /**
233
- * @description This API creates a new coupon for a specific promotion or offers.
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
+ .
234
252
 
235
253
  */
236
-
237
- create_for_items(input:CreateForItemsInputParam):ChargebeeRequest<CreateForItemsResponse>;
238
- }
239
- export interface ListResponse {
254
+
255
+ id:string;
256
+
240
257
  /**
241
- * @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.
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
+ .
242
265
 
243
266
  */
244
267
 
245
- list:{coupon:Coupon}[];
268
+ name:string;
246
269
 
247
270
  /**
248
- * @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.
271
+ * @description Display name used in invoice. If it is not configured then name is used in invoice.
249
272
 
250
273
  */
251
274
 
252
- next_offset?:string;
253
- }
254
- export interface ListInputParam {
255
- [key : string]: any;
275
+ invoice_name?:string;
276
+
256
277
  /**
257
- * @description The number of resources to be returned.
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.
258
279
 
259
280
  */
260
-
261
- limit?:number;
281
+
282
+ discount_type?:'fixed_amount' | 'percentage';
262
283
 
263
284
  /**
264
- * @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.
285
+ * @description The value of the deduction. The format of this value depends on the [kind of currency](/docs/api#currencies).
265
286
 
266
287
  */
267
-
268
- offset?:string;
288
+
289
+ discount_amount?:number;
269
290
 
270
291
  /**
271
- * @description Used to uniquely identify the coupon in your website/application and to integrate with Chargebee.
272
- **Note:**
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.
273
293
 
294
+ */
295
+
296
+ currency_code?:string;
297
+
298
+ /**
299
+ * @description The percentage of the original amount that should be deducted from it.
274
300
 
275
- When the coupon ID contains a special character; for example: &#x60;#&#x60;, the API returns an error.
276
- Make sure that you [encode](https://www.urlencoder.org/) the coupon ID in the path parameter before making an API call.
301
+ */
302
+
303
+ discount_percentage?:number;
304
+
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.
277
307
 
278
308
  */
279
-
280
- id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
309
+
310
+ apply_on:'invoice_amount' | 'each_specified_item';
281
311
 
282
312
  /**
283
- * @description The display name used in web interface for identifying the coupon.
284
- **Note:**
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;.
285
314
 
315
+ */
316
+
317
+ duration_type?:'limited_period' | 'one_time' | 'forever';
318
+
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.
286
322
 
287
- When the name of the coupon set contains a special character; for example: &#x60;#&#x60;, the API returns an error.
288
- Make sure that you [encode](https://www.urlencoder.org/) the name of the coupon set in the path parameter before making an API call.
323
+ */
324
+
325
+ duration_month?:number;
326
+
327
+ /**
328
+ * @description Date upto which the coupon can be applied to new subscriptions.
289
329
 
290
330
  */
291
-
292
- name?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
331
+
332
+ valid_till?:number;
293
333
 
294
334
  /**
295
- * @description The type of deduction
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
+ .
296
341
 
297
342
  */
298
-
299
- discount_type?:{in?:string,is?:'fixed_amount' | 'percentage',is_not?:'fixed_amount' | 'percentage',not_in?:string};
343
+
344
+ max_redemptions?:number;
300
345
 
301
346
  /**
302
- * @description Specifies the time duration for which this coupon is attached to the subscription.
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.
303
348
 
304
349
  */
305
-
306
- duration_type?:{in?:string,is?:'limited_period' | 'one_time' | 'forever',is_not?:'limited_period' | 'one_time' | 'forever',not_in?:string};
350
+
351
+ invoice_notes?:string;
307
352
 
308
353
  /**
309
- * @description Status of the coupon.
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).
310
357
 
311
358
  */
312
-
313
- status?:{in?:string,is?:'archived' | 'expired' | 'deleted' | 'active',is_not?:'archived' | 'expired' | 'deleted' | 'active',not_in?:string};
359
+
360
+ meta_data?:object;
314
361
 
315
362
  /**
316
- * @description The amount on the invoice to which the coupon is applied.
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;.
317
364
 
318
365
  */
319
-
320
- apply_on?:{in?:string,is?:'invoice_amount' | 'each_specified_item',is_not?:'invoice_amount' | 'each_specified_item',not_in?:string};
366
+
367
+ included_in_mrr?:boolean;
321
368
 
322
369
  /**
323
- * @description Timestamp indicating when this coupon is created.
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).
324
371
 
325
372
  */
326
-
327
- created_at?:{after?:string,before?:string,between?:string,on?:string};
373
+
374
+ period?:number;
328
375
 
329
376
  /**
330
- * @description To filter based on updated at. This attribute will be present only if the resource has been updated after 2016-11-09.
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.
331
378
 
332
379
  */
333
-
334
- updated_at?:{after?:string,before?:string,between?:string,on?:string};
380
+
381
+ period_unit?:PeriodUnit;
335
382
 
336
383
  /**
337
- * @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.
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.
338
385
 
339
386
  */
340
-
341
- sort_by?:{asc?:'created_at',desc?:'created_at'};
387
+
388
+ status?:'archived' | 'active';
342
389
 
343
390
  /**
344
- * @description The currency code ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html)) of the coupon. Applicable for *fixed_amount* coupons alone.
391
+ * @description Parameters for item_constraints
345
392
 
346
393
  */
347
-
348
- currency_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
394
+
395
+ item_constraints?:{constraint:'all' | 'criteria' | 'none' | 'specific',item_price_ids?:any[],item_type:'charge' | 'addon' | 'plan'}[];
349
396
 
350
397
  /**
351
- * @description Parameters for addon
398
+ * @description Parameters for item_constraint_criteria
352
399
 
353
400
  */
354
-
355
- addon?:{};
401
+
402
+ item_constraint_criteria?:{currencies?:any[],item_family_ids?:any[],item_price_periods?:any[],item_type?:'charge' | 'addon' | 'plan'}[];
356
403
 
357
404
  /**
358
- * @description Parameters for plan
405
+ * @description Parameters for &#x60;coupon_constraints&#x60;. Multiple &#x60;coupon_constraints&#x60; can be passed by specifying unique indices.
359
406
 
360
407
  */
361
-
362
- plan?:{};
408
+
409
+ coupon_constraints?:{entity_type:'customer',type:'max_redemptions' | 'unique_by',value?:string}[];
363
410
  }
364
411
  export interface UpdateForItemsResponse {
365
412
  coupon:Coupon;
366
413
  }
367
414
  export interface UpdateForItemsInputParam {
368
-
415
+ [key : string] : any;
369
416
  /**
370
417
  * @description The display name used in web interface for identifying the coupon.
371
418
  **Note:**
@@ -463,7 +510,9 @@ If not specified, the coupon can be redeemed an indefinite number of times.
463
510
  invoice_notes?:string;
464
511
 
465
512
  /**
466
- * @description A set of key-value pairs stored as additional information for the coupon. [Learn more](./#meta_data).
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).
467
516
 
468
517
  */
469
518
 
@@ -511,243 +560,229 @@ If not specified, the coupon can be redeemed an indefinite number of times.
511
560
 
512
561
  coupon_constraints?:{entity_type:'customer',type:'max_redemptions' | 'unique_by',value?:string}[];
513
562
  }
514
- export interface UnarchiveResponse {
515
- coupon:Coupon;
516
- }
517
-
518
- export interface DeleteResponse {
519
- coupon:Coupon;
520
- }
521
-
522
- export interface CopyResponse {
523
- coupon:Coupon;
524
- }
525
- export interface CopyInputParam {
526
-
563
+ export interface ListResponse {
527
564
  /**
528
- * @description Your Chargebee site name having the coupon to be copied.
529
- **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.
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.
530
566
 
531
567
  */
532
568
 
533
- from_site:string;
569
+ list:{coupon:Coupon}[];
534
570
 
535
571
  /**
536
- * @description Id of the coupon to be copied. The new coupon created in this site will have the same Id.
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.
537
573
 
538
574
  */
539
575
 
540
- id_at_from_site:string;
541
-
576
+ next_offset?:string;
577
+ }
578
+ export interface ListInputParam {
579
+ [key : string]: any;
542
580
  /**
543
- * @description Id of copied coupon in this site.
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.
544
582
 
545
583
  */
546
-
547
- id?:string;
584
+
585
+ limit?:number;
548
586
 
549
587
  /**
550
- * @description If copy action is performed as part of Chargebee site merge action, pass the value as true.
551
- **Note:** If this parameter is passed true coupon state, redemptions, coupon set and coupon codes associated with this coupon will be copied.
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.
552
589
 
553
590
  */
554
-
555
- for_site_merging?:boolean;
556
- }
557
- export interface RetrieveResponse {
558
- coupon:Coupon;
559
- }
560
-
561
- export interface CreateForItemsResponse {
562
- coupon:Coupon;
563
- }
564
- export interface CreateForItemsInputParam {
591
+
592
+ offset?:string;
565
593
 
566
594
  /**
567
- * @description Used to uniquely identify the coupon in your website/application and to integrate with Chargebee.
568
- **Note:**
569
-
570
-
571
- When the coupon ID contains a special character; for example: &#x60;#&#x60;, the API returns an error.
572
- Make sure that you [encode](https://www.urlencoder.org/) the coupon ID in the path parameter before making an API call.
573
- .
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.
574
596
 
575
597
  */
576
-
577
- id:string;
598
+
599
+ id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
578
600
 
579
601
  /**
580
- * @description The display name used in web interface for identifying the coupon.
581
- **Note:**
582
-
583
-
584
- When the name of the coupon set contains a special character; for example: &#x60;#&#x60;, the API returns an error.
585
- Make sure that you [encode](https://www.urlencoder.org/) the name of the coupon set in the path parameter before making an API call.
586
- .
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.
587
603
 
588
604
  */
589
-
590
- name:string;
605
+
606
+ name?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
591
607
 
592
608
  /**
593
- * @description Display name used in invoice. If it is not configured then name is used in invoice.
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.
594
610
 
595
611
  */
596
-
597
- invoice_name?:string;
612
+
613
+ discount_type?:{in?:string,is?:'fixed_amount' | 'percentage',is_not?:'fixed_amount' | 'percentage',not_in?:string};
598
614
 
599
615
  /**
600
- * @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.
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.
601
617
 
602
618
  */
603
-
604
- discount_type:'fixed_amount' | 'percentage';
619
+
620
+ duration_type?:{in?:string,is?:'limited_period' | 'one_time' | 'forever',is_not?:'limited_period' | 'one_time' | 'forever',not_in?:string};
605
621
 
606
622
  /**
607
- * @description The value of the deduction. The format of this value depends on the [kind of currency](/docs/api#currencies).
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.
608
624
 
609
625
  */
610
-
611
- discount_amount?:number;
626
+
627
+ status?:{in?:string,is?:'archived' | 'expired' | 'deleted' | 'active',is_not?:'archived' | 'expired' | 'deleted' | 'active',not_in?:string};
612
628
 
613
629
  /**
614
- * @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.
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.
615
631
 
616
632
  */
617
-
618
- currency_code?:string;
633
+
634
+ apply_on?:{in?:string,is?:'invoice_amount' | 'each_specified_item',is_not?:'invoice_amount' | 'each_specified_item',not_in?:string};
619
635
 
620
636
  /**
621
- * @description The percentage of the original amount that should be deducted from it.
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.
622
638
 
623
639
  */
624
-
625
- discount_percentage?:number;
640
+
641
+ created_at?:{after?:string,before?:string,between?:string,on?:string};
626
642
 
627
643
  /**
628
- * @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.
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.
629
645
 
630
646
  */
631
-
632
- apply_on:'invoice_amount' | 'each_specified_item';
647
+
648
+ updated_at?:{after?:string,before?:string,between?:string,on?:string};
633
649
 
634
650
  /**
635
- * @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;.
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.
636
652
 
637
653
  */
638
-
639
- duration_type:'limited_period' | 'one_time' | 'forever';
654
+
655
+ sort_by?:{asc?:'created_at',desc?:'created_at'};
640
656
 
641
657
  /**
642
- * @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;.
643
- **Note:** This parameter has been deprecated. Use &#x60;period&#x60; and &#x60;period_unit&#x60; instead.
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.
644
659
 
645
660
  */
646
-
647
- duration_month?:number;
661
+
662
+ currency_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string};
663
+ }
664
+ export interface RetrieveResponse {
665
+ coupon:Coupon;
666
+ }
667
+
668
+ export interface DeleteResponse {
669
+ coupon:Coupon;
670
+ }
671
+
672
+ export interface CopyResponse {
673
+ coupon:Coupon;
674
+ }
675
+ export interface CopyInputParam {
648
676
 
649
677
  /**
650
- * @description Date upto which the coupon can be applied to new subscriptions.
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.
651
680
 
652
681
  */
653
682
 
654
- valid_till?:number;
683
+ from_site:string;
655
684
 
656
685
  /**
657
- * @description Maximum number of times this coupon can be redeemed.
658
- **Note:**
659
-
660
-
661
- If not specified, the coupon can be redeemed an indefinite number of times.
662
- .
686
+ * @description Id of the coupon to be copied. The new coupon created in this site will have the same Id.
663
687
 
664
688
  */
665
689
 
666
- max_redemptions?:number;
690
+ id_at_from_site:string;
667
691
 
668
692
  /**
669
- * @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.
693
+ * @description Id of copied coupon in this site.
670
694
 
671
695
  */
672
696
 
673
- invoice_notes?:string;
697
+ id?:string;
674
698
 
675
699
  /**
676
- * @description A set of key-value pairs stored as additional information for the coupon. [Learn more](./#meta_data).
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.
677
702
 
678
703
  */
679
704
 
680
- meta_data?:object;
681
-
682
- /**
683
- * @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;.
705
+ for_site_merging?:boolean;
706
+ }
707
+ export interface UnarchiveResponse {
708
+ coupon:Coupon;
709
+ }
710
+
711
+ export interface ItemConstraint {
712
+ /**
713
+ * @description Item type for which this criteria is applicable for. \* charge - Charge \* plan - Plan \* addon - Addon
684
714
 
685
- */
715
+ */
686
716
 
687
- included_in_mrr?:boolean;
717
+ item_type:'charge' | 'addon' | 'plan';
688
718
 
689
- /**
690
- * @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).
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.
691
721
 
692
- */
722
+ */
693
723
 
694
- period?:number;
724
+ constraint:'all' | 'criteria' | 'none' | 'specific';
695
725
 
696
- /**
697
- * @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.
726
+ /**
727
+ * @description List of item price ids for which this coupon is applicable.
698
728
 
699
- */
700
-
701
- period_unit?:PeriodUnit;
729
+ */
702
730
 
703
- /**
704
- * @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.
731
+ item_price_ids?:any[];
732
+ }
733
+ 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
705
736
 
706
- */
737
+ */
707
738
 
708
- status?:'archived' | 'active';
739
+ item_type:'charge' | 'addon' | 'plan';
709
740
 
710
- /**
711
- * @description Parameters for item_constraints
741
+ /**
742
+ * @description List of currencies ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html)) for which this coupon is applicable.
712
743
 
713
- */
744
+ */
714
745
 
715
- item_constraints?:{constraint:'all' | 'criteria' | 'none' | 'specific',item_price_ids?:any[],item_type:'charge' | 'addon' | 'plan'}[];
746
+ currencies?:any[];
716
747
 
717
- /**
718
- * @description Parameters for item_constraint_criteria
748
+ /**
749
+ * @description List of families for which this coupon is applicable.
719
750
 
720
- */
751
+ */
721
752
 
722
- item_constraint_criteria?:{currencies?:any[],item_family_ids?:any[],item_price_periods?:any[],item_type?:'charge' | 'addon' | 'plan'}[];
753
+ item_family_ids?:any[];
723
754
 
724
- /**
725
- * @description Parameters for &#x60;coupon_constraints&#x60;. Multiple &#x60;coupon_constraints&#x60; can be passed by specifying unique indices.
755
+ /**
756
+ * @description List of frequencies for which this coupon is applicable. Allowed frequencies are \[day, week, month, year\].
726
757
 
727
- */
728
-
729
- coupon_constraints?:{entity_type:'customer',type:'max_redemptions' | 'unique_by',value?:string}[];
730
- }
731
- export interface ItemConstraint {
732
- item_type?:'charge' | 'addon' | 'plan';
733
-
734
- constraint?:'all' | 'criteria' | 'none' | 'specific';
758
+ */
735
759
 
736
- item_price_ids?:any[];
760
+ item_price_periods?:any[];
737
761
  }
738
- export interface ItemConstraintCriteria {
739
- item_type?:'charge' | 'addon' | 'plan';
762
+ 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
+ */
740
767
 
741
- currencies?:any[];
768
+ entity_type:'customer';
742
769
 
743
- item_family_ids?:any[];
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
+ */
744
774
 
745
- item_price_periods?:any[];
746
- }
747
- export interface CouponConstraint {
748
- entity_type?:'customer';
775
+ type:'max_redemptions' | 'unique_by';
749
776
 
750
- type?:'max_redemptions' | 'unique_by';
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
+ */
751
786
 
752
787
  value?:string;
753
788
  }