chargebee 2.47.0 → 2.48.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 CHANGED
@@ -1,3 +1,13 @@
1
+ ### v2.48.0 (2025-03-06)
2
+ * * *
3
+
4
+ ### New Input Params:
5
+ * created_at has been added to Invoice#LineItemsImportInputParams.
6
+ * PaymentIntent has been added to Purchase#CreateInputParams.
7
+
8
+ ### New Enums:
9
+ * SUBSCRIPTION_ENTITLEMENTS_UPDATED has been added to EventType#Enum.
10
+
1
11
  ### v2.47.0 (2025-02-10)
2
12
  * * *
3
13
 
package/lib/chargebee.js CHANGED
@@ -11,7 +11,7 @@ ChargeBee._env = {
11
11
  hostSuffix: '.chargebee.com',
12
12
  apiPath: '/api/v2',
13
13
  timeout: 80000,
14
- clientVersion: 'v2.47.0',
14
+ clientVersion: 'v2.48.0',
15
15
  port: 443,
16
16
  timemachineWaitInMillis: 3000,
17
17
  exportWaitInMillis: 3000
@@ -4372,6 +4372,7 @@ var _endpoints = {
4372
4372
  null,
4373
4373
  false,
4374
4374
  {
4375
+ "additional_information": 1,
4375
4376
  "meta_data": 1,
4376
4377
  }
4377
4378
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name":"chargebee",
3
- "version":"2.47.0",
3
+ "version":"2.48.0",
4
4
  "description":"A library for integrating with ChargeBee.",
5
5
  "keywords":[
6
6
  "payments",
package/types/core.d.ts CHANGED
@@ -44,11 +44,11 @@ declare module 'chargebee' {
44
44
  type EntityCode = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'p' | 'q' | 'r' | 'med1' | 'med2'
45
45
  type EntityType = 'customer' | 'subscription' | 'coupon' | 'plan_item_price' | 'addon_item_price' | 'charge_item_price' | 'invoice' | 'quote' | 'credit_note' | 'transaction' | 'plan' | 'addon' | 'order' | 'item_family' | 'item' | 'item_price' | 'plan_item' | 'addon_item' | 'charge_item' | 'plan_price' | 'addon_price' | 'charge_price' | 'differential_price' | 'attached_item' | 'feature' | 'subscription_entitlement' | 'item_entitlement' | 'business_entity' | 'price_variant' | 'omnichannel_subscription' | 'omnichannel_subscription_item' | 'omnichannel_transaction' | 'recorded_purchase'
46
46
  type EventName = 'cancellation_page_loaded'
47
- type EventType = 'coupon_created' | 'coupon_updated' | 'coupon_deleted' | 'coupon_set_created' | 'coupon_set_updated' | 'coupon_set_deleted' | 'coupon_codes_added' | 'coupon_codes_deleted' | 'coupon_codes_updated' | 'customer_created' | 'customer_changed' | 'customer_deleted' | 'customer_moved_out' | 'customer_moved_in' | 'promotional_credits_added' | 'promotional_credits_deducted' | 'subscription_created' | 'subscription_created_with_backdating' | 'subscription_started' | 'subscription_trial_end_reminder' | 'subscription_activated' | 'subscription_activated_with_backdating' | 'subscription_changed' | 'subscription_trial_extended' | 'mrr_updated' | 'subscription_changed_with_backdating' | 'subscription_cancellation_scheduled' | 'subscription_cancellation_reminder' | 'subscription_cancelled' | 'subscription_canceled_with_backdating' | 'subscription_reactivated' | 'subscription_reactivated_with_backdating' | 'subscription_renewed' | 'subscription_items_renewed' | 'subscription_scheduled_cancellation_removed' | 'subscription_changes_scheduled' | 'subscription_scheduled_changes_removed' | 'subscription_shipping_address_updated' | 'subscription_deleted' | 'subscription_paused' | 'subscription_pause_scheduled' | 'subscription_scheduled_pause_removed' | 'subscription_resumed' | 'subscription_resumption_scheduled' | 'subscription_scheduled_resumption_removed' | 'subscription_advance_invoice_schedule_added' | 'subscription_advance_invoice_schedule_updated' | 'subscription_advance_invoice_schedule_removed' | 'pending_invoice_created' | 'pending_invoice_updated' | 'invoice_generated' | 'invoice_generated_with_backdating' | 'invoice_updated' | 'invoice_deleted' | 'credit_note_created' | 'credit_note_created_with_backdating' | 'credit_note_updated' | 'credit_note_deleted' | 'payment_schedules_created' | 'payment_schedules_updated' | 'payment_schedule_scheme_created' | 'payment_schedule_scheme_deleted' | 'subscription_renewal_reminder' | 'add_usages_reminder' | 'transaction_created' | 'transaction_updated' | 'transaction_deleted' | 'payment_succeeded' | 'payment_failed' | 'payment_refunded' | 'payment_initiated' | 'refund_initiated' | 'authorization_succeeded' | 'authorization_voided' | 'card_added' | 'card_updated' | 'card_expiry_reminder' | 'card_expired' | 'card_deleted' | 'payment_source_added' | 'payment_source_updated' | 'payment_source_deleted' | 'payment_source_expiring' | 'payment_source_expired' | 'payment_source_locally_deleted' | 'virtual_bank_account_added' | 'virtual_bank_account_updated' | 'virtual_bank_account_deleted' | 'token_created' | 'token_consumed' | 'token_expired' | 'unbilled_charges_created' | 'unbilled_charges_voided' | 'unbilled_charges_deleted' | 'unbilled_charges_invoiced' | 'order_created' | 'order_updated' | 'order_cancelled' | 'order_delivered' | 'order_returned' | 'order_ready_to_process' | 'order_ready_to_ship' | 'order_deleted' | 'order_resent' | 'quote_created' | 'quote_updated' | 'quote_deleted' | 'tax_withheld_recorded' | 'tax_withheld_deleted' | 'tax_withheld_refunded' | 'gift_scheduled' | 'gift_unclaimed' | 'gift_claimed' | 'gift_expired' | 'gift_cancelled' | 'gift_updated' | 'hierarchy_created' | 'hierarchy_deleted' | 'payment_intent_created' | 'payment_intent_updated' | 'contract_term_created' | 'contract_term_renewed' | 'contract_term_terminated' | 'contract_term_completed' | 'contract_term_cancelled' | 'item_family_created' | 'item_family_updated' | 'item_family_deleted' | 'item_created' | 'item_updated' | 'item_deleted' | 'item_price_created' | 'item_price_updated' | 'item_price_deleted' | 'attached_item_created' | 'attached_item_updated' | 'attached_item_deleted' | 'differential_price_created' | 'differential_price_updated' | 'differential_price_deleted' | 'feature_created' | 'feature_updated' | 'feature_deleted' | 'feature_activated' | 'feature_reactivated' | 'feature_archived' | 'item_entitlements_updated' | 'entitlement_overrides_updated' | 'entitlement_overrides_removed' | 'item_entitlements_removed' | 'entitlement_overrides_auto_removed' | 'subscription_entitlements_created' | 'business_entity_created' | 'business_entity_updated' | 'business_entity_deleted' | 'customer_business_entity_changed' | 'subscription_business_entity_changed' | 'purchase_created' | 'voucher_created' | 'voucher_expired' | 'voucher_create_failed' | 'item_price_entitlements_updated' | 'item_price_entitlements_removed' | 'subscription_ramp_created' | 'subscription_ramp_deleted' | 'subscription_ramp_applied' | 'subscription_ramp_drafted' | 'subscription_ramp_updated' | 'price_variant_created' | 'price_variant_updated' | 'price_variant_deleted' | 'customer_entitlements_updated' | 'subscription_moved_in' | 'subscription_moved_out' | 'subscription_movement_failed' | 'omnichannel_subscription_created' | 'omnichannel_subscription_item_renewed' | 'omnichannel_subscription_item_downgrade_scheduled' | 'omnichannel_subscription_item_scheduled_downgrade_removed' | 'omnichannel_subscription_item_downgraded' | 'omnichannel_subscription_item_expired' | 'omnichannel_subscription_item_cancellation_scheduled' | 'omnichannel_subscription_item_scheduled_cancellation_removed' | 'omnichannel_subscription_item_resubscribed' | 'omnichannel_subscription_item_upgraded' | 'omnichannel_subscription_item_cancelled' | 'omnichannel_subscription_imported' | 'omnichannel_subscription_item_grace_period_started' | 'omnichannel_subscription_item_grace_period_expired' | 'omnichannel_subscription_item_dunning_started' | 'omnichannel_subscription_item_dunning_expired' | 'rule_created' | 'rule_updated' | 'rule_deleted' | 'record_purchase_failed' | 'plan_created' | 'plan_updated' | 'plan_deleted' | 'addon_created' | 'addon_updated' | 'addon_deleted'
47
+ type EventType = 'coupon_created' | 'coupon_updated' | 'coupon_deleted' | 'coupon_set_created' | 'coupon_set_updated' | 'coupon_set_deleted' | 'coupon_codes_added' | 'coupon_codes_deleted' | 'coupon_codes_updated' | 'customer_created' | 'customer_changed' | 'customer_deleted' | 'customer_moved_out' | 'customer_moved_in' | 'promotional_credits_added' | 'promotional_credits_deducted' | 'subscription_created' | 'subscription_created_with_backdating' | 'subscription_started' | 'subscription_trial_end_reminder' | 'subscription_activated' | 'subscription_activated_with_backdating' | 'subscription_changed' | 'subscription_trial_extended' | 'mrr_updated' | 'subscription_changed_with_backdating' | 'subscription_cancellation_scheduled' | 'subscription_cancellation_reminder' | 'subscription_cancelled' | 'subscription_canceled_with_backdating' | 'subscription_reactivated' | 'subscription_reactivated_with_backdating' | 'subscription_renewed' | 'subscription_items_renewed' | 'subscription_scheduled_cancellation_removed' | 'subscription_changes_scheduled' | 'subscription_scheduled_changes_removed' | 'subscription_shipping_address_updated' | 'subscription_deleted' | 'subscription_paused' | 'subscription_pause_scheduled' | 'subscription_scheduled_pause_removed' | 'subscription_resumed' | 'subscription_resumption_scheduled' | 'subscription_scheduled_resumption_removed' | 'subscription_advance_invoice_schedule_added' | 'subscription_advance_invoice_schedule_updated' | 'subscription_advance_invoice_schedule_removed' | 'pending_invoice_created' | 'pending_invoice_updated' | 'invoice_generated' | 'invoice_generated_with_backdating' | 'invoice_updated' | 'invoice_deleted' | 'credit_note_created' | 'credit_note_created_with_backdating' | 'credit_note_updated' | 'credit_note_deleted' | 'payment_schedules_created' | 'payment_schedules_updated' | 'payment_schedule_scheme_created' | 'payment_schedule_scheme_deleted' | 'subscription_renewal_reminder' | 'add_usages_reminder' | 'transaction_created' | 'transaction_updated' | 'transaction_deleted' | 'payment_succeeded' | 'payment_failed' | 'payment_refunded' | 'payment_initiated' | 'refund_initiated' | 'authorization_succeeded' | 'authorization_voided' | 'card_added' | 'card_updated' | 'card_expiry_reminder' | 'card_expired' | 'card_deleted' | 'payment_source_added' | 'payment_source_updated' | 'payment_source_deleted' | 'payment_source_expiring' | 'payment_source_expired' | 'payment_source_locally_deleted' | 'virtual_bank_account_added' | 'virtual_bank_account_updated' | 'virtual_bank_account_deleted' | 'token_created' | 'token_consumed' | 'token_expired' | 'unbilled_charges_created' | 'unbilled_charges_voided' | 'unbilled_charges_deleted' | 'unbilled_charges_invoiced' | 'order_created' | 'order_updated' | 'order_cancelled' | 'order_delivered' | 'order_returned' | 'order_ready_to_process' | 'order_ready_to_ship' | 'order_deleted' | 'order_resent' | 'quote_created' | 'quote_updated' | 'quote_deleted' | 'tax_withheld_recorded' | 'tax_withheld_deleted' | 'tax_withheld_refunded' | 'gift_scheduled' | 'gift_unclaimed' | 'gift_claimed' | 'gift_expired' | 'gift_cancelled' | 'gift_updated' | 'hierarchy_created' | 'hierarchy_deleted' | 'payment_intent_created' | 'payment_intent_updated' | 'contract_term_created' | 'contract_term_renewed' | 'contract_term_terminated' | 'contract_term_completed' | 'contract_term_cancelled' | 'item_family_created' | 'item_family_updated' | 'item_family_deleted' | 'item_created' | 'item_updated' | 'item_deleted' | 'item_price_created' | 'item_price_updated' | 'item_price_deleted' | 'attached_item_created' | 'attached_item_updated' | 'attached_item_deleted' | 'differential_price_created' | 'differential_price_updated' | 'differential_price_deleted' | 'feature_created' | 'feature_updated' | 'feature_deleted' | 'feature_activated' | 'feature_reactivated' | 'feature_archived' | 'item_entitlements_updated' | 'entitlement_overrides_updated' | 'entitlement_overrides_removed' | 'item_entitlements_removed' | 'entitlement_overrides_auto_removed' | 'subscription_entitlements_created' | 'subscription_entitlements_updated' | 'business_entity_created' | 'business_entity_updated' | 'business_entity_deleted' | 'customer_business_entity_changed' | 'subscription_business_entity_changed' | 'purchase_created' | 'voucher_created' | 'voucher_expired' | 'voucher_create_failed' | 'item_price_entitlements_updated' | 'item_price_entitlements_removed' | 'subscription_ramp_created' | 'subscription_ramp_deleted' | 'subscription_ramp_applied' | 'subscription_ramp_drafted' | 'subscription_ramp_updated' | 'price_variant_created' | 'price_variant_updated' | 'price_variant_deleted' | 'customer_entitlements_updated' | 'subscription_moved_in' | 'subscription_moved_out' | 'subscription_movement_failed' | 'omnichannel_subscription_created' | 'omnichannel_subscription_item_renewed' | 'omnichannel_subscription_item_downgrade_scheduled' | 'omnichannel_subscription_item_scheduled_downgrade_removed' | 'omnichannel_subscription_item_downgraded' | 'omnichannel_subscription_item_expired' | 'omnichannel_subscription_item_cancellation_scheduled' | 'omnichannel_subscription_item_scheduled_cancellation_removed' | 'omnichannel_subscription_item_resubscribed' | 'omnichannel_subscription_item_upgraded' | 'omnichannel_subscription_item_cancelled' | 'omnichannel_subscription_imported' | 'omnichannel_subscription_item_grace_period_started' | 'omnichannel_subscription_item_grace_period_expired' | 'omnichannel_subscription_item_dunning_started' | 'omnichannel_subscription_item_dunning_expired' | 'rule_created' | 'rule_updated' | 'rule_deleted' | 'record_purchase_failed' | 'plan_created' | 'plan_updated' | 'plan_deleted' | 'addon_created' | 'addon_updated' | 'addon_deleted'
48
48
  type ExportType = 'data' | 'import_friendly_data'
49
49
  type FreePeriodUnit = 'day' | 'week' | 'month' | 'year'
50
50
  type FriendOfferType = 'none' | 'coupon' | 'coupon_code'
51
- type Gateway = 'chargebee' | 'chargebee_payments' | 'stripe' | 'wepay' | 'braintree' | 'authorize_net' | 'paypal_pro' | 'pin' | 'eway' | 'eway_rapid' | 'worldpay' | 'balanced_payments' | 'beanstream' | 'bluepay' | 'elavon' | 'first_data_global' | 'hdfc' | 'migs' | 'nmi' | 'ogone' | 'paymill' | 'paypal_payflow_pro' | 'sage_pay' | 'tco' | 'wirecard' | 'amazon_payments' | 'paypal_express_checkout' | 'adyen' | 'orbital' | 'moneris_us' | 'moneris' | 'bluesnap' | 'cybersource' | 'vantiv' | 'checkout_com' | 'paypal' | 'ingenico_direct' | 'exact' | 'mollie' | 'quickbooks' | 'razorpay' | 'global_payments' | 'bank_of_america' | 'ecentric' | 'metrics_global' | 'windcave' | 'pay_com' | 'ebanx' | 'dlocal' | 'nuvei' | 'gocardless' | 'not_applicable'
51
+ type Gateway = 'chargebee' | 'chargebee_payments' | 'adyen' | 'stripe' | 'wepay' | 'braintree' | 'authorize_net' | 'paypal_pro' | 'pin' | 'eway' | 'eway_rapid' | 'worldpay' | 'balanced_payments' | 'beanstream' | 'bluepay' | 'elavon' | 'first_data_global' | 'hdfc' | 'migs' | 'nmi' | 'ogone' | 'paymill' | 'paypal_payflow_pro' | 'sage_pay' | 'tco' | 'wirecard' | 'amazon_payments' | 'paypal_express_checkout' | 'orbital' | 'moneris_us' | 'moneris' | 'bluesnap' | 'cybersource' | 'vantiv' | 'checkout_com' | 'paypal' | 'ingenico_direct' | 'exact' | 'mollie' | 'quickbooks' | 'razorpay' | 'global_payments' | 'bank_of_america' | 'ecentric' | 'metrics_global' | 'windcave' | 'pay_com' | 'ebanx' | 'dlocal' | 'nuvei' | 'gocardless' | 'not_applicable'
52
52
  type HierarchyOperationType = 'complete_hierarchy' | 'subordinates' | 'path_to_root'
53
53
  type InvoiceDunningHandling = 'continue' | 'stop'
54
54
  type ItemType = 'plan' | 'addon' | 'charge'
@@ -454,7 +454,7 @@ declare module 'chargebee' {
454
454
 
455
455
  shipping_address?:{city?:string,company?:string,country?:string,email?:string,first_name?:string,last_name?:string,line1?:string,line2?:string,line3?:string,phone?:string,state?:string,state_code?:string,validation_status?:ValidationStatus,zip?:string};
456
456
 
457
- line_items:{amount?:number,amount_in_decimal?:string,date_from?:number,date_to?:number,description:string,entity_id?:string,entity_type?:'adhoc' | 'plan_item_price' | 'addon_item_price' | 'charge_item_price',id?:string,item_level_discount1_amount?:number,item_level_discount1_entity_id?:string,item_level_discount2_amount?:number,item_level_discount2_entity_id?:string,quantity?:number,quantity_in_decimal?:string,subscription_id?:string,tax10_amount?:number,tax10_name?:string,tax1_amount?:number,tax1_name?:string,tax2_amount?:number,tax2_name?:string,tax3_amount?:number,tax3_name?:string,tax4_amount?:number,tax4_name?:string,tax5_amount?:number,tax5_name?:string,tax6_amount?:number,tax6_name?:string,tax7_amount?:number,tax7_name?:string,tax8_amount?:number,tax8_name?:string,tax9_amount?:number,tax9_name?:string,unit_amount?:number,unit_amount_in_decimal?:string}[];
457
+ line_items:{amount?:number,amount_in_decimal?:string,created_at?:number,date_from?:number,date_to?:number,description:string,entity_id?:string,entity_type?:'adhoc' | 'plan_item_price' | 'addon_item_price' | 'charge_item_price',id?:string,item_level_discount1_amount?:number,item_level_discount1_entity_id?:string,item_level_discount2_amount?:number,item_level_discount2_entity_id?:string,quantity?:number,quantity_in_decimal?:string,subscription_id?:string,tax10_amount?:number,tax10_name?:string,tax1_amount?:number,tax1_name?:string,tax2_amount?:number,tax2_name?:string,tax3_amount?:number,tax3_name?:string,tax4_amount?:number,tax4_name?:string,tax5_amount?:number,tax5_name?:string,tax6_amount?:number,tax6_name?:string,tax7_amount?:number,tax7_name?:string,tax8_amount?:number,tax8_name?:string,tax9_amount?:number,tax9_name?:string,unit_amount?:number,unit_amount_in_decimal?:string}[];
458
458
 
459
459
  payment_reference_numbers:{id?:string,number:string,type:'kid' | 'ocr' | 'frn' | 'fik' | 'swiss_reference'}[];
460
460
 
@@ -3,120 +3,24 @@
3
3
  declare module 'chargebee' {
4
4
  export interface Purchase {
5
5
 
6
- /**
7
- * @description The unique identifier of the purchase resource. This is always autogenerated.
8
6
 
9
- */
10
-
11
7
  id?:string;
12
-
13
- /**
14
- * @description The unique identifier of the [customer](https://apidocs.chargebee.com/docs/api/customers) that made this purchase.
15
8
 
16
- */
17
-
18
9
  customer_id:string;
19
-
20
- /**
21
- * @description The time at which this purchase was created.
22
10
 
23
- */
24
-
25
11
  created_at?:number;
26
-
27
- /**
28
- * @description The time at which the purchase was modified.
29
12
 
30
- */
31
-
32
13
  modified_at?:number;
33
-
34
- /**
35
- * @description The unique identifiers of the [subscriptions](https://apidocs.chargebee.com/docs/api/subscriptions) that are created as part of this purchase. These IDs remain even when the associated subscriptions have been deleted.
36
14
 
37
- */
38
-
39
15
  subscription_ids?:string[];
40
-
41
- /**
42
- * @description The unique identifier of the [invoice(s)](invoices) created immediately as part of this purchase.
43
16
 
44
- */
45
-
46
17
  invoice_ids?:string[];
18
+
47
19
  }
48
20
  export namespace Purchase {
49
21
  export class PurchaseResource {
50
- /**
51
- * @description Creates a `purchase` resource. A purchase can contain one or more of the following:
52
-
53
- * subscriptions (a [subscription](subscriptions) resource consists of item prices such that at least one of the item prices belongs to an [item](items) of `type` `plan`.)
54
- * group of one-time charges (aka [charge item prices](item_prices#types))
55
-
56
- When you call this API, the invoices for the subscription(s) and one-time charge(s) are created immediately and not left [unbilled](subscriptions?prod_cat_ver=2#create_subscription_for_items_invoice_immediately).
57
- **Note**
58
-
59
- Providing `shipping_addresses[]` is required when the [Orders feature](https://www.chargebee.com/docs/2.0/orders.html#configuration_step-1-configure-site-wide-settings) has been enabled.
60
-
61
- ### Specifying `purchase_item` groups {#groups}
62
-
63
-
64
- When creating a purchase, you must specify the *group* or `index` to which each item price belongs. You can do this by setting the `purchase_items[index]` for each item price. Item prices with the same `purchase_items[index]` belong to the same group.
65
-
66
-
67
- The grouping of item prices allows you to specify the `discounts[]` applicable for each group and indicate which item prices should be added to any subscriptions you want to create. Groups can be one of two types:
68
-
69
- * Subscription groups
70
- * One-time charge groups
71
-
72
- The following subsections describe the types of groups in detail.
73
- **Note**
74
-
75
- You can specify up to 10 groups,
76
-
77
- * with a recommended subscription group of 5. To increase this limit to a maximum of 8, contact eap@chargebee.com.
78
- * with a maximum of 10 one-time charge groups by default.
79
-
80
- The total limit for group items for a single purchase is 60.
81
-
82
- #### Subscription groups {#subscription}
83
-
84
- To create a subscription, specify a *subscription group* . A subscription [group](#groups) is a group of item prices that contains exactly one item price of `type` `plan`. To create multiple subscriptions, provide multiple subscription groups.
85
- **Note**
86
-
87
- A subscription group can have up to 20 non-plan item prices. To increase this limit to a maximum of 60, contact eap@chargebee.com.
88
-
89
- #### Custom Fields {#custom-fields}
90
-
91
- Purchase API supports custom fields of Subscriptions, use the following format to specify custom fields in Purchase API: **`subscription_info[custom_field]`**.
92
-
93
- #### One-time charge groups {#one-time}
94
-
95
- A one-time charge [group](#groups) is a group of charge item prices (i.e. item prices belonging to items of `type` `charge`). Charge item prices can be added to subscription groups as well. The charges within and across each one-time group must be unique.
96
- **Note**
97
-
98
- * A one-time charge group can have up to 20 item prices. To increase this limit to a maximum of 60, contact eap@chargebee.com.
99
- * A charge item price can only be added to a single one-time charge group. However, it can be part of multiple [subscription groups](#subscription).
100
-
101
- ### Applying discounts {#discounts}
102
-
103
- Discounts, both [manual discounts](discounts) and <coupons>, can be applied to groups by specifying the `discounts[]` array. The following table describes the method of application based on whether `discounts[index][i]` is provided:
104
-
105
- | | **`discounts[index][i]` is provided** | **`discounts[index][i]` is not provided** |
106
- |----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
107
- | **Coupons** | * The coupon is applied exclusively to the invoice for group `i`. * The coupon is applied exclusively to the invoice created immediately upon invoking this API. * If group `i` is a [subscription group](#subscription), then the coupon is applied to invoices for subscription renewals based on coupon attributes such as `duration_type` and `max_redemptions`. | * The coupon is applied to all the invoices immediately generated upon invoking this API. * The coupon is not applied to subsequent invoices, such as those generated upon subscription renewal. |
108
- | **Manual discounts** | * The manual discount is applied exclusively to the invoice for group `i`. * The manual discount is applied exclusively to the invoice created immediately upon invoking this API. * The manual discount is not applied to subsequent invoices, such as those generated upon subscription renewal. | * The manual discount is applied to all the invoices immediately generated upon invoking this API. * The manual discount is not applied to subsequent invoices, such as those generated upon subscription renewal. |
109
-
110
-
111
- */
112
-
113
22
  create(input:CreateInputParam):ChargebeeRequest<CreateResponse>;
114
23
 
115
- /**
116
- * @description Returns an estimate for creating a &#x60;purchase&#x60; resource. The operation works exactly like [Create a purchase](purchases#create_a_purchase), except that only an [estimate](estimates) resource is returned without an actual &#x60;purchase&#x60; resource being created.
117
-
118
- */
119
-
120
24
  estimate(input:EstimateInputParam):ChargebeeRequest<EstimateResponse>;
121
25
  }
122
26
  export interface CreateResponse {
@@ -124,203 +28,54 @@ Discounts, both [manual discounts](discounts) and &lt;coupons&gt;, can be applie
124
28
  }
125
29
  export interface CreateInputParam {
126
30
 
127
- /**
128
- * @description The unique identifier of the [customer](https://apidocs.chargebee.com/docs/api/customers) that made this purchase.
129
-
130
- */
131
-
132
- customer_id:string;
133
-
134
- /**
135
- * @description Payment source attached to this purchase. If present, the customer&#x27;s payment sources won&#x27;t be used to collect any payment for this purchase.
136
-
137
- */
138
-
139
- payment_source_id?:string;
31
+ invoice_info?:{notes?:string,po_number?:string};
140
32
 
141
- /**
142
- * @description Parameters for invoice_info
143
-
144
- */
33
+ payment_schedule?:{amount?:number,scheme_id?:string};
145
34
 
146
- invoice_info?:{notes?:string,po_number?:string};
35
+ statement_descriptor?:{descriptor?:string};
147
36
 
148
- /**
149
- * @description Parameters for purchase_items
150
-
151
- */
37
+ payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_payment_method_id?:string,gw_token?:string,id?:string,payment_method_type?:'card' | 'ideal' | 'sofort' | 'bancontact' | 'google_pay' | 'dotpay' | 'giropay' | 'apple_pay' | 'upi' | 'netbanking_emandates' | 'paypal_express_checkout' | 'direct_debit' | 'boleto' | 'venmo' | 'amazon_payments' | 'pay_to' | 'faster_payments' | 'sepa_instant_transfer' | 'klarna_pay_now' | 'online_banking_poland',reference_id?:string};
152
38
 
153
39
  purchase_items:{index:number,item_price_id:string,quantity?:number,quantity_in_decimal?:string,unit_amount?:number,unit_amount_in_decimal?:string}[];
154
40
 
155
- /**
156
- * @description Parameters for item_tiers
157
-
158
- */
159
-
160
41
  item_tiers:{ending_unit?:number,ending_unit_in_decimal?:string,index:number,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[];
161
42
 
162
- /**
163
- * @description Parameters for shipping_addresses
164
-
165
- */
166
-
167
43
  shipping_addresses?:{city?:string,company?:string,country?:string,email?:string,first_name?:string,last_name?:string,line1?:string,line2?:string,line3?:string,phone?:string,state?:string,state_code?:string,validation_status?:ValidationStatus,zip?:string}[];
168
44
 
169
- /**
170
- * @description Parameters for discounts
171
-
172
- */
173
-
174
45
  discounts?:{amount?:number,coupon_id?:string,included_in_mrr?:boolean,index?:number,percentage?:number}[];
175
46
 
176
- /**
177
- * @description Parameters for subscription_info
178
-
179
- */
180
-
181
47
  subscription_info:{billing_cycles?:number,contract_term_billing_cycle_on_renewal?:number,index:number,meta_data?:object,subscription_id?:string}[];
182
48
 
183
- /**
184
- * @description Creates a &#x60;purchase&#x60; resource. A purchase can contain one or more of the following:
185
-
186
- * subscriptions (a [subscription](subscriptions) resource consists of item prices such that at least one of the item prices belongs to an [item](items) of &#x60;type&#x60; &#x60;plan&#x60;.)
187
- * group of one-time charges (aka [charge item prices](item_prices#types))
188
-
189
- When you call this API, the invoices for the subscription(s) and one-time charge(s) are created immediately and not left [unbilled](subscriptions?prod_cat_ver&#x3D;2#create_subscription_for_items_invoice_immediately).
190
- **Note**
191
-
192
- Providing &#x60;shipping_addresses[]&#x60; is required when the [Orders feature](https://www.chargebee.com/docs/2.0/orders.html#configuration_step-1-configure-site-wide-settings) has been enabled.
193
-
194
- ### Specifying &#x60;purchase_item&#x60; groups {#groups}
195
-
196
-
197
- When creating a purchase, you must specify the *group* or &#x60;index&#x60; to which each item price belongs. You can do this by setting the &#x60;purchase_items[index]&#x60; for each item price. Item prices with the same &#x60;purchase_items[index]&#x60; belong to the same group.
198
-
199
-
200
- The grouping of item prices allows you to specify the &#x60;discounts[]&#x60; applicable for each group and indicate which item prices should be added to any subscriptions you want to create. Groups can be one of two types:
201
-
202
- * Subscription groups
203
- * One-time charge groups
204
-
205
- The following subsections describe the types of groups in detail.
206
- **Note**
207
-
208
- You can specify up to 10 groups,
209
-
210
- * with a recommended subscription group of 5. To increase this limit to a maximum of 8, contact eap@chargebee.com.
211
- * with a maximum of 10 one-time charge groups by default.
212
-
213
- The total limit for group items for a single purchase is 60.
214
-
215
- #### Subscription groups {#subscription}
216
-
217
- To create a subscription, specify a *subscription group* . A subscription [group](#groups) is a group of item prices that contains exactly one item price of &#x60;type&#x60; &#x60;plan&#x60;. To create multiple subscriptions, provide multiple subscription groups.
218
- **Note**
219
-
220
- A subscription group can have up to 20 non-plan item prices. To increase this limit to a maximum of 60, contact eap@chargebee.com.
221
-
222
- #### Custom Fields {#custom-fields}
223
-
224
- Purchase API supports custom fields of Subscriptions, use the following format to specify custom fields in Purchase API: **&#x60;subscription_info[custom_field]&#x60;**.
225
-
226
- #### One-time charge groups {#one-time}
227
-
228
- A one-time charge [group](#groups) is a group of charge item prices (i.e. item prices belonging to items of &#x60;type&#x60; &#x60;charge&#x60;). Charge item prices can be added to subscription groups as well. The charges within and across each one-time group must be unique.
229
- **Note**
230
-
231
- * A one-time charge group can have up to 20 item prices. To increase this limit to a maximum of 60, contact eap@chargebee.com.
232
- * A charge item price can only be added to a single one-time charge group. However, it can be part of multiple [subscription groups](#subscription).
233
-
234
- ### Applying discounts {#discounts}
235
-
236
- Discounts, both [manual discounts](discounts) and &lt;coupons&gt;, can be applied to groups by specifying the &#x60;discounts[]&#x60; array. The following table describes the method of application based on whether &#x60;discounts[index][i]&#x60; is provided:
237
-
238
- | | **&#x60;discounts[index][i]&#x60; is provided** | **&#x60;discounts[index][i]&#x60; is not provided** |
239
- |----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
240
- | **Coupons** | * The coupon is applied exclusively to the invoice for group &#x60;i&#x60;. * The coupon is applied exclusively to the invoice created immediately upon invoking this API. * If group &#x60;i&#x60; is a [subscription group](#subscription), then the coupon is applied to invoices for subscription renewals based on coupon attributes such as &#x60;duration_type&#x60; and &#x60;max_redemptions&#x60;. | * The coupon is applied to all the invoices immediately generated upon invoking this API. * The coupon is not applied to subsequent invoices, such as those generated upon subscription renewal. |
241
- | **Manual discounts** | * The manual discount is applied exclusively to the invoice for group &#x60;i&#x60;. * The manual discount is applied exclusively to the invoice created immediately upon invoking this API. * The manual discount is not applied to subsequent invoices, such as those generated upon subscription renewal. | * The manual discount is applied to all the invoices immediately generated upon invoking this API. * The manual discount is not applied to subsequent invoices, such as those generated upon subscription renewal. |
242
-
243
-
244
- */
49
+ contract_terms:{action_at_term_end?:'renew' | 'evergreen' | 'cancel' | 'renew_once',cancellation_cutoff_period?:number,index:number}[];
245
50
 
246
- contract_terms:{action_at_term_end?:'cancel' | 'renew_once' | 'renew' | 'evergreen',cancellation_cutoff_period?:number,index:number}[];
247
- statement_descriptor?:{descriptor?:string};
248
- payment_schedule?:{amount?:number,scheme_id?:string};
51
+ customer_id:string;
52
+
53
+ payment_source_id?:string;
249
54
  }
250
55
  export interface EstimateResponse {
251
56
  estimate:Estimate;
252
57
  }
253
58
  export interface EstimateInputParam {
254
59
 
255
- /**
256
- * @description Indicates the Client profile id for the customer. This is applicable only if you use [Chargebee&#x27;s AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration.
257
-
258
- */
259
-
260
- client_profile_id?:string;
261
-
262
- /**
263
- * @description The unique identifier of the [customer](https://apidocs.chargebee.com/docs/api/customers) that made this purchase.
264
-
265
- */
266
-
267
- customer_id?:string;
268
-
269
- /**
270
- * @description Parameters for customer
271
-
272
- */
273
-
274
60
  customer?:{customer_type?:CustomerType,entity_code?:EntityCode,exempt_number?:string,exemption_details?:any[],registered_for_gst?:boolean,taxability?:Taxability,vat_number?:string,vat_number_prefix?:string};
275
61
 
276
- /**
277
- * @description Parameters for billing_address
278
-
279
- */
280
-
281
62
  billing_address?:{city?:string,country?:string,line1?:string,line2?:string,line3?:string,state_code?:string,validation_status?:ValidationStatus,zip?:string};
282
63
 
283
- /**
284
- * @description Parameters for purchase_items
285
-
286
- */
287
-
288
64
  purchase_items:{index:number,item_price_id:string,quantity?:number,quantity_in_decimal?:string,unit_amount?:number,unit_amount_in_decimal?:string}[];
289
65
 
290
- /**
291
- * @description Parameters for item_tiers
292
-
293
- */
294
-
295
66
  item_tiers:{ending_unit?:number,ending_unit_in_decimal?:string,index:number,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[];
296
67
 
297
- /**
298
- * @description Parameters for shipping_addresses
299
-
300
- */
301
-
302
68
  shipping_addresses?:{city?:string,company?:string,country?:string,email?:string,first_name?:string,last_name?:string,line1?:string,line2?:string,line3?:string,phone?:string,state?:string,state_code?:string,validation_status?:ValidationStatus,zip?:string}[];
303
69
 
304
- /**
305
- * @description Parameters for discounts
306
-
307
- */
308
-
309
70
  discounts?:{amount?:number,coupon_id?:string,included_in_mrr?:boolean,index?:number,percentage?:number}[];
310
71
 
311
- /**
312
- * @description Parameters for subscription_info
313
-
314
- */
315
-
316
72
  subscription_info:{billing_cycles?:number,contract_term_billing_cycle_on_renewal?:number,index:number,subscription_id?:string}[];
317
73
 
318
- /**
319
- * @description Returns an estimate for creating a &#x60;purchase&#x60; resource. The operation works exactly like [Create a purchase](purchases#create_a_purchase), except that only an [estimate](estimates) resource is returned without an actual &#x60;purchase&#x60; resource being created.
320
-
321
- */
74
+ contract_terms:{action_at_term_end?:'renew' | 'evergreen' | 'cancel' | 'renew_once',cancellation_cutoff_period?:number,index:number}[];
322
75
 
323
- contract_terms:{action_at_term_end?:'cancel' | 'renew_once' | 'renew' | 'evergreen',cancellation_cutoff_period?:number,index:number}[];
76
+ client_profile_id?:string;
77
+
78
+ customer_id?:string;
324
79
  }
325
80
 
326
81
  }