From 56e566f71d2d6e1b03a23b3967eef57ac4be9285 Mon Sep 17 00:00:00 2001 From: cb-nithins Date: Tue, 31 Oct 2023 09:53:29 +0000 Subject: [PATCH] Releasing v2.29.0. Please check the changelog for the updates. --- CHANGELOG.md | 47 + lib/chargebee.js | 2 +- lib/resources/api_endpoints.js | 7 - package.json | 2 +- types/core.d.ts | 8 +- types/resources/AttachedItem.d.ts | 176 +- types/resources/Card.d.ts | 136 +- types/resources/Comment.d.ts | 94 +- types/resources/Coupon.d.ts | 449 ++-- types/resources/CouponSet.d.ts | 140 +- types/resources/CreditNote.d.ts | 848 +++++-- types/resources/Customer.d.ts | 1168 +++++----- types/resources/DifferentialPrice.d.ts | 173 +- types/resources/EntitlementOverride.d.ts | 39 +- types/resources/Estimate.d.ts | 900 ++++---- types/resources/Event.d.ts | 42 +- types/resources/Export.d.ts | 400 ++-- types/resources/Feature.d.ts | 101 +- types/resources/Gift.d.ts | 98 +- types/resources/HostedPage.d.ts | 762 +++---- types/resources/InAppSubscription.d.ts | 184 +- types/resources/Invoice.d.ts | 1902 ++++++++++------ types/resources/Item.d.ts | 290 +-- types/resources/ItemEntitlement.d.ts | 72 +- types/resources/ItemFamily.d.ts | 90 +- types/resources/ItemPrice.d.ts | 590 ++--- types/resources/PaymentIntent.d.ts | 120 +- types/resources/PaymentVoucher.d.ts | 133 +- types/resources/PortalSession.d.ts | 65 +- types/resources/PromotionalCredit.d.ts | 136 +- types/resources/Purchase.d.ts | 6 +- types/resources/Quote.d.ts | 1015 ++++++--- types/resources/QuoteLineGroup.d.ts | 245 ++ types/resources/QuotedCharge.d.ts | 170 ++ types/resources/QuotedSubscription.d.ts | 219 ++ types/resources/SiteMigrationDetail.d.ts | 14 +- types/resources/Subscription.d.ts | 2151 ++++++++++-------- types/resources/SubscriptionEntitlement.d.ts | 45 +- types/resources/ThirdPartyPaymentMethod.d.ts | 2 +- types/resources/TimeMachine.d.ts | 30 +- types/resources/Token.d.ts | 46 +- types/resources/Transaction.d.ts | 341 ++- types/resources/UnbilledCharge.d.ts | 179 +- types/resources/Usage.d.ts | 93 +- types/resources/VirtualBankAccount.d.ts | 132 +- 45 files changed, 8316 insertions(+), 5546 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e3903d..429f7b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,50 @@ +### v2.29.0 (2023-10-31) +* * * + +#### New attributes: +* statement_descriptor has been added to invoice resource. +* source has been added to the Hosted_Pages resource. + +#### New Enum values: +* pay_com has been added to Gateway. +* pay_to, faster_payments, sepa_instant_transfer has been added to Customer#TypeEnum. +* pay_to, faster_payments, sepa_instant_transfer has been added to PaymentMethodEnum. +* pay_to, faster_payments, sepa_instant_transfer has been added to PaymentMethodTypeEnum. +* pay_to, faster_payments, sepa_instant_transfer has been added to TypeEnum. +* pay_to, faster_payments, sepa_instant_transfer, amazon_payments has been added to PaymentIntent#PaymentMethodTypeEnum. + +#### New Input parameters: +* source has been added to HostedPage#CheckoutOneTimeForItemsRequest. +* source has been added to HostedPage#CheckoutNewForItemsRequest. +* source has been added to HostedPage#CheckoutExistingForItemsRequest. +* statement_descriptor_descriptor has been added to Invoice#CreateRequest. +* statement_descriptor_descriptor has been added to Invoice#CreateForChargeItemsAndChargesRequest. +* statement_descriptor_descriptor has been added to Invoice#UpdateDetailsRequest. +* statement_descriptor_additional_info has been added to Invoice#CreateRequest. +* statement_descriptor_additional_info has been added to Invoice#CreateForChargeItemsAndChargesRequest. +* statement_descriptor_additional_info has been added to Invoice#UpdateDetailsRequest. +* statement_descriptor_descriptor has been added to Subscription#CreateRequest. +* statement_descriptor_descriptor has been added to Subscription#CreateForCustomerRequest. +* statement_descriptor_descriptor has been added to Subscription#CreateWithItemsRequest. +* statement_descriptor_descriptor has been added to Subscription#UpdateRequest. +* statement_descriptor_descriptor has been added to Subscription#UpdateForItemsRequest. +* statement_descriptor_descriptor has been added to Subscription#ReactivateRequest. +* statement_descriptor_additional_info has been added to Subscription#CreateRequest. +* statement_descriptor_additional_info has been added to Subscription#CreateForCustomerRequest. +* statement_descriptor_additional_info has been added to Subscription#CreateWithItemsRequest. +* statement_descriptor_additional_info has been added to Subscription#UpdateRequest. +* statement_descriptor_additional_info has been added to Subscription#UpdateForItemsRequest. +* statement_descriptor_additional_info has been added to Subscription#ReactivateRequest. + +#### Updates to old parameters: +* duration_type, discount_type in coupons has been made optional. +* proration_type in addons is now supported. +* csv_tax_rule has been removed. +* Tax1JurisTypeEnum has been removed. +* Tax2JurisTypeEnum has been removed. +* Tax3JurisTypeEnum has been removed. +* Tax4JurisTypeEnum has been removed. + ### v2.28.0 (2023-09-26) * * * diff --git a/lib/chargebee.js b/lib/chargebee.js index 2c94356..c7c33e0 100644 --- a/lib/chargebee.js +++ b/lib/chargebee.js @@ -11,7 +11,7 @@ ChargeBee._env = { hostSuffix: '.chargebee.com', apiPath: '/api/v2', timeout: 80000, - clientVersion: 'v2.28.0', + clientVersion: 'v2.29.0', port: 443, timemachineWaitInMillis: 3000, exportWaitInMillis: 3000 diff --git a/lib/resources/api_endpoints.js b/lib/resources/api_endpoints.js index 74885c7..1893acb 100644 --- a/lib/resources/api_endpoints.js +++ b/lib/resources/api_endpoints.js @@ -2677,12 +2677,5 @@ var _endpoints = { true ] ], - "csv_tax_rule": [[ - "create", - "POST", - "/csv_tax_rules", - null, - false - ]] }; module.exports = _endpoints; \ No newline at end of file diff --git a/package.json b/package.json index 79dab36..f94d44c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name":"chargebee", - "version":"2.28.0", + "version":"2.29.0", "description":"A library for integrating with ChargeBee.", "keywords":[ "payments", diff --git a/types/core.d.ts b/types/core.d.ts index 8efb30d..2c0e656 100644 --- a/types/core.d.ts +++ b/types/core.d.ts @@ -46,7 +46,7 @@ declare module 'chargebee' { type ExportType = 'data' | 'import_friendly_data' type FreePeriodUnit = 'week' | 'month' | 'year' | 'day' type FriendOfferType = 'coupon_code' | 'coupon' | 'none' - type Gateway = 'bluepay' | 'beanstream' | 'elavon' | 'orbital' | 'hdfc' | 'nmi' | 'moneris' | 'metrics_global' | 'pin' | 'stripe' | 'quickbooks' | 'razorpay' | 'eway_rapid' | 'balanced_payments' | 'ecentric' | 'wepay' | 'chargebee_payments' | 'bank_of_america' | 'braintree' | 'first_data_global' | 'paypal_express_checkout' | 'ingenico_direct' | 'moneris_us' | 'exact' | 'migs' | 'checkout_com' | 'not_applicable' | 'paypal_pro' | 'ogone' | 'eway' | 'gocardless' | 'global_payments' | 'paymill' | 'adyen' | 'paypal' | 'chargebee' | 'authorize_net' | 'tco' | 'bluesnap' | 'windcave' | 'paypal_payflow_pro' | 'amazon_payments' | 'mollie' | 'cybersource' | 'wirecard' | 'sage_pay' | 'vantiv' | 'worldpay' + type Gateway = 'bluepay' | 'beanstream' | 'elavon' | 'orbital' | 'hdfc' | 'nmi' | 'moneris' | 'metrics_global' | 'ebanx' | 'pin' | 'stripe' | 'quickbooks' | 'razorpay' | 'eway_rapid' | 'balanced_payments' | 'ecentric' | 'wepay' | 'chargebee_payments' | 'bank_of_america' | 'braintree' | 'first_data_global' | 'paypal_express_checkout' | 'ingenico_direct' | 'moneris_us' | 'exact' | 'migs' | 'checkout_com' | 'not_applicable' | 'paypal_pro' | 'ogone' | 'eway' | 'gocardless' | 'global_payments' | 'paymill' | 'adyen' | 'paypal' | 'chargebee' | 'authorize_net' | 'tco' | 'bluesnap' | 'windcave' | 'paypal_payflow_pro' | 'amazon_payments' | 'mollie' | 'cybersource' | 'wirecard' | 'sage_pay' | 'vantiv' | 'worldpay' | 'pay_com' type HierarchyOperationType = 'complete_hierarchy' | 'subordinates' | 'path_to_root' type InvoiceDunningHandling = 'stop' | 'continue' type ItemType = 'charge' | 'addon' | 'plan' @@ -58,8 +58,8 @@ declare module 'chargebee' { type OperationType = 'add' | 'remove' type PauseOption = 'end_of_term' | 'billing_cycles' | 'immediately' | 'specific_date' type PaymentInitiator = 'merchant' | 'customer' - type PaymentMethod = 'other' | 'netbanking_emandates' | 'ach_credit' | 'dotpay' | 'boleto' | 'direct_debit' | 'chargeback' | 'wechat_pay' | 'cash' | 'giropay' | 'bank_transfer' | 'alipay' | 'ideal' | 'google_pay' | 'custom' | 'unionpay' | 'check' | 'sofort' | 'amazon_payments' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'sepa_credit' | 'card' - type PaymentMethodType = 'giropay' | 'alipay' | 'ideal' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'unionpay' | 'direct_debit' | 'generic' | 'sofort' | 'amazon_payments' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'wechat_pay' | 'card' + type PaymentMethod = 'other' | 'netbanking_emandates' | 'ach_credit' | 'dotpay' | 'boleto' | 'direct_debit' | 'chargeback' | 'wechat_pay' | 'pay_to' | 'cash' | 'giropay' | 'bank_transfer' | 'alipay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'custom' | 'unionpay' | 'check' | 'faster_payments' | 'sofort' | 'amazon_payments' | 'upi' | 'venmo' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'sepa_credit' | 'card' + type PaymentMethodType = 'giropay' | 'alipay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'unionpay' | 'direct_debit' | 'faster_payments' | 'generic' | 'sofort' | 'amazon_payments' | 'upi' | 'venmo' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'wechat_pay' | 'pay_to' | 'card' type PaymentVoucherType = 'boleto' type PeriodUnit = 'week' | 'month' | 'year' | 'day' type PriceType = 'tax_exclusive' | 'tax_inclusive' @@ -78,7 +78,7 @@ declare module 'chargebee' { type Taxability = 'taxable' | 'exempt' type TaxjarExemptionCategory = 'other' | 'wholesale' | 'government' type TrialEndAction = 'activate_subscription' | 'plan_default' | 'cancel_subscription' | 'site_default' - type Type = 'giropay' | 'alipay' | 'ideal' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'unionpay' | 'direct_debit' | 'generic' | 'sofort' | 'amazon_payments' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'wechat_pay' | 'card' + type Type = 'giropay' | 'alipay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'unionpay' | 'direct_debit' | 'faster_payments' | 'generic' | 'sofort' | 'amazon_payments' | 'upi' | 'venmo' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'wechat_pay' | 'pay_to' | 'card' type UnbilledChargesHandling = 'invoice' | 'no_action' type UnbilledChargesOption = 'invoice' | 'delete' type UnpaidInvoicesHandling = 'schedule_payment_collection' | 'no_action' diff --git a/types/resources/AttachedItem.d.ts b/types/resources/AttachedItem.d.ts index 3ee5d1f..4ed80bb 100644 --- a/types/resources/AttachedItem.d.ts +++ b/types/resources/AttachedItem.d.ts @@ -104,11 +104,11 @@ The value set explicitly for `billing_cycles` while [applying the addo export namespace AttachedItem { export class AttachedItemResource { /** - * @description Retrieves details of an attached addon or a charge item. + * @description Creates an attached addon or a charge item for a plan. */ - retrieve(attached_item_id:string, input:RetrieveInputParam):ChargebeeRequest; + create(item_id:string, input:CreateInputParam):ChargebeeRequest; /** * @description Updates an attached addon or a charge item for a plan. @@ -118,18 +118,11 @@ The value set explicitly for `billing_cycles` while [applying the addo update(attached_item_id:string, input:UpdateInputParam):ChargebeeRequest; /** - * @description Returns a list of attached items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). - - */ - - list(item_id:string, input?:ListInputParam):ChargebeeRequest; - - /** - * @description Creates an attached addon or a charge item for a plan. + * @description Retrieves details of an attached addon or a charge item. */ - create(item_id:string, input:CreateInputParam):ChargebeeRequest; + retrieve(attached_item_id:string, input:RetrieveInputParam):ChargebeeRequest; /** * @description Deletes an attached addon or a charge item. @@ -137,30 +130,25 @@ The value set explicitly for `billing_cycles` while [applying the addo */ delete(attached_item_id:string, input:DeleteInputParam):ChargebeeRequest; - } - export interface RetrieveResponse { - attached_item:AttachedItem; - } - export interface RetrieveInputParam { /** - * @description Retrieves details of an attached addon or a charge item. + * @description Returns a list of attached items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). */ - - parent_item_id:string; + + list(item_id:string, input?:ListInputParam):ChargebeeRequest; } - export interface UpdateResponse { + export interface CreateResponse { attached_item:AttachedItem; } - export interface UpdateInputParam { + export interface CreateInputParam { /** - * @description The id of the parent item in the attachment relationship. + * @description The id of the addon or charge that is being attached to the plan-item. */ - parent_item_id:string; + item_id:string; /** * @description The type of attachment for the addon. Only applicable for addon-items and is a required parameter as well for addon-items. \* recommended - The addon is recommended to go with the plan-item when using [Checkout](https://www.chargebee.com/docs/2.0/configure-inapp.html#fundamental-settings_recommending-addons-in-checkout) or [Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription). \* optional - The addon is neither mandatory, nor recommended. This allows you to attach an addon so you can specify a `quantity` and `billing_cycles` for the addon, for when it is applied to subscriptions with the plan. \* mandatory - The addon is attached automatically to the subscription for the plan-item unless [explicitly removed](./subscriptions?prod_cat_ver=2) via API. @@ -206,146 +194,158 @@ The value set explicitly for `billing_cycles` while [applying the addo charge_once?:boolean; } - export interface ListResponse { + export interface UpdateResponse { + attached_item:AttachedItem; + } + export interface UpdateInputParam { + /** - * @description Returns a list of attached items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). + * @description The id of the parent item in the attachment relationship. */ - list:{attached_item:AttachedItem}[]; + parent_item_id:string; /** - * @description Returns a list of attached items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). + * @description The type of attachment for the addon. Only applicable for addon-items and is a required parameter as well for addon-items. \* recommended - The addon is recommended to go with the plan-item when using [Checkout](https://www.chargebee.com/docs/2.0/configure-inapp.html#fundamental-settings_recommending-addons-in-checkout) or [Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription). \* optional - The addon is neither mandatory, nor recommended. This allows you to attach an addon so you can specify a `quantity` and `billing_cycles` for the addon, for when it is applied to subscriptions with the plan. \* mandatory - The addon is attached automatically to the subscription for the plan-item unless [explicitly removed](./subscriptions?prod_cat_ver=2) via API. */ - next_offset?:string; - } - export interface ListInputParam { - [key : string]: any; - /** - * @description The number of resources to be returned. - - */ - - limit?:number; + type?:'optional' | 'mandatory' | 'recommended'; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description The number of subscription billing cycles for which this item is attached when applied to a subscription. Applicable only for items of type addon. Requires [addon billing cycles](https://www.chargebee.com/docs/2.0/addons-billingcycle.html) to be enabled for the site. - */ - - offset?:string; - - /** - * @description Filter attached items based on their id. +The value set explicitly for `billing_cycles` while [applying the addon to a subscription](./subscriptions?prod_cat_ver=2#subscription_subscription_items) takes precedence over this parameter. This parameter, in turn, has a higher precedence than [the value set for the addon-item price](./item_prices?prod_cat_ver=2). */ - - id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + + billing_cycles?:number; /** - * @description Filter attached items based on the `item_id` of the item being attached. + * @description The default quantity of the addon to be attached when the quantity is not specified while [creating](subscriptions?prod_cat_ver=2#create_subscription_for_items)/[updating](subscriptions?prod_cat_ver=2#update_subscription_for_items) the subscription. */ - - item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + + quantity?:number; /** - * @description Filter attached items based on the `type` of attached item. Possible values are : `recommended`, `mandatory`, `optional`. + * @description The decimal representation of the quantity of the addon. Returned for quantity-based addons when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. */ - - type?:{in?:string,is?:'optional' | 'mandatory' | 'recommended',is_not?:'optional' | 'mandatory' | 'recommended',not_in?:string}; + + quantity_in_decimal?:string; /** - * @description To filter based on the type of of the attached item. Possible values are : `addon`, `charge`. + * @description Indicates when the item is charged. This parameter only applies to charge-items. \* contract_termination - when a contract term is [terminated](./subscriptions?prod_cat_ver=2#cancel_subscription_for_items_contract_term_cancel_option). \* subscription_creation - the time of creation of the subscription. \* subscription_trial_start - the time when the trial period of the subscription begins. \* on_demand - Item can be charged on demand \* plan_activation - same as subscription activation, but also includes the case when the plan-item of the subscription is changed. \* subscription_activation - the moment a subscription enters an `active` or `non-renewing` state. Also includes reactivations of canceled subscriptions. */ - - item_type?:{in?:string,is?:'charge' | 'addon' | 'plan',is_not?:'charge' | 'addon' | 'plan',not_in?:string}; + + charge_on_event?:ChargeOnEvent; /** - * @description Indicates when the item is charged. This attribute only applies to charge-items. + * @description Indicates if the charge-item is to be charged only once or each time the `charge_on_event` occurs. This parameter only applies to charge-items. */ - - charge_on_event?:{in?:string,is?:'subscription_creation' | 'subscription_activation' | 'subscription_trial_start' | 'contract_termination' | 'plan_activation' | 'on_demand',is_not?:'subscription_creation' | 'subscription_activation' | 'subscription_trial_start' | 'contract_termination' | 'plan_activation' | 'on_demand',not_in?:string}; + + charge_once?:boolean; + } + export interface RetrieveResponse { + attached_item:AttachedItem; + } + export interface RetrieveInputParam { /** - * @description Filter attached items based on when the attached items were last updated. + * @description Retrieves details of an attached addon or a charge item. */ - updated_at?:{after?:string,before?:string,between?:string,on?:string}; + parent_item_id:string; } - export interface CreateResponse { + export interface DeleteResponse { attached_item:AttachedItem; } - export interface CreateInputParam { + export interface DeleteInputParam { /** * @description The id of the addon or charge that is being attached to the plan-item. */ - item_id:string; - + parent_item_id:string; + } + export interface ListResponse { /** - * @description The type of attachment for the addon. Only applicable for addon-items and is a required parameter as well for addon-items. \* recommended - The addon is recommended to go with the plan-item when using [Checkout](https://www.chargebee.com/docs/2.0/configure-inapp.html#fundamental-settings_recommending-addons-in-checkout) or [Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription). \* optional - The addon is neither mandatory, nor recommended. This allows you to attach an addon so you can specify a `quantity` and `billing_cycles` for the addon, for when it is applied to subscriptions with the plan. \* mandatory - The addon is attached automatically to the subscription for the plan-item unless [explicitly removed](./subscriptions?prod_cat_ver=2) via API. + * @description Returns a list of attached items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). */ - type?:'optional' | 'mandatory' | 'recommended'; + list:{attached_item:AttachedItem}[]; /** - * @description The number of subscription billing cycles for which this item is attached when applied to a subscription. Applicable only for items of type addon. Requires [addon billing cycles](https://www.chargebee.com/docs/2.0/addons-billingcycle.html) to be enabled for the site. - -The value set explicitly for `billing_cycles` while [applying the addon to a subscription](./subscriptions?prod_cat_ver=2#subscription_subscription_items) takes precedence over this parameter. This parameter, in turn, has a higher precedence than [the value set for the addon-item price](./item_prices?prod_cat_ver=2). + * @description Returns a list of attached items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). */ - billing_cycles?:number; - + next_offset?:string; + } + export interface ListInputParam { + [key : string]: any; /** - * @description The default quantity of the addon to be attached when the quantity is not specified while [creating](subscriptions?prod_cat_ver=2#create_subscription_for_items)/[updating](subscriptions?prod_cat_ver=2#update_subscription_for_items) the subscription. + * @description Returns a list of attached items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). */ - - quantity?:number; + + limit?:number; /** - * @description The decimal representation of the quantity of the addon. Returned for quantity-based addons when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + * @description Returns a list of attached items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). */ - - quantity_in_decimal?:string; + + offset?:string; /** - * @description Indicates when the item is charged. This parameter only applies to charge-items. \* contract_termination - when a contract term is [terminated](./subscriptions?prod_cat_ver=2#cancel_subscription_for_items_contract_term_cancel_option). \* subscription_creation - the time of creation of the subscription. \* subscription_trial_start - the time when the trial period of the subscription begins. \* on_demand - Item can be charged on demand \* plan_activation - same as subscription activation, but also includes the case when the plan-item of the subscription is changed. \* subscription_activation - the moment a subscription enters an `active` or `non-renewing` state. Also includes reactivations of canceled subscriptions. + * @description Returns a list of attached items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). */ + + id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; - charge_on_event?:ChargeOnEvent; + /** + * @description Returns a list of attached items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). + + */ + + item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Indicates if the charge-item is to be charged only once or each time the `charge_on_event` occurs. This parameter only applies to charge-items. + * @description Returns a list of attached items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). */ + + type?:{in?:string,is?:'optional' | 'mandatory' | 'recommended',is_not?:'optional' | 'mandatory' | 'recommended',not_in?:string}; - charge_once?:boolean; - } - export interface DeleteResponse { - attached_item:AttachedItem; - } - export interface DeleteInputParam { + /** + * @description Returns a list of attached items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). + + */ + + item_type?:{in?:string,is?:'charge' | 'addon' | 'plan',is_not?:'charge' | 'addon' | 'plan',not_in?:string}; /** - * @description The id of the addon or charge that is being attached to the plan-item. + * @description Returns a list of attached items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). */ + + charge_on_event?:{in?:string,is?:'subscription_creation' | 'subscription_activation' | 'subscription_trial_start' | 'contract_termination' | 'plan_activation' | 'on_demand',is_not?:'subscription_creation' | 'subscription_activation' | 'subscription_trial_start' | 'contract_termination' | 'plan_activation' | 'on_demand',not_in?:string}; - parent_item_id:string; + /** + * @description Returns a list of attached items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). + + */ + + updated_at?:{after?:string,before?:string,between?:string,on?:string}; } } diff --git a/types/resources/Card.d.ts b/types/resources/Card.d.ts index eb7af74..9e5eced 100644 --- a/types/resources/Card.d.ts +++ b/types/resources/Card.d.ts @@ -10,14 +10,14 @@ declare module 'chargebee' { payment_source_id:string; /** - * @description Current status of the card. \* valid - A valid and active credit card \* expired - An expired card \* expiring - A card which is expiring in the current month. + * @description Current status of the card. \* valid - A valid and active credit card \* expiring - A card which is expiring in the current month. \* expired - An expired card */ status:'valid' | 'expiring' | 'expired'; /** - * @description Name of the gateway this payment source is stored with. \* bluesnap - BlueSnap is a payment gateway. \* tco - 2Checkout is a payment gateway. \* first_data_global - First Data Global Gateway Virtual Terminal Account \* exact - Exact Payments is a payment gateway. \* bluepay - BluePay is a payment gateway. \* paypal_express_checkout - PayPal Express Checkout is a payment gateway. \* eway - eWAY Account is a payment gateway. \* paypal_payflow_pro - PayPal Payflow Pro is a payment gateway. \* razorpay - Razorpay is a fast growing payment service provider in India working with all leading banks and support for major local payment methods including Netbanking, UPI etc. \* global_payments - Global Payments is a payment service provider. \* amazon_payments - Amazon Payments is a payment service provider. \* not_applicable - Indicates that payment gateway is not applicable for this resource. \* checkout_com - Checkout.com is a payment gateway. \* adyen - Adyen is a payment gateway. \* braintree - Braintree is a payment gateway. \* nmi - NMI is a payment gateway. \* quickbooks - Intuit QuickBooks Payments gateway \* wepay - WePay is a payment gateway. \* worldpay - WorldPay is a payment gateway \* wirecard - WireCard Account is a payment service provider. \* chargebee_payments - Chargebee Payments gateway \* sage_pay - Sage Pay is a payment gateway. \* moneris_us - Moneris USA is a payment gateway. \* pin - Pin is a payment gateway \* authorize_net - Authorize.net is a payment gateway \* elavon - Elavon Virtual Merchant is a payment solution. \* paypal_pro - PayPal Pro Account is a payment gateway. \* orbital - Chase Paymentech(Orbital) is a payment gateway. \* paypal - PayPal Commerce is a payment gateway. \* beanstream - Bambora(formerly known as Beanstream) is a payment gateway. \* hdfc - HDFC Account is a payment gateway. \* ingenico_direct - Worldline Online Payments is a payment gateway. \* ogone - Ingenico ePayments (formerly known as Ogone) is a payment gateway. \* migs - MasterCard Internet Gateway Service payment gateway. \* stripe - Stripe is a payment gateway. \* vantiv - Vantiv is a payment gateway. \* moneris - Moneris is a payment gateway. \* chargebee - Chargebee test gateway. \* eway_rapid - eWAY Rapid is a payment gateway. \* gocardless - GoCardless is a payment service provider. \* mollie - Mollie is a payment gateway. \* paymill - PAYMILL is a payment gateway. \* balanced_payments - Balanced is a payment gateway \* cybersource - CyberSource is a payment gateway. + * @description Name of the gateway this payment source is stored with. \* bluesnap - BlueSnap is a payment gateway. \* tco - 2Checkout is a payment gateway. \* bluepay - BluePay is a payment gateway. \* paypal_express_checkout - PayPal Express Checkout is a payment gateway. \* paypal_payflow_pro - PayPal Payflow Pro is a payment gateway. \* razorpay - Razorpay is a fast growing payment service provider in India working with all leading banks and support for major local payment methods including Netbanking, UPI etc. \* global_payments - Global Payments is a payment service provider. \* not_applicable - Indicates that payment gateway is not applicable for this resource. \* checkout_com - Checkout.com is a payment gateway. \* adyen - Adyen is a payment gateway. \* braintree - Braintree is a payment gateway. \* nmi - NMI is a payment gateway. \* worldpay - WorldPay is a payment gateway \* moneris_us - Moneris USA is a payment gateway. \* pin - Pin is a payment gateway \* authorize_net - Authorize.net is a payment gateway \* stripe - Stripe is a payment gateway. \* moneris - Moneris is a payment gateway. \* chargebee - Chargebee test gateway. \* cybersource - CyberSource is a payment gateway. \* ecentric - Ecentric provides a seamless payment processing service in South Africa specializing on omnichannel capabilities. \* first_data_global - First Data Global Gateway Virtual Terminal Account \* exact - Exact Payments is a payment gateway. \* eway - eWAY Account is a payment gateway. \* metrics_global - Metrics global is a leading payment service provider providing unified payment services in the US. \* amazon_payments - Amazon Payments is a payment service provider. \* windcave - Windcave provides an end to end payment processing solution in ANZ and other leading global markets. \* quickbooks - Intuit QuickBooks Payments gateway \* wepay - WePay is a payment gateway. \* wirecard - WireCard Account is a payment service provider. \* chargebee_payments - Chargebee Payments gateway \* sage_pay - Sage Pay is a payment gateway. \* elavon - Elavon Virtual Merchant is a payment solution. \* paypal_pro - PayPal Pro Account is a payment gateway. \* orbital - Chase Paymentech(Orbital) is a payment gateway. \* paypal - PayPal Commerce is a payment gateway. \* beanstream - Bambora(formerly known as Beanstream) is a payment gateway. \* hdfc - HDFC Account is a payment gateway. \* ingenico_direct - Worldline Online Payments is a payment gateway. \* ogone - Ingenico ePayments (formerly known as Ogone) is a payment gateway. \* migs - MasterCard Internet Gateway Service payment gateway. \* vantiv - Vantiv is a payment gateway. \* bank_of_america - Bank of America Gateway \* eway_rapid - eWAY Rapid is a payment gateway. \* gocardless - GoCardless is a payment service provider. \* mollie - Mollie is a payment gateway. \* paymill - PAYMILL is a payment gateway. \* balanced_payments - Balanced is a payment gateway */ @@ -66,14 +66,14 @@ declare module 'chargebee' { last4:string; /** - * @description Card type \* other - Card belonging to types other than those listed above. \* bancontact - A Bancontact card. \* american_express - An American Express card. \* mastercard - A MasterCard. \* jcb - A JCB card. \* not_applicable - Used for offline entries in transactions. Not applicable for cards \* visa - A Visa card. \* diners_club - A Diner's Club card. \* discover - A Discover card. + * @description Card type \* bancontact - A Bancontact card. \* american_express - An American Express card. \* not_applicable - Used for offline entries in transactions. Not applicable for cards \* diners_club - A Diner's Club card. \* discover - A Discover card. \* other - Card belonging to types other than those listed above. \* mastercard - A MasterCard. \* jcb - A JCB card. \* visa - A Visa card. */ card_type?:'discover' | 'bancontact' | 'other' | 'visa' | 'jcb' | 'diners_club' | 'mastercard' | 'not_applicable' | 'american_express'; /** - * @description Card Funding type \* prepaid - A prepaid card. \* debit - A debit card. \* not_applicable - Used for ACH. Not applicable for cards \* credit - A credit card. \* not_known - An unknown card. + * @description Card Funding type \* credit - A credit card. \* prepaid - A prepaid card. \* debit - A debit card. \* not_applicable - Used for ACH. Not applicable for cards \* not_known - An unknown card. */ @@ -185,7 +185,7 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 ip_address?:string; /** - * @description Card is powered by payment method. \* ideal - ideal \* sofort - sofort \* bancontact - bancontact \* giropay - giropay \* latam_local_card - latam_local_card \* not_applicable - not_applicable \* card - card + * @description Card is powered by payment method. \* card - card \* ideal - ideal \* sofort - sofort \* bancontact - bancontact \* giropay - giropay \* latam_local_card - latam_local_card \* not_applicable - not_applicable */ @@ -207,20 +207,6 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 } export namespace Card { export class CardResource { - /** - * @description #### deprecated - -The [Payment Sources API](/docs/api/payment_sources), with its additional options and improvements, obsoletes the Cards APIs. This request is obsoleted by the [Export payment source API](/docs/api/payment_sources#export_payment_source). - -Copies the customer's card information to another payment gateway. This is useful if you want to port your customer's card details to another gateway. - -**Limitation** -This request does not support copying of cards between Braintree and Stripe payment gateways. Contact [Chargebee Support](https://chargebee.freshdesk.com/support/home) to perform those actions. - - */ - - copy_card_for_customer(customer_id:string, input:CopyCardForCustomerInputParam):ChargebeeRequest; - /** * @description #### Deprecated @@ -235,31 +221,6 @@ Retrieves the credit card for the customer id. /** * @description #### Deprecated -This request is obsoleted by the [Switch gateway account API](/docs/api/payment_sources#switch_gateway_account) for Payment Sources. - -Switches the gateway in which customer's card information is stored. This is applicable only if the payment method is `card`. - -**Limitation** -This request does not support switching between Braintree and Stripe payment gateways. Contact [Chargebee Support](https://chargebee.freshdesk.com/support/home) to perform those actions. - - */ - - switch_gateway_for_customer(customer_id:string, input:SwitchGatewayForCustomerInputParam):ChargebeeRequest; - - /** - * @description #### deprecated - -The [Payment Sources API](/docs/api/payment_sources), with its additional options and improvements, obsoletes the Cards APIs. This request is obsoleted by the [Delete a payment source API](/docs/api/payment_sources#delete_a_payment_source). - -Deletes the card for a customer. Upon successful deletion the `auto_collection` attribute for the customer is set to `off` and a `card_deleted` event is triggered. If there is no card found at the gateway for the customer, this API returns without errors. - - */ - - delete_card_for_customer(customer_id:string):ChargebeeRequest; - - /** - * @description #### Deprecated - The [Payment Sources API](/docs/api/payment_sources), with its additional options and improvements, obsoletes the [Cards APIs](/docs/api/cards). This operation is obsoleted by the following: * [Create using temporary token](/docs/api/payment_sources#create_using_temporary_token) @@ -273,7 +234,7 @@ Passing credit card details to this API involves PCI liability at your end as se * If you are using Stripe gateway, you can use [Stripe.js](https://stripe.com/docs/stripe.js) with your card update form. * If you are using Braintree gateway, you can use [Braintree.js](https://www.braintreepayments.com/docs/javascript) with your card update form. * If you are using Authorize.Net gateway, you use [Accept.js](https://developer.authorize.net/api/reference/features/acceptjs.html) with your card update form. -* In case you are using the Adyen gateway, you will have to use the Adyen's [Client Side Encryption](https://docs.adyen.com/developers/features/client-side-encryption) to encrypt sensitive cardholder data. Once the cardholder data is encrypted, pass the value in adyen.encrypted.data as temp token in this API. +* In case you are using the Adyen gateway, you will have to use the Adyen's [Client Side Encryption](https://docs.adyen.com/online-payments/classic-integrations/api-integration-ecommerce/cse-integration-ecommerce) to encrypt sensitive cardholder data. Once the cardholder data is encrypted, pass the value in adyen.encrypted.data as temp token in this API. * You can also use our [Hosted Pages](https://www.chargebee.com/docs/hosted_pages.html) based integration. Use our [Hosted Page - Update Card](/docs/api/hosted_pages#update_card) API to generate a 'Update Card' Hosted Page link. @@ -286,39 +247,48 @@ Passing credit card details to this API involves PCI liability at your end as se */ update_card_for_customer(customer_id:string, input:UpdateCardForCustomerInputParam):ChargebeeRequest; - } - export interface CopyCardForCustomerResponse { - third_party_payment_method:ThirdPartyPaymentMethod; - } - export interface CopyCardForCustomerInputParam { /** - * @description The gateway account you want to copy the card. + * @description #### Deprecated + +This request is obsoleted by the [Switch gateway account API](/docs/api/payment_sources#switch_gateway_account) for Payment Sources. + +Switches the gateway in which customer's card information is stored. This is applicable only if the payment method is `card`. + +**Limitation** +This request does not support switching between Braintree and Stripe payment gateways. Contact [Chargebee Support](https://chargebee.freshdesk.com/support/home) to perform those actions. */ - - gateway_account_id:string; - } - export interface RetrieveResponse { - card:Card; - } - - export interface SwitchGatewayForCustomerResponse { - customer:Customer; - - card:Card; - } - export interface SwitchGatewayForCustomerInputParam { + + switch_gateway_for_customer(customer_id:string, input:SwitchGatewayForCustomerInputParam):ChargebeeRequest; /** - * @description The gateway account you want to switch to. + * @description #### deprecated + +The [Payment Sources API](/docs/api/payment_sources), with its additional options and improvements, obsoletes the Cards APIs. This request is obsoleted by the [Export payment source API](/docs/api/payment_sources#export_payment_source). + +Copies the customer's card information to another payment gateway. This is useful if you want to port your customer's card details to another gateway. + +**Limitation** +This request does not support copying of cards between Braintree and Stripe payment gateways. Contact [Chargebee Support](https://chargebee.freshdesk.com/support/home) to perform those actions. */ + + copy_card_for_customer(customer_id:string, input:CopyCardForCustomerInputParam):ChargebeeRequest; - gateway_account_id:string; + /** + * @description #### deprecated + +The [Payment Sources API](/docs/api/payment_sources), with its additional options and improvements, obsoletes the Cards APIs. This request is obsoleted by the [Delete a payment source API](/docs/api/payment_sources#delete_a_payment_source). + +Deletes the card for a customer. Upon successful deletion the `auto_collection` attribute for the customer is set to `off` and a `card_deleted` event is triggered. If there is no card found at the gateway for the customer, this API returns without errors. + + */ + + delete_card_for_customer(customer_id:string):ChargebeeRequest; } - export interface DeleteCardForCustomerResponse { - customer:Customer; + export interface RetrieveResponse { + card:Card; } export interface UpdateCardForCustomerResponse { @@ -442,6 +412,36 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 billing_country?:string; } + export interface SwitchGatewayForCustomerResponse { + customer:Customer; + + card:Card; + } + export interface SwitchGatewayForCustomerInputParam { + + /** + * @description The gateway account you want to switch to. + + */ + + gateway_account_id:string; + } + export interface CopyCardForCustomerResponse { + third_party_payment_method:ThirdPartyPaymentMethod; + } + export interface CopyCardForCustomerInputParam { + + /** + * @description The gateway account you want to copy the card. + + */ + + gateway_account_id:string; + } + export interface DeleteCardForCustomerResponse { + customer:Customer; + } + } } \ No newline at end of file diff --git a/types/resources/Comment.d.ts b/types/resources/Comment.d.ts index 968bba4..bff8147 100644 --- a/types/resources/Comment.d.ts +++ b/types/resources/Comment.d.ts @@ -10,7 +10,7 @@ declare module 'chargebee' { id:string; /** - * @description Type of the entity this comment generated for \* item - Entity that represents item \* order - Entity that represents an order \* item_price - Entity that represents item price \* customer - Entity that represents a customer \* invoice - Invoice description \* business_entity - Entity that represents item of type business entity \* plan - Entity that represents a subscription plan \* coupon - Entity that represents a discount coupon \* subscription - Entity that represents a subscription of a customer \* item_family - Entity that represents item family \* transaction - Entity that represents a transaction. \* addon - Entity that represents an addon \* credit_note - Credit note description \* quote - Entity that represents a quote + * @description Type of the entity this comment generated for \* item - Entity that represents item \* invoice - Invoice description \* product - Entity that represents product \* plan - Entity that represents a subscription plan \* item_family - Entity that represents item family \* transaction - Entity that represents a transaction. \* quote - Entity that represents a quote \* order - Entity that represents an order \* item_price - Entity that represents item price \* customer - Entity that represents a customer \* variant - Entity that represents product variants \* business_entity - Entity that represents item of type business entity \* coupon - Entity that represents a discount coupon \* subscription - Entity that represents a subscription of a customer \* addon - Entity that represents an addon \* credit_note - Credit note description */ @@ -38,7 +38,7 @@ declare module 'chargebee' { created_at:number; /** - * @description Type of comment this is. \* user - Comment generated by user either via API or Admin console. \* system - Comment generated by Chargebee when any backend changes happen for an entity + * @description Type of comment this is. \* system - Comment generated by Chargebee when any backend changes happen for an entity \* user - Comment generated by user either via API or Admin console. */ @@ -54,13 +54,11 @@ declare module 'chargebee' { export namespace Comment { export class CommentResource { /** - * @description Delete a comment for an [entity](https://apidocs.chargebee.com/docs/api/v1/comments?prod_cat_ver=1#create_a_comment_entity_type) identified by comment ID. - -Only the comments that are added via Admin console and API can be deleted. Chargebee generated "System" comments cannot be deleted. + * @description Create a new comment for an entity. The newly added comment will be shown in the web interface as well. */ - delete(comment_id:string):ChargebeeRequest; + create(input:CreateInputParam):ChargebeeRequest; /** * @description Retrieve a comment for an entity identified by comment ID. @@ -79,16 +77,47 @@ If you want to retrieve the list of comments for an [entity](https://apidocs.cha list(input?:ListInputParam):ChargebeeRequest; /** - * @description Create a new comment for an entity. The newly added comment will be shown in the web interface as well. + * @description Delete a comment for an [entity](https://apidocs.chargebee.com/docs/api/v1/comments?prod_cat_ver=1#create_a_comment_entity_type) identified by comment ID. + +Only the comments that are added via Admin console and API can be deleted. Chargebee generated "System" comments cannot be deleted. */ - create(input:CreateInputParam):ChargebeeRequest; + delete(comment_id:string):ChargebeeRequest; } - export interface DeleteResponse { + export interface CreateResponse { comment:Comment; } - + export interface CreateInputParam { + + /** + * @description Type of the entity to create the comment for. \* item - Entity that represents item \* order - Entity that represents an order \* item_price - Entity that represents item price \* customer - Entity that represents a customer \* variant - Entity that represents product variants \* invoice - Invoice description \* product - Entity that represents product \* business_entity - Entity that represents item of type business entity \* plan - Entity that represents a subscription plan \* coupon - Entity that represents a discount coupon \* subscription - Entity that represents a subscription of a customer \* item_family - Entity that represents item family \* transaction - Entity that represents a transaction. \* addon - Entity that represents an addon \* credit_note - Credit note description \* quote - Entity that represents a quote + + */ + + entity_type:EntityType; + + /** + * @description Unique identifier of the entity. + + */ + + entity_id:string; + + /** + * @description Actual notes for the comment. + + */ + + notes:string; + + /** + * @description The user who created the comment. If created via API, this contains the name given for the API key used. + + */ + + added_by?:string; + } export interface RetrieveResponse { comment:Comment; } @@ -115,14 +144,18 @@ If you want to retrieve the list of comments for an [entity](https://apidocs.cha export interface ListInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description Retrieve the list of comments sorted by the recent ones on the top. + +If you want to retrieve the list of comments for an [entity](https://apidocs.chargebee.com/docs/api/v1/comments?prod_cat_ver=1#list_comments_entity_type), for example, subscription you can filter them by passing the entity type and unique identifier for that entity, for example, subscription ID. */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Retrieve the list of comments sorted by the recent ones on the top. + +If you want to retrieve the list of comments for an [entity](https://apidocs.chargebee.com/docs/api/v1/comments?prod_cat_ver=1#list_comments_entity_type), for example, subscription you can filter them by passing the entity type and unique identifier for that entity, for example, subscription ID. */ @@ -147,7 +180,9 @@ If you want to retrieve the list of comments for an [entity](https://apidocs.cha entity_id?:string; /** - * @description The time at which this comment was created + * @description Retrieve the list of comments sorted by the recent ones on the top. + +If you want to retrieve the list of comments for an [entity](https://apidocs.chargebee.com/docs/api/v1/comments?prod_cat_ver=1#list_comments_entity_type), for example, subscription you can filter them by passing the entity type and unique identifier for that entity, for example, subscription ID. */ @@ -162,39 +197,10 @@ If you want to retrieve the list of comments for an [entity](https://apidocs.cha sort_by?:{asc?:'created_at',desc?:'created_at'}; } - export interface CreateResponse { + export interface DeleteResponse { comment:Comment; } - export interface CreateInputParam { - - /** - * @description Type of the entity to create the comment for. \* item - Entity that represents item \* order - Entity that represents an order \* item_price - Entity that represents item price \* customer - Entity that represents a customer \* invoice - Invoice description \* business_entity - Entity that represents item of type business entity \* plan - Entity that represents a subscription plan \* coupon - Entity that represents a discount coupon \* subscription - Entity that represents a subscription of a customer \* item_family - Entity that represents item family \* transaction - Entity that represents a transaction. \* addon - Entity that represents an addon \* credit_note - Credit note description \* quote - Entity that represents a quote - - */ - - entity_type:EntityType; - - /** - * @description Unique identifier of the entity. - - */ - - entity_id:string; - - /** - * @description Actual notes for the comment. - - */ - - notes:string; - - /** - * @description The user who created the comment. If created via API, this contains the name given for the API key used. - - */ - - added_by?:string; - } + } } \ No newline at end of file diff --git a/types/resources/Coupon.d.ts b/types/resources/Coupon.d.ts index f87e19e..1a35cec 100644 --- a/types/resources/Coupon.d.ts +++ b/types/resources/Coupon.d.ts @@ -1,7 +1,7 @@ /// declare module 'chargebee' { export interface Coupon { - + [key : string] : any; /** * @description Used to uniquely identify the coupon in your website/application and to integrate with Chargebee. **Note:** @@ -181,11 +181,11 @@ Note that this does not change when the [redemptions](/docs/api/coupons?#coupon_ export namespace Coupon { export class CouponResource { /** - * @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. + * @description This API creates a new coupon for a specific promotion or offers. */ - list(input?:ListInputParam):ChargebeeRequest; + create_for_items(input:CreateForItemsInputParam):ChargebeeRequest; /** * @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_ update_for_items(coupon_id:string, input?:UpdateForItemsInputParam):ChargebeeRequest; /** - * @description This API unarchives a specific coupon using the coupon ID. + * @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. */ - unarchive(coupon_id:string):ChargebeeRequest; + list(input?:ListInputParam):ChargebeeRequest; + + /** + * @description This API retrieves a specific coupon using the coupon ID. + + */ + + retrieve(coupon_id:string):ChargebeeRequest; /** * @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=2#coupon_redemptions) is copy(input:CopyInputParam):ChargebeeRequest; /** - * @description This API retrieves a specific coupon using the coupon ID. + * @description This API unarchives a specific coupon using the coupon ID. */ - retrieve(coupon_id:string):ChargebeeRequest; - + unarchive(coupon_id:string):ChargebeeRequest; + } + export interface CreateForItemsResponse { + coupon:Coupon; + } + export interface CreateForItemsInputParam { + [key : string] : any; /** - * @description This API creates a new coupon for a specific promotion or offers. + * @description Used to uniquely identify the coupon in your website/application and to integrate with Chargebee. +**Note:** + + +When the coupon ID contains a special character; for example: `#`, the API returns an error. +Make sure that you [encode](https://www.urlencoder.org/) the coupon ID in the path parameter before making an API call. +. */ - - create_for_items(input:CreateForItemsInputParam):ChargebeeRequest; - } - export interface ListResponse { + + id:string; + /** - * @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. + * @description The display name used in web interface for identifying the coupon. +**Note:** + + +When the name of the coupon set contains a special character; for example: `#`, the API returns an error. +Make sure that you [encode](https://www.urlencoder.org/) the name of the coupon set in the path parameter before making an API call. +. */ - list:{coupon:Coupon}[]; + name:string; /** - * @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. + * @description Display name used in invoice. If it is not configured then name is used in invoice. */ - next_offset?:string; - } - export interface ListInputParam { - [key : string]: any; + invoice_name?:string; + /** - * @description The number of resources to be returned. + * @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. */ - - limit?:number; + + discount_type?:'fixed_amount' | 'percentage'; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description The value of the deduction. The format of this value depends on the [kind of currency](/docs/api#currencies). */ - - offset?:string; + + discount_amount?:number; /** - * @description Used to uniquely identify the coupon in your website/application and to integrate with Chargebee. -**Note:** + * @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. + */ + + currency_code?:string; + + /** + * @description The percentage of the original amount that should be deducted from it. -When the coupon ID contains a special character; for example: `#`, the API returns an error. -Make sure that you [encode](https://www.urlencoder.org/) the coupon ID in the path parameter before making an API call. + */ + + discount_percentage?:number; + + /** + * @description The amount on the invoice to which the coupon is applied. \* invoice_amount - The coupon is applied to the invoice `sub_total`. \* each_unit_of_specified_items - Discount will be applied to each unit of plan and addon items specified. \* each_specified_item - The coupon is applied to the `invoice.line_item.amount` that corresponds to the item price specified by `item_price_id`. \* specified_items_total - Discount will be applied to the total of plan and addon items specified. */ - - id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + + apply_on:'invoice_amount' | 'each_specified_item'; /** - * @description The display name used in web interface for identifying the coupon. -**Note:** + * @description Specifies the time duration for which this coupon is attached to the subscription. \* forever - The coupon is attached to the subscription and applied on the invoices until explicitly removed. \* one_time - The coupon stays attached to the subscription till it is applied on an invoice **once** . It is removed after that from the subscription. \* limited_period - The discount is attached to the subscription and applied on the invoices for a limited duration. This duration starts from the point it is applied to an invoice for the first time and expires after a period specified by `period` and `period_unit`. + */ + + duration_type?:'limited_period' | 'one_time' | 'forever'; + + /** + * @description **(Deprecated)** The duration of time in months for which the coupon is attached to the subscription. Applicable only when `duration_type` is `limited_period`. +**Note:** This parameter has been deprecated. Use `period` and `period_unit` instead. -When the name of the coupon set contains a special character; for example: `#`, the API returns an error. -Make sure that you [encode](https://www.urlencoder.org/) the name of the coupon set in the path parameter before making an API call. + */ + + duration_month?:number; + + /** + * @description Date upto which the coupon can be applied to new subscriptions. */ - - name?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + + valid_till?:number; /** - * @description The type of deduction + * @description Maximum number of times this coupon can be redeemed. +**Note:** + + +If not specified, the coupon can be redeemed an indefinite number of times. +. */ - - discount_type?:{in?:string,is?:'fixed_amount' | 'percentage',is_not?:'fixed_amount' | 'percentage',not_in?:string}; + + max_redemptions?:number; /** - * @description Specifies the time duration for which this coupon is attached to the subscription. + * @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. */ - - duration_type?:{in?:string,is?:'limited_period' | 'one_time' | 'forever',is_not?:'limited_period' | 'one_time' | 'forever',not_in?:string}; + + invoice_notes?:string; /** - * @description Status of the coupon. + * @description A collection of key-value pairs that provides extra information about the coupon. +**Note:** There's a character limit of 65,535. +[Learn more](advanced-features?prod_cat_ver=2#metadata). */ - - status?:{in?:string,is?:'archived' | 'expired' | 'deleted' | 'active',is_not?:'archived' | 'expired' | 'deleted' | 'active',not_in?:string}; + + meta_data?:object; /** - * @description The amount on the invoice to which the coupon is applied. + * @description The coupon is included in MRR calculations for your site. This attribute is only applicable for coupons of `duration_type = one_time` and when the feature is enabled in Chargebee. Note: If the site-level setting is to exclude one-time coupons from MRR calculations, this value is always returned `false`. */ - - apply_on?:{in?:string,is?:'invoice_amount' | 'each_specified_item',is_not?:'invoice_amount' | 'each_specified_item',not_in?:string}; + + included_in_mrr?:boolean; /** - * @description Timestamp indicating when this coupon is created. + * @description The duration of time for which the coupon is attached to the subscription, in `period_units`. Applicable only when [duration_type](/docs/api/coupons?#coupon_duration_type) is [limited_period](/docs/api/coupons?#coupon_duration_type). */ - - created_at?:{after?:string,before?:string,between?:string,on?:string}; + + period?:number; /** - * @description To filter based on updated at. This attribute will be present only if the resource has been updated after 2016-11-09. + * @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. */ - - updated_at?:{after?:string,before?:string,between?:string,on?:string}; + + period_unit?:PeriodUnit; /** - * @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. + * @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. */ - - sort_by?:{asc?:'created_at',desc?:'created_at'}; + + status?:'archived' | 'active'; /** - * @description The currency code ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html)) of the coupon. Applicable for *fixed_amount* coupons alone. + * @description Parameters for item_constraints */ - - currency_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + + item_constraints?:{constraint:'all' | 'criteria' | 'none' | 'specific',item_price_ids?:any[],item_type:'charge' | 'addon' | 'plan'}[]; /** - * @description Parameters for addon + * @description Parameters for item_constraint_criteria */ - - addon?:{}; + + item_constraint_criteria?:{currencies?:any[],item_family_ids?:any[],item_price_periods?:any[],item_type?:'charge' | 'addon' | 'plan'}[]; /** - * @description Parameters for plan + * @description Parameters for `coupon_constraints`. Multiple `coupon_constraints` can be passed by specifying unique indices. */ - - plan?:{}; + + coupon_constraints?:{entity_type:'customer',type:'max_redemptions' | 'unique_by',value?:string}[]; } export interface UpdateForItemsResponse { coupon:Coupon; } export interface UpdateForItemsInputParam { - + [key : string] : any; /** * @description The display name used in web interface for identifying the coupon. **Note:** @@ -463,7 +510,9 @@ If not specified, the coupon can be redeemed an indefinite number of times. invoice_notes?:string; /** - * @description A set of key-value pairs stored as additional information for the coupon. [Learn more](./#meta_data). + * @description A collection of key-value pairs that provides extra information about the coupon. +**Note:** There's a character limit of 65,535. +[Learn more](advanced-features?prod_cat_ver=2#metadata). */ @@ -511,243 +560,229 @@ If not specified, the coupon can be redeemed an indefinite number of times. coupon_constraints?:{entity_type:'customer',type:'max_redemptions' | 'unique_by',value?:string}[]; } - export interface UnarchiveResponse { - coupon:Coupon; - } - - export interface DeleteResponse { - coupon:Coupon; - } - - export interface CopyResponse { - coupon:Coupon; - } - export interface CopyInputParam { - + export interface ListResponse { /** - * @description Your Chargebee site name having the coupon to be copied. -**Note:** Unless you are copying from a twin site (acme \& acme-test are twin sites), [contact support](https://chargebee.freshdesk.com/support/home) to have this allow-listed. + * @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. */ - from_site:string; + list:{coupon:Coupon}[]; /** - * @description Id of the coupon to be copied. The new coupon created in this site will have the same Id. + * @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. */ - id_at_from_site:string; - + next_offset?:string; + } + export interface ListInputParam { + [key : string]: any; /** - * @description Id of copied coupon in this site. + * @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. */ - - id?:string; + + limit?:number; /** - * @description If copy action is performed as part of Chargebee site merge action, pass the value as true. -**Note:** If this parameter is passed true coupon state, redemptions, coupon set and coupon codes associated with this coupon will be copied. + * @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. */ - - for_site_merging?:boolean; - } - export interface RetrieveResponse { - coupon:Coupon; - } - - export interface CreateForItemsResponse { - coupon:Coupon; - } - export interface CreateForItemsInputParam { + + offset?:string; /** - * @description Used to uniquely identify the coupon in your website/application and to integrate with Chargebee. -**Note:** - - -When the coupon ID contains a special character; for example: `#`, the API returns an error. -Make sure that you [encode](https://www.urlencoder.org/) the coupon ID in the path parameter before making an API call. -. + * @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. */ - - id:string; + + id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description The display name used in web interface for identifying the coupon. -**Note:** - - -When the name of the coupon set contains a special character; for example: `#`, the API returns an error. -Make sure that you [encode](https://www.urlencoder.org/) the name of the coupon set in the path parameter before making an API call. -. + * @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. */ - - name:string; + + name?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Display name used in invoice. If it is not configured then name is used in invoice. + * @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. */ - - invoice_name?:string; + + discount_type?:{in?:string,is?:'fixed_amount' | 'percentage',is_not?:'fixed_amount' | 'percentage',not_in?:string}; /** - * @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. + * @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. */ - - discount_type:'fixed_amount' | 'percentage'; + + duration_type?:{in?:string,is?:'limited_period' | 'one_time' | 'forever',is_not?:'limited_period' | 'one_time' | 'forever',not_in?:string}; /** - * @description The value of the deduction. The format of this value depends on the [kind of currency](/docs/api#currencies). + * @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. */ - - discount_amount?:number; + + status?:{in?:string,is?:'archived' | 'expired' | 'deleted' | 'active',is_not?:'archived' | 'expired' | 'deleted' | 'active',not_in?:string}; /** - * @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. + * @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. */ - - currency_code?:string; + + apply_on?:{in?:string,is?:'invoice_amount' | 'each_specified_item',is_not?:'invoice_amount' | 'each_specified_item',not_in?:string}; /** - * @description The percentage of the original amount that should be deducted from it. + * @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. */ - - discount_percentage?:number; + + created_at?:{after?:string,before?:string,between?:string,on?:string}; /** - * @description The amount on the invoice to which the coupon is applied. \* invoice_amount - The coupon is applied to the invoice `sub_total`. \* each_unit_of_specified_items - Discount will be applied to each unit of plan and addon items specified. \* each_specified_item - The coupon is applied to the `invoice.line_item.amount` that corresponds to the item price specified by `item_price_id`. \* specified_items_total - Discount will be applied to the total of plan and addon items specified. + * @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. */ - - apply_on:'invoice_amount' | 'each_specified_item'; + + updated_at?:{after?:string,before?:string,between?:string,on?:string}; /** - * @description Specifies the time duration for which this coupon is attached to the subscription. \* forever - The coupon is attached to the subscription and applied on the invoices until explicitly removed. \* one_time - The coupon stays attached to the subscription till it is applied on an invoice **once** . It is removed after that from the subscription. \* limited_period - The discount is attached to the subscription and applied on the invoices for a limited duration. This duration starts from the point it is applied to an invoice for the first time and expires after a period specified by `period` and `period_unit`. + * @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. */ - - duration_type:'limited_period' | 'one_time' | 'forever'; + + sort_by?:{asc?:'created_at',desc?:'created_at'}; /** - * @description **(Deprecated)** The duration of time in months for which the coupon is attached to the subscription. Applicable only when `duration_type` is `limited_period`. -**Note:** This parameter has been deprecated. Use `period` and `period_unit` instead. + * @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. */ - - duration_month?:number; + + currency_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + } + export interface RetrieveResponse { + coupon:Coupon; + } + + export interface DeleteResponse { + coupon:Coupon; + } + + export interface CopyResponse { + coupon:Coupon; + } + export interface CopyInputParam { /** - * @description Date upto which the coupon can be applied to new subscriptions. + * @description Your Chargebee site name having the coupon to be copied. +**Note:** Unless you are copying from a twin site (acme \& acme-test are twin sites), [contact support](https://chargebee.freshdesk.com/support/home) to have this allow-listed. */ - valid_till?:number; + from_site:string; /** - * @description Maximum number of times this coupon can be redeemed. -**Note:** - - -If not specified, the coupon can be redeemed an indefinite number of times. -. + * @description Id of the coupon to be copied. The new coupon created in this site will have the same Id. */ - max_redemptions?:number; + id_at_from_site:string; /** - * @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. + * @description Id of copied coupon in this site. */ - invoice_notes?:string; + id?:string; /** - * @description A set of key-value pairs stored as additional information for the coupon. [Learn more](./#meta_data). + * @description If copy action is performed as part of Chargebee site merge action, pass the value as true. +**Note:** If this parameter is passed true coupon state, redemptions, coupon set and coupon codes associated with this coupon will be copied. */ - meta_data?:object; - - /** - * @description The coupon is included in MRR calculations for your site. This attribute is only applicable for coupons of `duration_type = one_time` and when the feature is enabled in Chargebee. Note: If the site-level setting is to exclude one-time coupons from MRR calculations, this value is always returned `false`. + for_site_merging?:boolean; + } + export interface UnarchiveResponse { + coupon:Coupon; + } + + export interface ItemConstraint { + /** + * @description Item type for which this criteria is applicable for. \* charge - Charge \* plan - Plan \* addon - Addon - */ + */ - included_in_mrr?:boolean; + item_type:'charge' | 'addon' | 'plan'; - /** - * @description The duration of time for which the coupon is attached to the subscription, in `period_units`. Applicable only when [duration_type](/docs/api/coupons?#coupon_duration_type) is [limited_period](/docs/api/coupons?#coupon_duration_type). + /** + * @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. - */ + */ - period?:number; + constraint:'all' | 'criteria' | 'none' | 'specific'; - /** - * @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. + /** + * @description List of item price ids for which this coupon is applicable. - */ - - period_unit?:PeriodUnit; + */ - /** - * @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. + item_price_ids?:any[]; + } + export interface ItemConstraintCriteria { + /** + * @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 - */ + */ - status?:'archived' | 'active'; + item_type:'charge' | 'addon' | 'plan'; - /** - * @description Parameters for item_constraints + /** + * @description List of currencies ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html)) for which this coupon is applicable. - */ + */ - item_constraints?:{constraint:'all' | 'criteria' | 'none' | 'specific',item_price_ids?:any[],item_type:'charge' | 'addon' | 'plan'}[]; + currencies?:any[]; - /** - * @description Parameters for item_constraint_criteria + /** + * @description List of families for which this coupon is applicable. - */ + */ - item_constraint_criteria?:{currencies?:any[],item_family_ids?:any[],item_price_periods?:any[],item_type?:'charge' | 'addon' | 'plan'}[]; + item_family_ids?:any[]; - /** - * @description Parameters for `coupon_constraints`. Multiple `coupon_constraints` can be passed by specifying unique indices. + /** + * @description List of frequencies for which this coupon is applicable. Allowed frequencies are \[day, week, month, year\]. - */ - - coupon_constraints?:{entity_type:'customer',type:'max_redemptions' | 'unique_by',value?:string}[]; - } - export interface ItemConstraint { - item_type?:'charge' | 'addon' | 'plan'; - - constraint?:'all' | 'criteria' | 'none' | 'specific'; + */ - item_price_ids?:any[]; + item_price_periods?:any[]; } - export interface ItemConstraintCriteria { - item_type?:'charge' | 'addon' | 'plan'; + export interface CouponConstraint { + /** + * @description The resource type for the constraint. This, along with `type` and `value`, helps define the specific rule applied. \* customer - The constraint is based on `customer` records. + + */ - currencies?:any[]; + entity_type:'customer'; - item_family_ids?:any[]; + /** + * @description Type of coupon constraints \* unique_by - Indicates - when `entity_type` is `customer` - that the coupon can be redeemed only once for every unique value of a specified `customer` attribute. The `customer` attribute is specified using `value`. For example, if `value` is `email`, then the coupon can be redeemed only once for every unique value of `customer.email`. In other words, when there are multiple `customer` records with the same value for `email`, once the coupon has been redeemed for one of those customer records, no further redemptions of the coupon are allowed for any of those `customer` records. \* max_redemptions - The coupon can be redeemed up to a set number of times for a specific resource type. The maximum redemptions are specified using `value`, and the resource type is specified using `entity_type`. For example, if `entity_type` is `customer` and `value` is `10` then the coupon can only be redeemed up to 10 times for any particular `customer` record. + + */ - item_price_periods?:any[]; - } - export interface CouponConstraint { - entity_type?:'customer'; + type:'max_redemptions' | 'unique_by'; - type?:'max_redemptions' | 'unique_by'; + /** + * @description The value of the coupon constraint. The possible values depend on the value of `constraints[type]`: + +* When `type` is `unique_by`, then `value` can be `email` or `id`. + +* When `type` is `max_redemptions`, then `value` can be any integer in the range `1` `coupon.max_redemptions`, inclusive. + + + */ value?:string; } diff --git a/types/resources/CouponSet.d.ts b/types/resources/CouponSet.d.ts index b841331..53ee928 100644 --- a/types/resources/CouponSet.d.ts +++ b/types/resources/CouponSet.d.ts @@ -47,25 +47,25 @@ declare module 'chargebee' { export namespace CouponSet { export class CouponSetResource { /** - * @description Use this API to get the list of all the coupon sets. + * @description Create a coupon set with a coupon code compatible to your product offers and promotional discounts */ - list(input?:ListInputParam):ChargebeeRequest; + create(input:CreateInputParam):ChargebeeRequest; /** - * @description Create a coupon set with a coupon code compatible to your product offers and promotional discounts + * @description This API add coupon codes to an existing coupon set. */ - create(input:CreateInputParam):ChargebeeRequest; + add_coupon_codes(coupon_set_id:string, input?:AddCouponCodesInputParam):ChargebeeRequest; /** - * @description Use this API to update a specific coupon set by updating its `name` and the `meta_data`. + * @description Use this API to get the list of all the coupon sets. */ - update(coupon_set_id:string, input?:UpdateInputParam):ChargebeeRequest; + list(input?:ListInputParam):ChargebeeRequest; /** * @description Use this API to retrieve a specific coupon set. @@ -75,11 +75,18 @@ declare module 'chargebee' { retrieve(coupon_set_id:string):ChargebeeRequest; /** - * @description This API add coupon codes to an existing coupon set. + * @description Use this API to update a specific coupon set by updating its `name` and the `meta_data`. */ - add_coupon_codes(coupon_set_id:string, input?:AddCouponCodesInputParam):ChargebeeRequest; + update(coupon_set_id:string, input?:UpdateInputParam):ChargebeeRequest; + + /** + * @description Use this endpoint to delete a specific coupon set + + */ + + delete(coupon_set_id:string):ChargebeeRequest; /** * @description Use this API to delete all the unutilised coupon codes from a specific coupon set. @@ -87,13 +94,53 @@ declare module 'chargebee' { */ delete_unused_coupon_codes(coupon_set_id:string):ChargebeeRequest; + } + export interface CreateResponse { + coupon_set:CouponSet; + } + export interface CreateInputParam { /** - * @description Use this endpoint to delete a specific coupon set + * @description Coupon id linked to coupon set. */ - - delete(coupon_set_id:string):ChargebeeRequest; + + coupon_id:string; + + /** + * @description Name of the coupon set. + + */ + + name:string; + + /** + * @description Uniquely identifies a coupon_set. + + */ + + id:string; + + /** + * @description A collection of key-value pairs that provides extra information about the coupon set. +**Note:** There's a character limit of 65,535. +[Learn more](advanced-features?prod_cat_ver=2#metadata). + + */ + + meta_data?:object; + } + export interface AddCouponCodesResponse { + coupon_set:CouponSet; + } + export interface AddCouponCodesInputParam { + + /** + * @description You can pass up to 100 values per API call. You can also use the Chargebee UI to pass up to 1000 codes per operation. There is no limit on the total number of coupon codes that can be included in a coupon set. + + */ + + code?:string[]; } export interface ListResponse { /** @@ -113,94 +160,65 @@ declare module 'chargebee' { export interface ListInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description Use this API to get the list of all the coupon sets. */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Use this API to get the list of all the coupon sets. */ offset?:string; /** - * @description Uniquely identifies a coupon_set + * @description Use this API to get the list of all the coupon sets. */ id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Name of the coupon set + * @description Use this API to get the list of all the coupon sets. */ name?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Coupon id linked to coupon set + * @description Use this API to get the list of all the coupon sets. */ coupon_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description No of coupon codes present in coupon set + * @description Use this API to get the list of all the coupon sets. */ total_count?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; /** - * @description No of redeemed codes + * @description Use this API to get the list of all the coupon sets. */ redeemed_count?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; /** - * @description No of archived codes + * @description Use this API to get the list of all the coupon sets. */ archived_count?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; } - export interface CreateResponse { + export interface RetrieveResponse { coupon_set:CouponSet; } - export interface CreateInputParam { - - /** - * @description Coupon id linked to coupon set. - - */ - - coupon_id:string; - - /** - * @description Name of the coupon set. - - */ - - name:string; - - /** - * @description Uniquely identifies a coupon_set. - - */ - - id:string; - - /** - * @description A set of key-value pairs stored as additional information for the coupon set. [Learn more](./#meta_data). - - */ - - meta_data?:object; - } + export interface UpdateResponse { coupon_set:CouponSet; } @@ -214,36 +232,22 @@ declare module 'chargebee' { name?:string; /** - * @description A set of key-value pairs stored as additional information for the coupon set. [Learn more](./#meta_data). + * @description A collection of key-value pairs that provides extra information about the coupon set. +**Note:** There's a character limit of 65,535. +[Learn more](advanced-features?prod_cat_ver=2#metadata). */ meta_data?:object; } - export interface RetrieveResponse { + export interface DeleteResponse { coupon_set:CouponSet; } - export interface AddCouponCodesResponse { - coupon_set:CouponSet; - } - export interface AddCouponCodesInputParam { - - /** - * @description You can pass up to 100 values per API call. You can also use the Chargebee UI to pass up to 1000 codes per operation. There is no limit on the total number of coupon codes that can be included in a coupon set. - - */ - - code?:string[]; - } export interface DeleteUnusedCouponCodesResponse { coupon_set:CouponSet; } - export interface DeleteResponse { - coupon_set:CouponSet; - } - } } \ No newline at end of file diff --git a/types/resources/CreditNote.d.ts b/types/resources/CreditNote.d.ts index 8e354a6..9a6976a 100644 --- a/types/resources/CreditNote.d.ts +++ b/types/resources/CreditNote.d.ts @@ -329,83 +329,76 @@ Ireland** . The first two characters of the VAT number in such a case is `X export namespace CreditNote { export class CreditNoteResource { /** - * @description Use this API to [void a credit note.](https://www.chargebee.com/docs/credit-notes.html#voiding-or-deleting-a-credit-note) A voided credit is a null entity and cannot be used again. A credit note which has already been voided or refunded cannot be voided. An error message will be displayed when you render such credit notes void. + * @description Creates a `credit_note` for the specified invoice. +**Note:** -**Note:** When adjustment credit notes are voided, the associated invoice will reflect as NOT PAID, and the amount in the invoice will be recalculated to reflect the amount after considering the voided credit note. +If the `credit_note` [type](/docs/api/credit_notes#create_credit_note_type) is `refundable`, then `linked_taxes_withheld.amount` for the [invoice specified](/docs/api/credit_notes#create_credit_note_reference_invoice_id) can also be included in the [total](/docs/api/credit_notes#create_credit_note_total). */ - void_credit_note(credit_note_id:string, input?:VoidCreditNoteInputParam):ChargebeeRequest; + create(input:CreateInputParam):ChargebeeRequest; /** - * @description Refunds a ([refundable](https://www.chargebee.com/docs/credit-notes.html#types-of-credit-notes_refundable-credit-note)) credit note to the [payment source](/docs/api/payment_sources) associated with the [transaction](/docs/api/transactions). Any [linked_tax_withheld_refunds](/docs/api/credit_notes#credit_note_linked_tax_withheld_refunds) recorded against the credit note are not refunded. + * @description Retrieves the Credit Note identified by the specified Credit Note number. */ - refund(credit_note_id:string, input?:RefundInputParam):ChargebeeRequest; + retrieve(credit_note_id:string):ChargebeeRequest; /** - * @description Lists all the Credit Notes. + * @description Gets the credit note as PDF. The returned URL is secure and allows download. The URL will expire in 60 minutes. */ - list(input?:ListInputParam):ChargebeeRequest; + pdf(credit_note_id:string, input?:PdfInputParam):ChargebeeRequest; /** - * @description Creates a `credit_note` for the specified invoice. -**Note:** - -If the `credit_note` [type](/docs/api/credit_notes#create_credit_note_type) is `refundable`, then `linked_taxes_withheld.amount` for the [invoice specified](/docs/api/credit_notes#create_credit_note_reference_invoice_id) can also be included in the [total](/docs/api/credit_notes#create_credit_note_total). + * @description Download the e-invoice for the credit note in both XML and PDF formats. The response consists of a `download` object for each format. The XML format follows the [structure as per Peppol BIS Billing v3.0](https://docs.peppol.eu/poacc/billing/3.0/syntax/ubl-creditnote/tree/). +**Note** - */ - - create(input:CreateInputParam):ChargebeeRequest; - - /** - * @description Refunds a ([refundable](https://www.chargebee.com/docs/credit-notes.html#types-of-credit-notes_refundable-credit-note)) credit note. The refund is provided against `linked_payments` first and then against any `linked_taxes_withheld` for the [invoice](/docs/api/credit_notes#credit_note_reference_invoice_id) associated with the `credit_note`. For payments made via online transactions, the refund request is processed via the [payment source](/docs/api/payment_sources) associated with the [transaction](/docs/api/transactions). +* You can only download e-invoices when their `status` is `success` or `registered`. +* There are some cases in which the PDF is not available for download. In such cases, you can obtain it from the XML by decoding the value for [cbc:EmbeddedDocumentBinaryObject](https://docs.peppol.eu/poacc/billing/3.0/syntax/ubl-creditnote/cac-AdditionalDocumentReference/cac-Attachment/cbc-EmbeddedDocumentBinaryObject/), which is the Base64-encoded version of the PDF. */ - record_refund(credit_note_id:string, input?:RecordRefundInputParam):ChargebeeRequest; + download_einvoice(credit_note_id:string):ChargebeeRequest; /** - * @description Use this api to import credit notes into your Chargebee site. Billing address, Shipping Address, Vat number will be copied from the reference invoice. + * @description Refunds a ([refundable](https://www.chargebee.com/docs/credit-notes.html#types-of-credit-notes_refundable-credit-note)) credit note to the [payment source](/docs/api/payment_sources) associated with the [transaction](/docs/api/transactions). Any [linked_tax_withheld_refunds](/docs/api/credit_notes#credit_note_linked_tax_withheld_refunds) recorded against the credit note are not refunded. */ - import_credit_note(input:ImportCreditNoteInputParam):ChargebeeRequest; + refund(credit_note_id:string, input?:RefundInputParam):ChargebeeRequest; /** - * @description This API [deletes a credit note.](https://www.chargebee.com/docs/credit-notes.html#voiding-or-deleting-a-credit-note) A credit note once deleted, is deleted permanently. You cannot delete a credit which has already been deleted or refunded. If you try to delete a refunded or deleted credit note, an error message will be displayed. + * @description Refunds a ([refundable](https://www.chargebee.com/docs/credit-notes.html#types-of-credit-notes_refundable-credit-note)) credit note. The refund is provided against `linked_payments` first and then against any `linked_taxes_withheld` for the [invoice](/docs/api/credit_notes#credit_note_reference_invoice_id) associated with the `credit_note`. For payments made via online transactions, the refund request is processed via the [payment source](/docs/api/payment_sources) associated with the [transaction](/docs/api/transactions). */ - delete(credit_note_id:string, input?:DeleteInputParam):ChargebeeRequest; + record_refund(credit_note_id:string, input?:RecordRefundInputParam):ChargebeeRequest; /** - * @description Download the e-invoice for the credit note in both XML and PDF formats. The response consists of a `download` object for each format. The XML format follows the [structure as per Peppol BIS Billing v3.0](https://docs.peppol.eu/poacc/billing/3.0/syntax/ubl-creditnote/tree/). -**Note** + * @description Use this API to [void a credit note.](https://www.chargebee.com/docs/credit-notes.html#voiding-or-deleting-a-credit-note) A voided credit is a null entity and cannot be used again. A credit note which has already been voided or refunded cannot be voided. An error message will be displayed when you render such credit notes void. -* You can only download e-invoices when their `status` is `success` or `registered`. -* There are some cases in which the PDF is not available for download. In such cases, you can obtain it from the XML by decoding the value for [cbc:EmbeddedDocumentBinaryObject](https://docs.peppol.eu/poacc/billing/3.0/syntax/ubl-creditnote/cac-AdditionalDocumentReference/cac-Attachment/cbc-EmbeddedDocumentBinaryObject/), which is the Base64-encoded version of the PDF. +**Note:** When adjustment credit notes are voided, the associated invoice will reflect as NOT PAID, and the amount in the invoice will be recalculated to reflect the amount after considering the voided credit note. */ - download_einvoice(credit_note_id:string):ChargebeeRequest; + void_credit_note(credit_note_id:string, input?:VoidCreditNoteInputParam):ChargebeeRequest; /** - * @description Gets the credit note as PDF. The returned URL is secure and allows download. The URL will expire in 60 minutes. + * @description Lists all the Credit Notes. */ - pdf(credit_note_id:string, input?:PdfInputParam):ChargebeeRequest; + list(input?:ListInputParam):ChargebeeRequest; /** - * @description Resend failed einvoice in credit notes. + * @description This API [deletes a credit note.](https://www.chargebee.com/docs/credit-notes.html#voiding-or-deleting-a-credit-note) A credit note once deleted, is deleted permanently. You cannot delete a credit which has already been deleted or refunded. If you try to delete a refunded or deleted credit note, an error message will be displayed. */ - resend_einvoice(credit_note_id:string):ChargebeeRequest; + delete(credit_note_id:string, input?:DeleteInputParam):ChargebeeRequest; /** * @description Removes a [linked_tax_withheld_refunds](/docs/api/credit_notes#credit_note_linked_tax_withheld_refunds) record from the `credit_note`. @@ -415,11 +408,11 @@ If the `credit_note` [type](/docs/api/credit_notes#create_credit_note_ remove_tax_withheld_refund(credit_note_id:string, input?:RemoveTaxWithheldRefundInputParam):ChargebeeRequest; /** - * @description Retrieves the Credit Note identified by the specified Credit Note number. + * @description Resend failed einvoice in credit notes. */ - retrieve(credit_note_id:string):ChargebeeRequest; + resend_einvoice(credit_note_id:string):ChargebeeRequest; /** * @description This endpoint is used to send an e-invoice for invoice. @@ -442,19 +435,104 @@ This endpoint schedules e-invoices manually. This operation is not allowed when */ send_einvoice(credit_note_id:string):ChargebeeRequest; + + /** + * @description Use this api to import credit notes into your Chargebee site. Billing address, Shipping Address, Vat number will be copied from the reference invoice. + + */ + + import_credit_note(input:ImportCreditNoteInputParam):ChargebeeRequest; } - export interface VoidCreditNoteResponse { + export interface CreateResponse { credit_note:CreditNote; + + invoice:Invoice; } - export interface VoidCreditNoteInputParam { + export interface CreateInputParam { /** - * @description Reason for voiding credit note. This comment will be added to the credit note. + * @description The identifier of the invoice against which this Credit Note is issued. + + */ + + reference_invoice_id:string; + + /** + * @description Credit Note amount in cents. You can either pass the total parameter or the line_items parameter. Passing both will result in an error. + + */ + + total?:number; + + /** + * @description The credit note type. \* refundable - Refundable Credit Note \* adjustment - Adjustment Credit Note + + */ + + type:'adjustment' | 'refundable'; + + /** + * @description The reason for issuing this Credit Note. The following reason codes are supported now\[Deprecated; use the [create_reason_code](/docs/api/credit_notes#credit_note_create_reason_code) parameter instead\]. \* chargeback - Can be set when you are recording your customer Chargebacks \* subscription_change - This reason will be set automatically for Credit Notes created during Change Subscription operation when [proration](https://www.chargebee.com/docs/proration.html) is enabled \* waiver - Waiver \* order_cancellation - Order Cancellation \* order_change - Order Change \* product_unsatisfactory - Product Unsatisfactory \* subscription_pause - This reason will be automatically set to credit notes created during pause/resume subscription operation. \* service_unsatisfactory - Service Unsatisfactory \* other - Can be set when none of the above reason codes are applicable \* subscription_cancellation - This reason will be set automatically for Credit Notes created during cancel subscription operation \* write_off - This reason will be set automatically for the Credit Notes created during invoice [Write Off](https://www.chargebee.com/docs/invoice-operations.html#write-off) operation. \* fraudulent - FRAUDULENT + + */ + + reason_code?:'order_cancellation' | 'service_unsatisfactory' | 'other' | 'product_unsatisfactory' | 'order_change' | 'waiver'; + + /** + * @description Reason code for creating the credit note. Must be one from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Credit Notes \> Create Credit Note**. Must be passed if set as mandatory in the app. The codes are case-sensitive. + + */ + + create_reason_code?:string; + + /** + * @description The date the Credit Note is issued. + + */ + + date?:number; + + /** + * @description A note to be added for this operation, to the credit note. This note is displayed on customer-facing documents such as the [Credit Note PDF](./credit_notes#retrieve_credit_note_as_pdf). + + */ + + customer_notes?:string; + + /** + * @description An internal [comment](./comments) to be added for this operation, to the credit note. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Credit Note PDF](./credit_notes#retrieve_credit_note_as_pdf). */ comment?:string; + + /** + * @description Parameters for line_items + + */ + + line_items?:{amount?:number,date_from?:number,date_to?:number,description?:string,quantity?:number,quantity_in_decimal?:string,reference_line_item_id:string,unit_amount?:number,unit_amount_in_decimal?:string}[]; + } + export interface RetrieveResponse { + credit_note:CreditNote; + } + + export interface PdfResponse { + download:Download; + } + export interface PdfInputParam { + + /** + * @description Determines the pdf should be rendered as inline or attachment in the browser. \* attachment - PDF is rendered as attachment in the browser \* inline - PDF is rendered as inline in the browser + + */ + + disposition_type?:DispositionType; + } + export interface DownloadEinvoiceResponse { + downloads:Download[]; } + export interface RefundResponse { credit_note:CreditNote; @@ -483,6 +561,46 @@ This endpoint schedules e-invoices manually. This operation is not allowed when refund_reason_code?:string; } + export interface RecordRefundResponse { + credit_note:CreditNote; + + transaction?:Transaction; + } + export interface RecordRefundInputParam { + + /** + * @description Reason code for the refund. Must be one from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Credit Notes \> Refund Credit Note**. Must be passed if set as mandatory in the app. The codes are case-sensitive. + + */ + + refund_reason_code?:string; + + /** + * @description Remarks, if any, on the refund. + + */ + + comment?:string; + + /** + * @description Parameters for transaction + + */ + + transaction?:{amount?:number,date:number,payment_method:PaymentMethod,reference_number?:string}; + } + export interface VoidCreditNoteResponse { + credit_note:CreditNote; + } + export interface VoidCreditNoteInputParam { + + /** + * @description Reason for voiding credit note. This comment will be added to the credit note. + + */ + + comment?:string; + } export interface ListResponse { /** * @description Lists all the Credit Notes. @@ -501,134 +619,133 @@ This endpoint schedules e-invoices manually. This operation is not allowed when export interface ListInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description Lists all the Credit Notes. */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Lists all the Credit Notes. */ offset?:string; /** - * @description Indicates whether to include deleted objects in the list. The deleted objects have the attribute \`deleted\` as \`true\`. + * @description Lists all the Credit Notes. */ include_deleted?:boolean; /** - * @description Credit-note id. + * @description Lists all the Credit Notes. */ id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description The identifier of the customer this Credit Note belongs to. + * @description Lists all the Credit Notes. */ customer_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description To filter based on subscription_id. -NOTE: Not to be used if *consolidated invoicing* feature is enabled. + * @description Lists all the Credit Notes. */ subscription_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string}; /** - * @description The identifier of the invoice against which this Credit Note is issued + * @description Lists all the Credit Notes. */ reference_invoice_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description The credit note type. + * @description Lists all the Credit Notes. */ type?:{in?:string,is?:'adjustment' | 'refundable',is_not?:'adjustment' | 'refundable',not_in?:string}; /** - * @description The reason for issuing this Credit Note. The following reason codes are supported now\[Deprecated; use the [create_reason_code](/docs/api/credit_notes#credit_note_create_reason_code) parameter instead\] + * @description Lists all the Credit Notes. */ reason_code?:{in?:string,is?:'other' | 'product_unsatisfactory' | 'subscription_pause' | 'order_cancellation' | 'service_unsatisfactory' | 'subscription_cancellation' | 'chargeback' | 'order_change' | 'write_off' | 'waiver' | 'subscription_change' | 'fraudulent',is_not?:'other' | 'product_unsatisfactory' | 'subscription_pause' | 'order_cancellation' | 'service_unsatisfactory' | 'subscription_cancellation' | 'chargeback' | 'order_change' | 'write_off' | 'waiver' | 'subscription_change' | 'fraudulent',not_in?:string}; /** - * @description Reason code for creating the credit note. Must be one from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Credit Notes \> Create Credit Note**. Must be passed if set as mandatory in the app. The codes are case-sensitive + * @description Lists all the Credit Notes. */ create_reason_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description The credit note status. + * @description Lists all the Credit Notes. */ status?:{in?:string,is?:'refund_due' | 'adjusted' | 'refunded' | 'voided',is_not?:'refund_due' | 'adjusted' | 'refunded' | 'voided',not_in?:string}; /** - * @description The date the Credit Note is issued. + * @description Lists all the Credit Notes. */ date?:{after?:string,before?:string,between?:string,on?:string}; /** - * @description Credit Note amount in cents. + * @description Lists all the Credit Notes. */ total?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; /** - * @description The price type of the Credit Note. + * @description Lists all the Credit Notes. */ price_type?:{in?:string,is?:'tax_exclusive' | 'tax_inclusive',is_not?:'tax_exclusive' | 'tax_inclusive',not_in?:string}; /** - * @description The amount allocated to the invoices. + * @description Lists all the Credit Notes. */ amount_allocated?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; /** - * @description The refunds issued from this Credit Note. + * @description Lists all the Credit Notes. */ amount_refunded?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; /** - * @description The yet to be used credits of this Credit Note. + * @description Lists all the Credit Notes. */ amount_available?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; /** - * @description Timestamp indicating the date and time this Credit Note gets voided. + * @description Lists all the Credit Notes. */ voided_at?:{after?:string,before?:string,between?:string,on?:string}; /** - * @description To filter based on updated at. This attribute will be present only if the resource has been updated after 2016-09-28. + * @description Lists all the Credit Notes. */ @@ -642,138 +759,72 @@ NOTE: Not to be used if *consolidated invoicing* feature is enabled. sort_by?:{asc?:'date',desc?:'date'}; /** - * @description The subscription channel this object originated from and is maintained in. + * @description Lists all the Credit Notes. */ channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string}; /** - * @description Parameters for einvoice + * @description Lists all the Credit Notes. */ einvoice?:{status?:{in?:string,is?:'in_progress' | 'scheduled' | 'success' | 'registered' | 'failed' | 'skipped',is_not?:'in_progress' | 'scheduled' | 'success' | 'registered' | 'failed' | 'skipped',not_in?:string}}; } - export interface CreateResponse { + export interface DeleteResponse { credit_note:CreditNote; - - invoice:Invoice; } - export interface CreateInputParam { + export interface DeleteInputParam { /** - * @description The identifier of the invoice against which this Credit Note is issued. + * @description Reason for deleting this credit note. This comment will be added to the associated invoice entity. */ - reference_invoice_id:string; + comment?:string; + } + export interface RemoveTaxWithheldRefundResponse { + credit_note:CreditNote; + } + export interface RemoveTaxWithheldRefundInputParam { /** - * @description Credit Note amount in cents. You can either pass the total parameter or the line_items parameter. Passing both will result in an error. + * @description Parameters for tax_withheld */ - total?:number; + tax_withheld?:{id:string}; + } + export interface ResendEinvoiceResponse { + credit_note:CreditNote; + } + + export interface SendEinvoiceResponse { + credit_note:CreditNote; + } + + export interface ImportCreditNoteResponse { + credit_note:CreditNote; + } + export interface ImportCreditNoteInputParam { /** - * @description The credit note type. \* refundable - Refundable Credit Note \* adjustment - Adjustment Credit Note + * @description Credit Note Number. */ - type:'adjustment' | 'refundable'; + id:string; /** - * @description The reason for issuing this Credit Note. The following reason codes are supported now\[Deprecated; use the [create_reason_code](/docs/api/credit_notes#credit_note_create_reason_code) parameter instead\]. \* chargeback - Can be set when you are recording your customer Chargebacks \* subscription_change - This reason will be set automatically for Credit Notes created during Change Subscription operation when [proration](https://www.chargebee.com/docs/proration.html) is enabled \* waiver - Waiver \* order_cancellation - Order Cancellation \* order_change - Order Change \* product_unsatisfactory - Product Unsatisfactory \* subscription_pause - This reason will be automatically set to credit notes created during pause/resume subscription operation. \* service_unsatisfactory - Service Unsatisfactory \* other - Can be set when none of the above reason codes are applicable \* subscription_cancellation - This reason will be set automatically for Credit Notes created during cancel subscription operation \* write_off - This reason will be set automatically for the Credit Notes created during invoice [Write Off](https://www.chargebee.com/docs/invoice-operations.html#write-off) operation. \* fraudulent - FRAUDULENT + * @description This identifies the customer for whom the credit note needs to be created. */ - reason_code?:'order_cancellation' | 'service_unsatisfactory' | 'other' | 'product_unsatisfactory' | 'order_change' | 'waiver'; + customer_id?:string; /** - * @description Reason code for creating the credit note. Must be one from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Credit Notes \> Create Credit Note**. Must be passed if set as mandatory in the app. The codes are case-sensitive. - - */ - - create_reason_code?:string; - - /** - * @description The date the Credit Note is issued. - - */ - - date?:number; - - /** - * @description A note to be added for this operation, to the credit note. This note is displayed on customer-facing documents such as the [Credit Note PDF](./credit_notes#retrieve_credit_note_as_pdf). - - */ - - customer_notes?:string; - - /** - * @description An internal [comment](./comments) to be added for this operation, to the credit note. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Credit Note PDF](./credit_notes#retrieve_credit_note_as_pdf). - - */ - - comment?:string; - - /** - * @description Parameters for line_items - - */ - - line_items?:{amount?:number,date_from?:number,date_to?:number,description?:string,quantity?:number,quantity_in_decimal?:string,reference_line_item_id:string,unit_amount?:number,unit_amount_in_decimal?:string}[]; - } - export interface RecordRefundResponse { - credit_note:CreditNote; - - transaction?:Transaction; - } - export interface RecordRefundInputParam { - - /** - * @description Reason code for the refund. Must be one from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Credit Notes \> Refund Credit Note**. Must be passed if set as mandatory in the app. The codes are case-sensitive. - - */ - - refund_reason_code?:string; - - /** - * @description Remarks, if any, on the refund. - - */ - - comment?:string; - - /** - * @description Parameters for transaction - - */ - - transaction?:{amount?:number,date:number,payment_method:PaymentMethod,reference_number?:string}; - } - export interface ImportCreditNoteResponse { - credit_note:CreditNote; - } - export interface ImportCreditNoteInputParam { - - /** - * @description Credit Note Number. - - */ - - id:string; - - /** - * @description This identifies the customer for whom the credit note needs to be created. - - */ - - customer_id?:string; - - /** - * @description The identifier of the subscription for which this credit note needs to be created. + * @description The identifier of the subscription for which this credit note needs to be created. */ @@ -917,65 +968,13 @@ Ireland** . The first two characters of the VAT number in such a case is `X linked_refunds?:{amount:number,date:number,payment_method:PaymentMethod,reference_number?:string}[]; } - export interface DeleteResponse { - credit_note:CreditNote; - } - export interface DeleteInputParam { - - /** - * @description Reason for deleting this credit note. This comment will be added to the associated invoice entity. - - */ - - comment?:string; - } - export interface DownloadEinvoiceResponse { - downloads:Download[]; - } - - export interface PdfResponse { - download:Download; - } - export interface PdfInputParam { - - /** - * @description Determines the pdf should be rendered as inline or attachment in the browser. \* attachment - PDF is rendered as attachment in the browser \* inline - PDF is rendered as inline in the browser - - */ - - disposition_type?:DispositionType; - } - export interface ResendEinvoiceResponse { - credit_note:CreditNote; - } - - export interface RemoveTaxWithheldRefundResponse { - credit_note:CreditNote; - } - export interface RemoveTaxWithheldRefundInputParam { - - /** - * @description Parameters for tax_withheld - - */ - - tax_withheld?:{id:string}; - } - export interface RetrieveResponse { - credit_note:CreditNote; - } - - export interface SendEinvoiceResponse { - credit_note:CreditNote; - } - export interface Einvoice { /** * @description The unique `id` for the e-invoice. This is auto-generated by Chargebee. */ - id?:string; + id:string; /** * @description This attribute is used to populate the unique reference number assigned to an invoice on the Invoice Registration Portal (IRP) network. It is essential for identifying and tracking invoices that are processed through the IRP network. In the future, this field may be used to store similar reference numbers for other networks. @@ -989,7 +988,7 @@ Ireland** . The first two characters of the VAT number in such a case is `X */ - status?:'in_progress' | 'scheduled' | 'success' | 'registered' | 'failed' | 'skipped'; + status:'in_progress' | 'scheduled' | 'success' | 'registered' | 'failed' | 'skipped'; /** * @description Detailed information about the status of the e-invoice. When `status` is `skipped` or `failed`, this contains the reason or error details. The following are some valid examples: @@ -1002,165 +1001,542 @@ Ireland** . The first two characters of the VAT number in such a case is `X message?:string; } export interface LineItem { + /** + * @description Uniquely identifies a line_item + + */ + id?:string; + /** + * @description A unique identifier for the subscription this line item belongs to. + + */ + subscription_id?:string; - date_from?:number; + /** + * @description Start date of this line item. + + */ + + date_from:number; + + /** + * @description End date of this line item. + + */ + + date_to:number; + + /** + * @description Unit amount of the line item. + + */ - date_to?:number; + unit_amount:number; - unit_amount?:number; + /** + * @description [Quantity of the recurring item](/docs/api/invoices?prod_cat_ver=2#invoice_line_items_quantity) which is represented by this line item. For `metered` line items, this value is updated from [usages](/docs/api/usages) once when the invoice is generated as `pending` and finally when the invoice is [closed](/docs/api/invoices#close_a_pending_invoice). + + */ quantity?:number; + /** + * @description Total amount of this line item. Typically equals to unit amount x quantity + + */ + amount?:number; + /** + * @description The [pricing scheme](https://www.chargebee.com/docs/2.0/plans.html#pricing-models) for this item price. \* stairstep - A quantity-based pricing scheme. The item is charged a fixed price based on the tier that the total quantity falls in. \* flat_fee - A fixed price that is not quantity-based. \* tiered - The per unit price is based on the tier that the total quantity falls in. \* per_unit - A fixed price per unit quantity. \* volume - There are quantity tiers for which per unit prices are set. Quantities are purchased from successive tiers. + + */ + pricing_model?:'volume' | 'per_unit' | 'tiered' | 'flat_fee' | 'stairstep'; - is_taxed?:boolean; + /** + * @description Specifies whether this line item is taxed or not + + */ + + is_taxed:boolean; + + /** + * @description The tax amount charged for this item + + */ tax_amount?:number; + /** + * @description Rate of tax used to calculate tax for this lineitem + + */ + tax_rate?:number; + /** + * @description The decimal representation of the unit amount of the `line_item`. The value is in major units of the currency. Returned when the `line_item` is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + unit_amount_in_decimal?:string; + /** + * @description The decimal representation of the quantity of this line_item. Returned when the `line_item` is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + quantity_in_decimal?:string; + /** + * @description The decimal representation of the amount for the `line_item`, in major units of the currency. Typically equals to `unit_amount_in_decimal` x `quantity_in_decimal`. Returned when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + amount_in_decimal?:string; + /** + * @description Total discounts for this line + + */ + discount_amount?:number; + /** + * @description Line Item-level discounts for this line. + + */ + item_level_discount_amount?:number; + /** + * @description Invoice Reference Line Item ID + + */ + reference_line_item_id?:string; - description?:string; + /** + * @description Detailed description about this line item. + + */ + + description:string; + + /** + * @description Detailed description about this item. + + */ entity_description?:string; - entity_type?:'addon_item_price' | 'plan_item_price' | 'charge_item_price' | 'adhoc'; + /** + * @description Specifies the modelled entity this line item is based on. \* addon - Indicates that this lineitem is based on 'Addon' entity. The 'entity_id' attribute specifies the [addon](/docs/api/addons#addon_attributes) id \* plan - Indicates that this lineitem is based on 'Plan' entity. The 'entity_id' attribute specifies the [plan](/docs/api/plans#plan_attributes) id \* plan_item_price - Indicates that this line item is based on plan Item Price \* addon_item_price - Indicates that this line item is based on addon Item Price \* charge_item_price - Indicates that this line item is based on charge Item Price \* adhoc - Indicates that this lineitem is not modelled. i.e created adhoc. So the 'entity_id' attribute will be null in this case \* plan_setup - Indicates that this lineitem is based on 'Plan Setup' charge. The 'entity_id' attribute specifies the [plan](/docs/api/plans#plan_attributes) id + + */ + + entity_type:'addon_item_price' | 'plan_item_price' | 'charge_item_price' | 'adhoc'; + + /** + * @description The reason due to which the line item price/amount is exempted from tax. \* zero_value_item - If the total invoice value/amount is equal to zero. E.g., If the total order value is $10 and a $10 coupon has been applied against that order, the total order value becomes $0. Hence the invoice value also becomes $0. \* reverse_charge - If the Customer is identified as B2B customer (when VAT Number is entered), applicable for EU only \* tax_not_configured - If tax is not enabled for the site \* high_value_physical_goods - If physical goods are sold from outside Australia to customers in Australia, and the price of all the physical good line items is greater than AUD 1000, then tax will not be applied \* customer_exempt - If the Customer is marked as Tax exempt \* region_non_taxable - If the product sold is not taxable in this region, but it is taxable in other regions, hence this region is not part of the Taxable jurisdiction \* product_exempt - If the Plan or Addon is marked as Tax exempt \* zero_rated - If the rate of tax is 0% and no Sales/ GST tax is collectable for that line item \* export - You are not registered for tax in the customer's region. This is also the reason code when both `billing_address` and `shipping_address` have not been provided for the customer and subscription respectively + + */ tax_exempt_reason?:'high_value_physical_goods' | 'tax_not_configured' | 'reverse_charge' | 'zero_rated' | 'customer_exempt' | 'region_non_taxable' | 'zero_value_item' | 'export' | 'product_exempt'; + /** + * @description The identifier of the modelled entity this line item is based on. Will be null for 'adhoc' entity type + + */ + entity_id?:string; + /** + * @description A unique identifier for the customer this line item belongs to + + */ + customer_id?:string; } export interface Discount { - amount?:number; + /** + * @description The amount deducted. The format of this value depends on the [kind of currency](/docs/api?prod_cat_ver=2#currencies). + + */ + + amount:number; + + /** + * @description Description for this deduction. + + */ description?:string; + /** + * @description The unique id of the line item that this deduction is for. Is required when `discounts[entity_type]` is `item_level_coupon` or `document_level_coupon`. + + */ + line_item_id?:string; - entity_type?:'item_level_coupon' | 'promotional_credits' | 'item_level_discount' | 'prorated_credits' | 'document_level_discount' | 'document_level_coupon'; + /** + * @description The type of deduction and the amount to which it is applied. \* prorated_credits - The deduction is due to a legacy adjustment credit applied to the invoice. The `entity_id` is `null` in this case. The legacy credits feature is superseded by [adjustment_credit_notes](/docs/api/invoices?prod_cat_ver=2#invoice_adjustment_credit_notes). \* item_level_coupon - The deduction is due to a coupon applied to line item. The coupon `id` is passed as `entity_id`. \* item_level_discount - The deduction is due to a [discount](/docs/api/discounts?prod_cat_ver=2) applied to a line item of the invoice. The discount `id` is available as the `entity_id`. \* document_level_coupon - The deduction is due to a coupon applied to the invoice `sub_total`. The coupon id is passed as `entity_id`. \* promotional_credits - The deduction is due to a [promotional credit](/docs/api/promotional_credits?prod_cat_ver=2) applied to the invoice. \* document_level_discount - The deduction is due to a [discount](/docs/api/discounts?prod_cat_ver=2) applied to the invoice `sub_total`. The discount `id` is available as the `entity_id`. + + */ + + entity_type:'item_level_coupon' | 'promotional_credits' | 'item_level_discount' | 'prorated_credits' | 'document_level_discount' | 'document_level_coupon'; + + /** + * @description The type of discount that is applied to the line item. Relevant only when `discounts[entity_type]` is one of `item_level_discount` , `item_level_coupon`, `document_level_discount`, or `document_level_coupon` \* percentage - when percentage is applied as discount \* fixed_amount - when amount is applied as discount + + */ discount_type?:'fixed_amount' | 'percentage'; + /** + * @description When the deduction is due to a `coupon` or a [discount](discounts), then this is the `id` of the coupon or discount. + + */ + entity_id?:string; + /** + * @description The [coupon code](/docs/api/coupon_codes#coupon_code_code), if applicable, used to provide the discount. The [coupon.id](/docs/api/coupons#coupon_id) is available in `entity_id`. + + */ + coupon_set_code?:string; } export interface LineItemDiscount { - line_item_id?:string; + /** + * @description The unique id of the line item that this deduction is for. + + */ + + line_item_id:string; + + /** + * @description The type of deduction and the amount to which it is applied. \* prorated_credits - The deduction is due to a legacy adjustment credit applied to the invoice. The `entity_id` is `null` in this case. The legacy credits feature is superseded by [adjustment_credit_notes](/docs/api/invoices?prod_cat_ver=2#invoice_adjustment_credit_notes). \* document_level_coupon - The deduction is due to a coupon applied to the invoice `sub_total`. The coupon `id` is available as `entity_id`. \* promotional_credits - The deduction is due to a [promotional credit](/docs/api/promotional_credits) applied to the invoice. The `entity_id` is `null` in this case. \* item_level_coupon - The deduction is due to a coupon applied to a line item of the invoice. The coupon `id` is available as `entity_id`. \* document_level_discount - The deduction is due to a [discount](/docs/api/discounts?prod_cat_ver=2) applied to the invoice `sub_total`. The discount `id` is available as the `entity_id`. \* item_level_discount - The deduction is due to a [discount](/docs/api/discounts?prod_cat_ver=2) applied to a line item of the invoice. The discount `id` is available as the `entity_id`. + + */ - discount_type?:'item_level_coupon' | 'promotional_credits' | 'item_level_discount' | 'prorated_credits' | 'document_level_discount' | 'document_level_coupon'; + discount_type:'item_level_coupon' | 'promotional_credits' | 'item_level_discount' | 'prorated_credits' | 'document_level_discount' | 'document_level_coupon'; coupon_id?:string; + /** + * @description When the deduction is due to a `coupon` or a [discount](discounts), then this is the `id` of the coupon or discount. + + */ + entity_id?:string; - discount_amount?:number; + /** + * @description The amount deducted. The format of this value depends on the [kind of currency](/docs/api#currencies). + + */ + + discount_amount:number; } export interface LineItemTier { + /** + * @description Uniquely identifies a line_item + + */ + line_item_id?:string; - starting_unit?:number; + /** + * @description The lower limit of a range of units for the tier + + */ + + starting_unit:number; + + /** + * @description The upper limit of a range of units for the tier + + */ ending_unit?:number; - quantity_used?:number; + /** + * @description The number of units purchased in a range. + + */ + + quantity_used:number; + + /** + * @description The price of the tier if the charge model is a `stairtstep` pricing , or the price of each unit in the tier if the charge model is `tiered`/`volume` pricing. + + */ + + unit_amount:number; - unit_amount?:number; + /** + * @description The decimal representation of the the lowest value of quantity in this tier. This is zero for the lowest tier. For all other tiers, it is the same as `ending_unit_in_decimal` of the next lower tier. Returned only when the `line_items.pricing_model` is `tiered`, `volume` or `stairstep` and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ starting_unit_in_decimal?:string; + /** + * @description The decimal representation of the highest value of quantity in this tier. This attribute is not applicable for the highest tier. For all other tiers, it must be equal to the `starting_unit_in_decimal` of the next higher tier. Returned only when the `line_items.pricing_model` is `tiered`, `volume` or stairstep and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + ending_unit_in_decimal?:string; + /** + * @description The decimal representation of the quantity purchased from this tier. Returned when the `line_item` is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + quantity_used_in_decimal?:string; + /** + * @description The decimal representation of the per-unit price for the tier when the `pricing_model` is `tiered` or `volume`. When the `pricing_model` is `stairstep`, it is the decimal representation of the total price for `line_item`. The value is in major units of the currency. Returned when the `line_item` is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + unit_amount_in_decimal?:string; } export interface Tax { - name?:string; + /** + * @description The name of the tax applied. E.g. GST. + + */ - amount?:number; + name:string; + + /** + * @description The tax amount. + + */ + + amount:number; + + /** + * @description Description of the tax item. + + */ description?:string; } export interface LineItemTax { + /** + * @description The unique reference id of the line item for which the tax is applicable + + */ + line_item_id?:string; - tax_name?:string; + /** + * @description The name of the tax applied + + */ + + tax_name:string; - tax_rate?:number; + /** + * @description The rate of tax used to calculate tax amount + + */ + + tax_rate:number; + + /** + * @description Indicates if tax is applied only on a portion of the line item amount. + + */ is_partial_tax_applied?:boolean; + /** + * @description Indicates the non-compliance tax that should not be reported to the jurisdiction. + + */ + is_non_compliance_tax?:boolean; - taxable_amount?:number; + /** + * @description Indicates the actual portion of the line item amount that is taxable. + + */ + + taxable_amount:number; - tax_amount?:number; + /** + * @description The tax amount + + */ + + tax_amount:number; + + /** + * @description The type of tax jurisdiction \* federal - The tax jurisdiction is a federal \* state - The tax jurisdiction is a state \* county - The tax jurisdiction is a county \* country - The tax jurisdiction is a country \* city - The tax jurisdiction is a city \* special - Special tax jurisdiction. \* unincorporated - Combined tax of state and county. \* other - Jurisdictions other than the ones listed above. + + */ tax_juris_type?:'special' | 'country' | 'unincorporated' | 'other' | 'city' | 'federal' | 'county' | 'state'; + /** + * @description The name of the tax jurisdiction + + */ + tax_juris_name?:string; + /** + * @description The tax jurisdiction code + + */ + tax_juris_code?:string; + /** + * @description Total tax amount in the currency of the place of supply. This is applicable only for Invoice and Credit Notes API. + + */ + tax_amount_in_local_currency?:number; + /** + * @description The currency code (ISO 4217 format) of the place of supply in which VAT needs to be converted and displayed. This is applicable only for Invoice and Credit Notes API. + + */ + local_currency_code?:string; } export interface CreditNoteTransaction { - txn_id?:string; + /** + * @description Uniquely identifies the transaction. + + */ + + txn_id:string; + + /** + * @description The transaction amount applied to this invoice + + */ - applied_amount?:number; + applied_amount:number; - applied_at?:number; + /** + * @description Time when the transaction amount applied to this invoice. + + */ + + applied_at:number; + + /** + * @description The status of this transaction. \* needs_attention - Connection with Gateway got terminated abruptly. So, status of this transaction needs to be resolved manually \* voided - The transaction got voided or authorization expired at gateway. \* timeout - Transaction failed because of Gateway not accepting the connection. \* success - The transaction is successful. \* failure - Transaction failed. Refer the 'error_code' and 'error_text' fields to know the reason for failure \* in_progress - Transaction is being processed by the gateway. This typically happens for [direct debit transactions](https://www.chargebee.com/docs/direct-debit-payments.html) or, in case of cards, refund transactions. Such transactions can take 2-7 days to complete, depending on the gateway and payment method. + + */ txn_status?:'in_progress' | 'success' | 'failure' | 'voided' | 'timeout' | 'needs_attention'; + /** + * @description Indicates when this transaction occurred. + + */ + txn_date?:number; + /** + * @description Total amount of the transaction + + */ + txn_amount?:number; + /** + * @description Reason code for the refund. Must be one from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Credit Notes \> Refund Credit Note**. Must be passed if set as mandatory in the app. The codes are case-sensitive + + */ + refund_reason_code?:string; } export interface LinkedTaxWithheldRefund { - id?:string; + /** + * @description An auto-generated unique identifier for the tax withheld. The value starts with the prefix `tax_wh_`. For example, `tax_wh_16BdDXSlbu4uV1Ee6`. + + */ + + id:string; + + /** + * @description The amount withheld by the customer as tax from the invoice. The unit depends on the [type of currency](/docs/api#md_disabled). + + */ amount?:number; + /** + * @description The description for this tax withheld. + + */ + description?:string; + /** + * @description Date or time associated with the tax withheld. + + */ + date?:number; + /** + * @description A unique external reference number for the tax withheld. Typically, this is the reference number used by the system you are integrating the API with. Depending on your integration, this could be the reference number issued by the taxation authority to identify the customer or the specific tax transaction. + + */ + reference_number?:string; } export interface AppliedCredit { - invoice_id?:string; + /** + * @description Unique identifier of the invoice. + + */ + + invoice_id:string; - allocated_amount?:number; + /** + * @description Amount of this refund transaction. + + */ - allocated_at?:number; + allocated_amount:number; + + /** + * @description Indicates when this refund occured. + + */ + + allocated_at:number; + + /** + * @description Closing date of the invoice. Typically this is the date on which invoice is generated + + */ invoice_date?:number; - invoice_status?:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due'; + /** + * @description Current status of the invoice. \* not_paid - Indicates the payment is not made and all attempts to collect is failed. \* paid - Indicates a paid invoice. \* voided - Indicates a voided invoice. \* posted - Indicates the payment is not yet collected and will be in this state till the due date to indicate the due period \* pending - +The [invoice](/docs/api/invoices?prod_cat_ver=2#invoice_status) is yet to be closed (sent for payment collection). An invoice is generated with this `status` when it has line items that belong to items that are `metered` or when the `subscription.create_pending_invoices`attribute is set to `true`. +The [invoice](/docs/api/invoices?prod_cat_ver=1#invoice_status) is yet to be closed (sent for payment collection). All invoices are generated with this `status` when [Metered Billing](https://www.chargebee.com/docs/1.0/metered_billing.html) is enabled for the site. \* payment_due - Indicates the payment is not yet collected and is being retried as per retry settings. + + */ + + invoice_status:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due'; } export interface ShippingAddress { /** @@ -1273,7 +1649,7 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - index?:number; + index:number; } export interface BillingAddress { /** diff --git a/types/resources/Customer.d.ts b/types/resources/Customer.d.ts index a005459..f7cc407 100644 --- a/types/resources/Customer.d.ts +++ b/types/resources/Customer.d.ts @@ -478,57 +478,48 @@ If there are additional entity identifiers for the customer not associated with export namespace Customer { export class CustomerResource { /** - * @description Deletes a particular customer identified by the a unique identifier. + * @description **Note:** This operation optionally supports 3DS verification flow. To achieve the same, create the [Payment Intent](/docs/api/3ds_card_payments?prod_cat_ver=1) and pass it as input parameter to this API. - */ - - delete(customer_id:string, input?:DeleteInputParam):ChargebeeRequest; - - /** - * @description Sets a customer into a [hierarchical relationship](https://www.chargebee.com/docs/account-hierarchy.html) with another. The path parameter `customer_id` is the ID of the child in the relationship. -**Note** +Creates a customer. You can create a customer and then create subscriptions for the customer when required. When creating a customer, you can pass along the billing address and card details. -* In the descriptions for `use_default_hierarchy_settings`, `parent_account_access`, and `child_account_access` parameters, the "parent" is the customer whose ID is [payment_owner_id](/docs/api/customers?prod_cat_ver=2#link_a_customer_payment_owner_id). However, if the `payment_owner_id` is set as the ID of the child itself (`{customer_id}`), then the "parent" is [parent_id](/docs/api/customers?prod_cat_ver=2#link_a_customer_parent_id). -* The parent and the child customers must belong to the same [business entity](/docs/api?prod_cat_ver=2#mbe). +Passing raw card data via API involves PCI liability at your end due to the sensitivity of the data. Instead, you can use one of the following integration options as applicable: - */ - - relationships(customer_id:string, input?:RelationshipsInputParam):ChargebeeRequest; - - /** - * @description Disconnects a child customer from its parent. `customer_id` is the [id](/docs/api/customers#customer_id) of the child. +Here's some resources you can use to collect card information within your checkout form based on the payment gateway you use: - */ - - delete_relationship(customer_id:string):ChargebeeRequest; - - /** - * @description Deletes a particular contact for a customer. You can delete a contact by giving the Contact ID as the input parameter. +* [Stripe.js](https://stripe.com/docs/js) for Stripe users. +* [Braintree.js](https://developer.paypal.com/braintree/docs/guides/client-sdk/setup/javascript/v2) for Braintree users. +* [Accept.js](https://developer.authorize.net/api/reference/features/acceptjs.html), if you use [Authorize.Net](https://www.authorize.net/). +* If you are using the Adyen gateway, you will have to use the Adyen's [Client-Side Encryption](https://docs.adyen.com/online-payments/classic-integrations/api-integration-ecommerce/cse-integration-ecommerce) to encrypt sensitive cardholder data. Once the cardholder data is encrypted, pass the value in `adyen.encrypted.data`as temp token in this API. +* You can also use our [Hosted Pages](https://www.chargebee.com/docs/1.0/hosted_pages.html) based integration. + +When billing address is not passed (say, for customers making offline payments), you can always provide it later using the [Update billing info for a customer API](/docs/api/customers#update_billing_info_for_a_customer). + +**Note:**When an invoice is generated for a customer, the billing address provided for the customer is stored with the invoice. If the First Name, Last Name, and Company fields of the billing address do not contain any information, they're picked up from the customer details. */ - delete_contact(customer_id:string, input?:DeleteContactInputParam):ChargebeeRequest; + create(input?:CreateInputParam):ChargebeeRequest; /** - * @description Assign Primary or Backup payment role or unassign role for the payment source based on the preference for the payment collection. + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ - assign_payment_role(customer_id:string, input:AssignPaymentRoleInputParam):ChargebeeRequest; + list(input?:ListInputParam):ChargebeeRequest; /** - * @description This API copies a customer object from one site to another. The destination site (the site to which the customer is copied) is specified by the path parameter `{site}`; whereas, the source site (the site from which the customer is copied) is specified by the query parameter `from_site`. + * @description Retrieves the details of the desired customer. You can use the unique identifier for a particular customer to retrieve the desired details. */ - move(input:MoveInputParam):ChargebeeRequest; + retrieve(customer_id:string):ChargebeeRequest; /** - * @description Retrieves the [account hierarchy tree](/docs/api/hierarchies) for the customer. + * @description Updates the customer resource. However, this method cannot be used for updating the 'Billing Info' - the Billing Address and 'vat_number' attributes - of the customer. To update the same, use our [Update Billing Info](/docs/api/customers#update_billing_info_for_a_customer) API. */ - hierarchy(customer_id:string, input:HierarchyInputParam):ChargebeeRequest; + update(customer_id:string, input?:UpdateInputParam):ChargebeeRequest; /** * @description We recently released [Payment Sources](/docs/api/payment_sources), which comes with additional options and improvements to the [Card APIs](/docs/api/cards). For this operation, use the [Create using temporary token](/docs/api/payment_sources#create_using_temporary_token) API or [Create using permanent token](/docs/api/payment_sources#create_using_permanent_token) API under Payment Sources to update payment method for the customer. @@ -583,55 +574,29 @@ The format of reference_id will differ based on where the bank account is stored update_payment_method(customer_id:string, input?:UpdatePaymentMethodInputParam):ChargebeeRequest; /** - * @description Retrieves the details of the desired customer. You can use the unique identifier for a particular customer to retrieve the desired details. + * @description This method is used for updating the `billing_address` and `vat_number` attributes of the `customer`. For updating the other customer attributes use [Update Customer API](customers#update_a_customer). - */ - - retrieve(customer_id:string):ChargebeeRequest; - - /** - * @description Updates the customer resource. However, this method cannot be used for updating the 'Billing Info' - the Billing Address and 'vat_number' attributes - of the customer. To update the same, use our [Update Billing Info](/docs/api/customers#update_billing_info_for_a_customer) API. +During this operation, if `billing_address` and `vat_number` are not already present, they're added. Whereas if present, the existing values are replaced with the new values passed. The only exception here is for `entity_identifiers[i]` when `entity_identifiers[operation][i]` is passed as `delete`. - */ - - update(customer_id:string, input?:UpdateInputParam):ChargebeeRequest; - - /** - * @description Applicable when *calendar billing* (with customer specific billing date support) is enabled. Changes the customer's *billing_date* and/or *billing_day_of_week*. +**Note:**When an invoice is generated for a customer, the billing address provided for the customer will be stored with the invoice. If the First Name, Last Name, and Company fields do not contain any information under Billing Info, the same will be picked from Customer Details if the same is available there.Please ensure that the VAT number is provided whenever the billing address is updated, as failing to do so will override any existing VAT numbers if new values are not provided. */ - change_billing_date(customer_id:string, input?:ChangeBillingDateInputParam):ChargebeeRequest; + update_billing_info(customer_id:string, input?:UpdateBillingInfoInputParam):ChargebeeRequest; /** - * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. + * @description This API retrieves all the contacts for a customer. */ - list(input?:ListInputParam):ChargebeeRequest; + contacts_for_customer(customer_id:string, input?:ContactsForCustomerInputParam):ChargebeeRequest; /** - * @description **Note:** This operation optionally supports 3DS verification flow. To achieve the same, create the [Payment Intent](/docs/api/3ds_card_payments?prod_cat_ver=1) and pass it as input parameter to this API. - -Creates a customer. You can create a customer and then create subscriptions for the customer when required. When creating a customer, you can pass along the billing address and card details. - -Passing raw card data via API involves PCI liability at your end due to the sensitivity of the data. Instead, you can use one of the following integration options as applicable: - -Here's some resources you can use to collect card information within your checkout form based on the payment gateway you use: - -* [Stripe.js](https://stripe.com/docs/js) for Stripe users. -* [Braintree.js](https://developer.paypal.com/braintree/docs/guides/client-sdk/setup/javascript/v2) for Braintree users. -* [Accept.js](https://developer.authorize.net/api/reference/features/acceptjs.html), if you use [Authorize.Net](https://www.authorize.net/). -* If you are using the Adyen gateway, you will have to use the Adyen's [Client-Side Encryption](https://docs.adyen.com/developers/features/client-side-encryption) to encrypt sensitive cardholder data. Once the cardholder data is encrypted, pass the value in `adyen.encrypted.data`as temp token in this API. -* You can also use our [Hosted Pages](https://www.chargebee.com/docs/1.0/hosted_pages.html) based integration. - -When billing address is not passed (say, for customers making offline payments), you can always provide it later using the [Update billing info for a customer API](/docs/api/customers#update_billing_info_for_a_customer). - -**Note:**When an invoice is generated for a customer, the billing address provided for the customer is stored with the invoice. If the First Name, Last Name, and Company fields of the billing address do not contain any information, they're picked up from the customer details. + * @description Assign Primary or Backup payment role or unassign role for the payment source based on the preference for the payment collection. */ - create(input?:CreateInputParam):ChargebeeRequest; + assign_payment_role(customer_id:string, input:AssignPaymentRoleInputParam):ChargebeeRequest; /** * @description Adds the required contact to a customer. You can give the First Name, Last Name, Email ID and more details as input parameters to add them under the desired customer. @@ -641,29 +606,25 @@ When billing address is not passed (say, for customers making offline payments), add_contact(customer_id:string, input?:AddContactInputParam):ChargebeeRequest; /** - * @description This API retrieves all the contacts for a customer. + * @description Updates the details of a contact for a customer. You can give the field data to be updated as input parameters along with the Contact ID to update it. */ - contacts_for_customer(customer_id:string, input?:ContactsForCustomerInputParam):ChargebeeRequest; + update_contact(customer_id:string, input?:UpdateContactInputParam):ChargebeeRequest; /** - * @description Clear personal details of a customer using this API. + * @description Deletes a particular contact for a customer. You can delete a contact by giving the Contact ID as the input parameter. */ - clear_personal_data(customer_id:string):ChargebeeRequest; + delete_contact(customer_id:string, input?:DeleteContactInputParam):ChargebeeRequest; /** - * @description This API moves a customer's payment methods, subscriptions, invoices, credit notes, transactions, unbilled charges, and orders to another customer. Events and email logs will not be moved. The API execution is asynchronous. -**Note** - -* Moving virtual bank accounts from one customer to another is not supported in this API. -* Merging customers from different [business entities](/docs/api?prod_cat_ver=2#mbe) is not permitted. + * @description Use this API to record any [excess payments](//www.chargebee.com/docs/customers.html#excess-payments) made by the customer, such as advance payments. Such payments will be automatically applied to the future invoices. It can also be [manually applied](//www.chargebee.com/docs/invoice-operations.html#apply-excess-payments) to the existing *Not Paid* or *Payment Due* invoices. */ - merge(input:MergeInputParam):ChargebeeRequest; + record_excess_payment(customer_id:string, input?:RecordExcessPaymentInputParam):ChargebeeRequest; /** * @description **Note:** This operation optionally supports 3DS verification flow. To achieve the same, create the [Payment Intent](/docs/api/#3ds_card_payments) and pass it as input parameter to this API. @@ -675,279 +636,233 @@ This API can be used to collect the payments for customer's **payment_due** collect_payment(customer_id:string, input?:CollectPaymentInputParam):ChargebeeRequest; /** - * @description Use this API to record any [excess payments](//www.chargebee.com/docs/customers.html#excess-payments) made by the customer, such as advance payments. Such payments will be automatically applied to the future invoices. It can also be [manually applied](//www.chargebee.com/docs/invoice-operations.html#apply-excess-payments) to the existing *Not Paid* or *Payment Due* invoices. + * @description Deletes a particular customer identified by the a unique identifier. */ - record_excess_payment(customer_id:string, input?:RecordExcessPaymentInputParam):ChargebeeRequest; + delete(customer_id:string, input?:DeleteInputParam):ChargebeeRequest; /** - * @description Updates the details of a contact for a customer. You can give the field data to be updated as input parameters along with the Contact ID to update it. + * @description This API copies a customer object from one site to another. The destination site (the site to which the customer is copied) is specified by the path parameter `{site}`; whereas, the source site (the site from which the customer is copied) is specified by the query parameter `from_site`. */ - update_contact(customer_id:string, input?:UpdateContactInputParam):ChargebeeRequest; + move(input:MoveInputParam):ChargebeeRequest; /** - * @description Changes the level of access that the parent or the child itself has to the child's information. - -This data falls into two categories: - -* **Self-Serve Portal data:** subscriptions and invoices of the child. -* **Email Notifications:** subscription-, invoice- and payment-related notifications for the child. - -The 'parent' is the customer whose id is [payment_owner_id](/docs/api/customers#customer_relationship_payment_owner_id). However, if the `payment_owner_id` is the child itself, then the parent is [parent_id](/docs/api/customers#customer_relationship_parent_id). The path parameter `customer_id` is the [id](/docs/api/customers#customer_id) of the child in the relationship. - - - -**Note:** This endpoint cannot be used to change the `parent_id`, `invoice_owner_id` or `payment_owner_id` for the customer. To change them, [delink](/docs/api/customers#delink_a_customer) the customer and then call **Link a customer** again. + * @description Applicable when *calendar billing* (with customer specific billing date support) is enabled. Changes the customer's *billing_date* and/or *billing_day_of_week*. */ - update_hierarchy_settings(customer_id:string, input?:UpdateHierarchySettingsInputParam):ChargebeeRequest; + change_billing_date(customer_id:string, input?:ChangeBillingDateInputParam):ChargebeeRequest; /** - * @description This method is used for updating the `billing_address` and `vat_number` attributes of the `customer`. For updating the other customer attributes use [Update Customer API](customers#update_a_customer). - -During this operation, if `billing_address` and `vat_number` are not already present, they're added. Whereas if present, the existing values are replaced with the new values passed. The only exception here is for `entity_identifiers[i]` when `entity_identifiers[operation][i]` is passed as `delete`. + * @description This API moves a customer's payment methods, subscriptions, invoices, credit notes, transactions, unbilled charges, and orders to another customer. Events and email logs will not be moved. The API execution is asynchronous. +**Note** -**Note:**When an invoice is generated for a customer, the billing address provided for the customer will be stored with the invoice. If the First Name, Last Name, and Company fields do not contain any information under Billing Info, the same will be picked from Customer Details if the same is available there.Please ensure that the VAT number is provided whenever the billing address is updated, as failing to do so will override any existing VAT numbers if new values are not provided. +* Moving virtual bank accounts from one customer to another is not supported in this API. +* Merging customers from different [business entities](/docs/api?prod_cat_ver=2#mbe) is not permitted. */ - update_billing_info(customer_id:string, input?:UpdateBillingInfoInputParam):ChargebeeRequest; - } - export interface DeleteResponse { - customer:Customer; - - card?:Card; - } - export interface DeleteInputParam { + merge(input:MergeInputParam):ChargebeeRequest; /** - * @description Deletes the Payment Method from the gateway/vault. + * @description Clear personal details of a customer using this API. */ - - delete_payment_method?:boolean; - } - export interface RelationshipsResponse { - customer:Customer; - } - export interface RelationshipsInputParam { + + clear_personal_data(customer_id:string):ChargebeeRequest; /** - * @description The `id` of the customer which is to be set as the immediate parent. + * @description Sets a customer into a [hierarchical relationship](https://www.chargebee.com/docs/account-hierarchy.html) with another. The path parameter `customer_id` is the ID of the child in the relationship. +**Note** + +* In the descriptions for `use_default_hierarchy_settings`, `parent_account_access`, and `child_account_access` parameters, the "parent" is the customer whose ID is [payment_owner_id](/docs/api/customers?prod_cat_ver=2#link_a_customer_payment_owner_id). However, if the `payment_owner_id` is set as the ID of the child itself (`{customer_id}`), then the "parent" is [parent_id](/docs/api/customers?prod_cat_ver=2#link_a_customer_parent_id). +* The parent and the child customers must belong to the same [business entity](/docs/api?prod_cat_ver=2#mbe). */ - - parent_id?:string; + + relationships(customer_id:string, input?:RelationshipsInputParam):ChargebeeRequest; /** - * @description The `id` of the customer who will pay the invoices for this customer. Can be the child itself or the `invoice_owner_id`. + * @description Disconnects a child customer from its parent. `customer_id` is the [id](/docs/api/customers#customer_id) of the child. */ - - payment_owner_id?:string; + + delete_relationship(customer_id:string):ChargebeeRequest; /** - * @description The `id` of the customer who will be invoiced for charges incurred. Can be the child itself or any parent in its hierarchy. + * @description Retrieves the [account hierarchy tree](/docs/api/hierarchies) for the customer. */ - - invoice_owner_id?:string; + + hierarchy(customer_id:string, input:HierarchyInputParam):ChargebeeRequest; /** - * @description The level of access that the parent and the child itself have to the child's information can be set here. This data falls into two categories: + * @description Changes the level of access that the parent or the child itself has to the child's information. + +This data falls into two categories: * **Self-Serve Portal data:** subscriptions and invoices of the child. * **Email Notifications:** subscription-, invoice- and payment-related notifications for the child. +The 'parent' is the customer whose id is [payment_owner_id](/docs/api/customers#customer_relationship_payment_owner_id). However, if the `payment_owner_id` is the child itself, then the parent is [parent_id](/docs/api/customers#customer_relationship_parent_id). The path parameter `customer_id` is the [id](/docs/api/customers#customer_id) of the child in the relationship. -**Usage:** - -* Value set to `true`: Applies the global access levels defined in the Account Hierarchy settings to this child. These global settings are configured in the admin console -* Value set to `false`: Customizes the access levels for this customer. Pass the `parent_account_access` and `child_account_access` parameters to specify the settings. If you skip passing any parameters, the global settings are applied for them. -. - */ - - use_default_hierarchy_settings?:boolean; - - /** - * @description Parameters for parent_account_access - - */ - - parent_account_access?:{portal_download_child_invoices?:'no' | 'yes' | 'view_only',portal_edit_child_subscriptions?:'no' | 'yes' | 'view_only',send_invoice_emails?:boolean,send_payment_emails?:boolean,send_subscription_emails?:boolean}; - - /** - * @description Parameters for child_account_access +**Note:** This endpoint cannot be used to change the `parent_id`, `invoice_owner_id` or `payment_owner_id` for the customer. To change them, [delink](/docs/api/customers#delink_a_customer) the customer and then call **Link a customer** again. */ - - child_account_access?:{portal_download_invoices?:'no' | 'yes' | 'view_only',portal_edit_subscriptions?:'yes' | 'view_only',send_invoice_emails?:boolean,send_payment_emails?:boolean,send_subscription_emails?:boolean}; - } - export interface DeleteRelationshipResponse { - customer:Customer; + + update_hierarchy_settings(customer_id:string, input?:UpdateHierarchySettingsInputParam):ChargebeeRequest; } - - export interface DeleteContactResponse { + export interface CreateResponse { customer:Customer; card?:Card; } - export interface DeleteContactInputParam { - + export interface CreateInputParam { + [key : string] : any; /** - * @description Parameters for contact + * @description Id for the new customer. If not given, this will be auto-generated. */ - contact?:{id:string}; - } - export interface AssignPaymentRoleResponse { - customer:Customer; - - payment_source:PaymentSource; - } - export interface AssignPaymentRoleInputParam { + id?:string; /** - * @description Payment source id this role will be assigned to. + * @description First name of the customer. */ - payment_source_id:string; + first_name?:string; /** - * @description Indicates whether the payment source is Primary, Backup, or neither. \* backup - Backup \* none - None \* primary - Primary + * @description Last name of the customer. */ - role:Role; - } - export interface MoveResponse { - resource_migration:ResourceMigration; - } - export interface MoveInputParam { + last_name?:string; /** - * @description Id of the customer to be copied. + * @description Email of the customer. Configured email notifications will be sent to this email. */ - id_at_from_site:string; + email?:string; /** - * @description Name of the site from which this customer need to be copied. + * @description The currency code (ISO 4217 format) of the customer. Applicable if Multicurrency is enabled. */ - from_site:string; - } - export interface HierarchyResponse { - hierarchies:Hierarchy[]; - } - export interface HierarchyInputParam { + preferred_currency_code?:string; /** - * @description Retrieves the [account hierarchy tree](/docs/api/hierarchies) for the customer. + * @description Phone number of the customer. */ - - hierarchy_operation_type:'complete_hierarchy' | 'subordinates' | 'path_to_root'; - } - export interface UpdatePaymentMethodResponse { - customer:Customer; - card?:Card; - } - export interface UpdatePaymentMethodInputParam { + phone?:string; /** - * @description Parameters for payment_method + * @description Company name of the customer. */ - payment_method?:{additional_information?:object,gateway_account_id?:string,issuing_country?:string,reference_id?:string,tmp_token?:string,type:Type}; - } - export interface RetrieveResponse { - customer:Customer; + company?:string; - card?:Card; - } - - export interface UpdateResponse { - customer:Customer; + /** + * @description Whether payments needs to be collected automatically for this customer. \* on - Whenever an invoice is created, an automatic attempt to charge the customer's payment method is made. \* off - Automatic collection of charges will not be made. All payments must be recorded offline. + + */ + + auto_collection?:AutoCollection; - card?:Card; - } - export interface UpdateInputParam { - [key : string] : any; /** - * @description First name of the customer. + * @description The number of days within which the customer has to make payment for the invoice. . */ - first_name?:string; + net_term_days?:number; /** - * @description Last name of the customer. + * @description Whether the customer can pay via Direct Debit. */ - last_name?:string; + allow_direct_debit?:boolean; /** - * @description Email of the customer. Configured email notifications will be sent to this email. + * @description The VAT/tax registration number for the customer. For customers with [billing_address](customers#customer_billing_address) `country` as `XI` (which is **United Kingdom - Northern Ireland** ), the first two characters of the [full VAT +number](https://en.wikipedia.org/wiki/VAT_identification_number) can be overridden by setting [vat_number_prefix](customers#customer_vat_number_prefix). */ - email?:string; + vat_number?:string; /** - * @description The currency code (ISO 4217 format) of the customer. Applicable if Multicurrency is enabled. + * @description An overridden value for the first two characters of the [full VAT +number](https://en.wikipedia.org/wiki/VAT_identification_number). Only applicable specifically for customers with [billing_address](customers#customer_billing_address) `country` as `XI` (which is **United Kingdom - Northern Ireland** ). + +When you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or have [manually +enabled](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, you have the option of setting [billing_address](customers#customer_billing_address) `country` as `XI`. That's the code for **United Kingdom - Northern +Ireland** . The first two characters of the VAT number in such a case is `XI` by default. However, if the VAT number was registered in UK, the value should be `GB`. Set `vat_number_prefix` to `GB` for such cases. */ - preferred_currency_code?:string; + vat_number_prefix?:string; /** - * @description Phone number of the customer. + * @description The Peppol BIS scheme associated with the [vat_number](customers#customer_vat_number) of the customer. This helps identify the specific type of customer entity. For example, `DE:VAT` is used for a German business entity while `DE:LWID45` is used for a German government entity. The value must be from the list of possible values and must correspond to the country provided under `billing_address.country`. See [list of possible values](https://www.chargebee.com/docs/e-invoicing.html#supported-countries). +**Tip:** + + +If there are additional entity identifiers for the customer not associated with the `vat_number`, they can be provided as the `entity_identifiers[]` array. +. */ - phone?:string; + entity_identifier_scheme?:string; /** - * @description Company name of the customer. + * @description The standard used for specifying the `entity_identifier_scheme`. Currently only `iso6523-actorid-upis` is supported and is used by default when not provided. +**Tip:** + + +If there are additional entity identifiers for the customer not associated with the `vat_number`, they can be provided as the `entity_identifiers[]` array. +. */ - company?:string; + entity_identifier_standard?:string; /** - * @description Whether payments needs to be collected automatically for this customer. \* on - Whenever an invoice is created, an automatic attempt to charge the customer's payment method is made. \* off - Automatic collection of charges will not be made. All payments must be recorded offline. + * @description Confirms that a customer is registered under GST. If set to `true` then the [Reverse Charge Mechanism](https://www.chargebee.com/docs/australian-gst.html#reverse-charge-mechanism) is applicable. This field is applicable only when Australian GST is configured for your site. */ - auto_collection?:AutoCollection; + registered_for_gst?:boolean; /** - * @description Whether the customer can pay via Direct Debit. + * @description Determines whether the customer is e-invoiced. When set to `true` or not set to any value, the customer is e-invoiced so long as e-invoicing is enabled for their country (`billing_address.country`). When set to `false`, the customer is not e-invoiced even if e-invoicing is enabled for their country. +**Tip:** + + +It is possible to set a value for this flag even when E-Invoicing is disabled. However, it comes into effect only when E-Invoicing is enabled. +. */ - allow_direct_debit?:boolean; + is_einvoice_enabled?:boolean; /** - * @description The number of days within which the customer has to make payment for the invoice. . + * @description Determines whether to send an e-invoice manually or automatic. \* automatic - Use this value to send e-invoice every time an invoice or credit note is created. \* manual - When manual is selected the automatic e-invoice sending is disabled. Use this value to send e-invoice manually through UI or API. \* site_default - The default value of the site which can be overridden at the customer level. */ - net_term_days?:number; + einvoicing_method?:EinvoicingMethod; /** * @description Specifies if the customer is liable for tax. \* taxable - Computes tax for the customer based on the [site configuration](https://www.chargebee.com/docs/tax.html). In some cases, depending on the region, shipping_address is needed. If not provided, then billing_address is used to compute tax. If that's not available either, the tax is taken as zero. \* exempt - @@ -968,7 +883,7 @@ To know more about what values you need to provide, refer to this [Avalara' exemption_details?:any[]; /** - * @description Indicates the type of the customer. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. \* senior_citizen - When the purchase is made by a customer who meets the jurisdiction requirements to be considered a senior citizen and qualifies for senior citizen tax breaks \* industrial - When the purchase is made by an industrial business \* business - When the purchase is made at a place of business \* residential - When the purchase is made by a customer for home use + * @description Indicates the type of the customer. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. \* industrial - When the purchase is made by an industrial business \* senior_citizen - When the purchase is made by a customer who meets the jurisdiction requirements to be considered a senior citizen and qualifies for senior citizen tax breaks \* business - When the purchase is made at a place of business \* residential - When the purchase is made by a customer for home use */ @@ -982,12 +897,19 @@ To know more about what values you need to provide, refer to this [Avalara' client_profile_id?:string; /** - * @description Indicates the exemption type of the customer. This is applicable only if you use Chargebee's TaxJar integration. \* government - Government \* other - Other \* wholesale - Whole-sale + * @description Indicates the exemption type of the customer. This is applicable only if you use Chargebee's TaxJar integration. \* other - Other \* government - Government \* wholesale - Whole-sale */ taxjar_exemption_category?:TaxjarExemptionCategory; + /** + * @description Confirms that a customer is a valid business without an EU/UK VAT number. + + */ + + business_customer_without_vat_number?:boolean; + /** * @description Determines which region-specific language Chargebee uses to communicate with the customer. In the absence of the locale attribute, Chargebee will use your site's default language for customer communication. @@ -996,7 +918,7 @@ To know more about what values you need to provide, refer to this [Avalara' locale?:string; /** - * @description The exemption category of the customer, for USA and Canada. Applicable if you use Chargebee's [AvaTax for Sales integration](https://www.chargebee.com/docs/avalara.html#configuring-tax-exemption). \* med2 - US Medical Device Excise Tax with taxable sales tax \* med1 - US Medical Device Excise Tax with exempt sales tax \* d - Foreign diplomat \* e - Charitable or benevolent organization \* f - Religious organization \* g - Resale \* a - Federal government \* b - State government \* c - Tribe/Status Indian/Indian Band \* l - Other or custom \* m - Educational organization \* n - Local government \* h - Commercial agricultural production \* i - Industrial production/manufacturer \* j - Direct pay permit \* k - Direct mail \* p - Commercial aquaculture \* q - Commercial Fishery \* r - Non-resident + * @description The exemption category of the customer, for USA and Canada. Applicable if you use Chargebee's [AvaTax for Sales integration](https://www.chargebee.com/docs/avalara.html#configuring-tax-exemption). \* l - Other or custom \* m - Educational organization \* n - Local government \* h - Commercial agricultural production \* i - Industrial production/manufacturer \* j - Direct pay permit \* k - Direct mail \* p - Commercial aquaculture \* q - Commercial Fishery \* r - Non-resident \* med2 - US Medical Device Excise Tax with taxable sales tax \* med1 - US Medical Device Excise Tax with exempt sales tax \* d - Foreign diplomat \* e - Charitable or benevolent organization \* f - Religious organization \* g - Resale \* a - Federal government \* b - State government \* c - Tribe/Status Indian/Indian Band */ @@ -1010,18 +932,20 @@ To know more about what values you need to provide, refer to this [Avalara' exempt_number?:string; /** - * @description The preferred offline payment method for the customer. \* bank_transfer - Bank Transfer \* sepa_credit - SEPA Credit \* cash - Cash \* check - Check \* no_preference - No Preference \* ach_credit - ACH Credit + * @description A collection of key-value pairs that provides extra information about the customer. +**Note:** There's a character limit of 65,535. +[Learn more](advanced-features?prod_cat_ver=2#metadata). */ - offline_payment_method?:OfflinePaymentMethod; + meta_data?:object; /** - * @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. + * @description The preferred offline payment method for the customer. \* sepa_credit - SEPA Credit \* cash - Cash \* no_preference - No Preference \* bank_transfer - Bank Transfer \* boleto - Boleto \* check - Check \* ach_credit - ACH Credit */ - invoice_notes?:string; + offline_payment_method?:OfflinePaymentMethod; /** * @description Override for this customer, the [site-level setting](https://www.chargebee.com/docs/2.0/metered_billing.html#configuring-metered-billing) for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute is also available at the [subscription level](/docs/api/subscriptions?prod_cat_ver=2#subscription_auto_close_invoices) which takes precedence. @@ -1031,74 +955,82 @@ To know more about what values you need to provide, refer to this [Avalara' auto_close_invoices?:boolean; /** - * @description A set of key-value pairs stored as additional information for the customer. [Learn more](./#meta_data). + * @description Indicates whether invoices raised on the same day for the `customer` are consolidated. When provided, this overrides the default configuration at the [site-level](https://www.chargebee.com/docs/consolidated-invoicing.html#configuring-consolidated-invoicing). This parameter can be provided only when [Consolidated Invoicing](https://www.chargebee.com/docs/consolidated-invoicing.html) is enabled. +**Note:** + +Any invoices raised when a subscription activates from `in_trial` or `future` `status`, are not consolidated by default. [Contact Support](https://chargebee.freshdesk.com/support/home) to enable consolidation for such invoices. +. */ - meta_data?:object; + consolidated_invoicing?:boolean; /** - * @description Indicates whether or not the customer has been identified as fraudulent. \* fraudulent - The customer has been marked as fraudulent \* suspicious - The customer has been identified as potentially fraudulent by the gateway \* safe - The customer has been marked as safe + * @description The Chargebee payment token generated by Chargebee JS. */ - fraud_flag?:'safe' | 'fraudulent'; + token_id?:string; /** - * @description Indicates whether invoices raised on the same day for the `customer` are consolidated. When provided, this overrides the default configuration at the [site-level](https://www.chargebee.com/docs/consolidated-invoicing.html#configuring-consolidated-invoicing). This parameter can be provided only when [Consolidated Invoicing](https://www.chargebee.com/docs/consolidated-invoicing.html) is enabled. -**Note:** + * @description The unique ID of the [business entity](https://apidocs.chargebee.com/docs/api/advanced-features?prod_cat_ver=2#mbe) this customer should be [linked](https://apidocs.chargebee.com/docs/api/advanced-features?prod_cat_ver=2#mbe-linked-be) to. Applicable only when multiple business entities have been created for the site. When not provided, the customer is linked to the [default business entity](https://apidocs.chargebee.com/docs/api/advanced-features?prod_cat_ver=2#mbe-default-be) defined for the site. +**Note** -Any invoices raised when a subscription activates from `in_trial` or `future` `status`, are not consolidated by default. [Contact Support](https://chargebee.freshdesk.com/support/home) to enable consolidation for such invoices. +An alternative way of passing this parameter is by means of a [custom HTTP header](https://apidocs.chargebee.com/docs/api/advanced-features?prod_cat_ver=2#mbe-header-main). . */ - consolidated_invoicing?:boolean; - } - export interface ChangeBillingDateResponse { - customer:Customer; - } - export interface ChangeBillingDateInputParam { + business_entity_id?:string; /** - * @description Applicable when *calendar billing* (with customer specific billing date support) is enabled. When set, renewals of all the monthly and yearly subscriptions of this customer will be aligned to this date. + * @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. */ - billing_date?:number; + invoice_notes?:string; /** - * @description `billing_month`, together with `billing_date`, specify, for this customer, the day of the year when the renewals of all the year-based subscriptions take place. + * @description Parameters for card -For example, the renewals happen on 15th July when `billing_month` is `7` and `billing_date` is `15`. -**Note** + */ + + card?:{additional_information?:object,billing_addr1?:string,billing_addr2?:string,billing_city?:string,billing_country?:string,billing_state?:string,billing_state_code?:string,billing_zip?:string,cvv?:string,expiry_month?:number,expiry_year?:number,first_name?:string,gateway_account_id?:string,last_name?:string,number?:string}; + + /** + * @description Parameters for bank_account -Applicable when [Calendar Billing](https://www.chargebee.com/docs/calendar-billing.html) (with customer-specific billing date support) is enabled and `billing_date_mode` is `manually_set`. + */ + + bank_account?:{account_holder_type?:AccountHolderType,account_number?:string,account_type?:AccountType,bank_code?:string,bank_name?:string,billing_address?:object,company?:string,echeck_type?:EcheckType,email?:string,first_name?:string,gateway_account_id?:string,iban?:string,issuing_country?:string,last_name?:string,phone?:string,routing_number?:string,swedish_identity_number?:string}; + + /** + * @description Parameters for payment_method */ - billing_month?:number; + payment_method?:{additional_information?:object,gateway_account_id?:string,issuing_country?:string,reference_id?:string,tmp_token?:string,type?:Type}; /** - * @description Indicates whether this customer's *billing_date* value is derived as per configurations or its specifically set (overriden). When specifically set, the *billing_date* will not be reset even when all of the monthly/yearly subscriptions are cancelled. \* manually_set - Billing date is specifically set (default configuration is overridden) \* using_defaults - Billing date is set based on defaults configured. + * @description Parameters for payment_intent */ - billing_date_mode?:BillingDateMode; + payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'faster_payments' | 'sofort' | 'upi' | 'venmo' | 'amazon_payments' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'pay_to' | 'card',reference_id?:string}; /** - * @description Applicable when *calendar billing* (with customer specific billing date support) is enabled. When set, renewals of all the weekly subscriptions of this customer will be aligned to this week day. \* sunday - Sunday \* wednesday - Wednesday \* tuesday - Tuesday \* monday - Monday \* saturday - Saturday \* friday - Friday \* thursday - Thursday + * @description Parameters for billing_address */ - billing_day_of_week?:'sunday' | 'saturday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'monday'; + billing_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}; /** - * @description Indicates whether this customer's *billing_day_of_week* value is derived as per configurations or its specifically set (overriden). When specifically set, the *billing_day_of_week* will not be reset even when all of the weekly subscriptions are cancelled. \* manually_set - Billing date is specifically set (default configuration is overridden) \* using_defaults - Billing date is set based on defaults configured. + * @description Parameters for entity_identifiers */ - billing_day_of_week_mode?:BillingDayOfWeekMode; + entity_identifiers?:{id?:string,scheme?:string,standard?:string,value?:string}[]; } export interface ListResponse { /** @@ -1118,123 +1050,119 @@ Applicable when [Calendar Billing](https://www.chargebee.com/docs/calendar-billi export interface ListInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ offset?:string; /** - * @description Indicates whether to include deleted objects in the list. The deleted objects have the attribute \`deleted\` as \`true\`. + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ include_deleted?:boolean; /** - * @description Identifier of the customer. + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description First name of the customer + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ first_name?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string}; /** - * @description Last name of the customer + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ last_name?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string}; /** - * @description Email of the customer. Configured email notifications will be sent to this email. + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ email?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string}; /** - * @description Company name of the customer. + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ company?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string}; /** - * @description Phone number of the customer + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ phone?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string}; /** - * @description Whether payments needs to be collected automatically for this customer + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ auto_collection?:{in?:string,is?:'off' | 'on',is_not?:'off' | 'on',not_in?:string}; /** - * @description Specifies if the customer is liable for tax + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ taxability?:{in?:string,is?:'taxable' | 'exempt',is_not?:'taxable' | 'exempt',not_in?:string}; /** - * @description Timestamp indicating when this customer resource is created. + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ created_at?:{after?:string,before?:string,between?:string,on?:string}; /** - * @description To filter based on `updated_at`. This attribute will be present only if the resource has been updated after 2016-09-28. It is advisable when using this filter, to pass the `sort_by` input parameter as `updated_at` for a faster response. + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ updated_at?:{after?:string,before?:string,between?:string,on?:string}; /** - * @description The unique ID of the [business entity](/docs/api?prod_cat_ver=2#mbe) of this subscription. This is always the same as the [business entity](/docs/api/subscriptions?prod_cat_ver=2#subscription_customer_id) of the customer. -The ID of the business entity created for the site. For Product Catalog 1.0, all the site data is tied to this business entity. -**Note** - -[Multiple Business Entities](/docs/api?prod_cat_ver=2#mbe) is a feature available only on Product Catalog 2.0. + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ business_entity_id?:{is?:string,is_not?:string,starts_with?:string}; /** - * @description The preferred offline payment method for the customer. + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ offline_payment_method?:{in?:string,is?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',is_not?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',not_in?:string}; /** - * @description Override for this customer, the [site-level setting](https://www.chargebee.com/docs/2.0/metered_billing.html#configuring-metered-billing) for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute is also available at the [subscription level](/docs/api/subscriptions?prod_cat_ver=2#subscription_auto_close_invoices) which takes precedence. + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ auto_close_invoices?:{is?:'true' | 'false'}; /** - * @description The subscription channel this object originated from and is maintained in. + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ @@ -1248,26 +1176,25 @@ The ID of the business entity created for the site. For Product Catalog 1.0, all sort_by?:{asc?:'updated_at' | 'created_at',desc?:'updated_at' | 'created_at'}; /** - * @description Parameters for relationship + * @description Retrieves a list of customers added to your Chargebee site. The list contains the necessary customer details such as First Name, Last Name and the Customer ID. */ relationship?:{invoice_owner_id?:{is?:string,is_not?:string,starts_with?:string},parent_id?:{is?:string,is_not?:string,starts_with?:string},payment_owner_id?:{is?:string,is_not?:string,starts_with?:string}}; } - export interface CreateResponse { + export interface RetrieveResponse { customer:Customer; card?:Card; } - export interface CreateInputParam { - [key : string] : any; - /** - * @description Id for the new customer. If not given, this will be auto-generated. - - */ - - id?:string; + + export interface UpdateResponse { + customer:Customer; + card?:Card; + } + export interface UpdateInputParam { + [key : string] : any; /** * @description First name of the customer. @@ -1317,13 +1244,6 @@ The ID of the business entity created for the site. For Product Catalog 1.0, all auto_collection?:AutoCollection; - /** - * @description The number of days within which the customer has to make payment for the invoice. . - - */ - - net_term_days?:number; - /** * @description Whether the customer can pay via Direct Debit. @@ -1332,74 +1252,11 @@ The ID of the business entity created for the site. For Product Catalog 1.0, all allow_direct_debit?:boolean; /** - * @description The VAT/tax registration number for the customer. For customers with [billing_address](customers#customer_billing_address) `country` as `XI` (which is **United Kingdom - Northern Ireland** ), the first two characters of the [full VAT -number](https://en.wikipedia.org/wiki/VAT_identification_number) can be overridden by setting [vat_number_prefix](customers#customer_vat_number_prefix). - - */ - - vat_number?:string; - - /** - * @description An overridden value for the first two characters of the [full VAT -number](https://en.wikipedia.org/wiki/VAT_identification_number). Only applicable specifically for customers with [billing_address](customers#customer_billing_address) `country` as `XI` (which is **United Kingdom - Northern Ireland** ). - -When you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or have [manually -enabled](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, you have the option of setting [billing_address](customers#customer_billing_address) `country` as `XI`. That's the code for **United Kingdom - Northern -Ireland** . The first two characters of the VAT number in such a case is `XI` by default. However, if the VAT number was registered in UK, the value should be `GB`. Set `vat_number_prefix` to `GB` for such cases. - - */ - - vat_number_prefix?:string; - - /** - * @description The Peppol BIS scheme associated with the [vat_number](customers#customer_vat_number) of the customer. This helps identify the specific type of customer entity. For example, `DE:VAT` is used for a German business entity while `DE:LWID45` is used for a German government entity. The value must be from the list of possible values and must correspond to the country provided under `billing_address.country`. See [list of possible values](https://www.chargebee.com/docs/e-invoicing.html#supported-countries). -**Tip:** - - -If there are additional entity identifiers for the customer not associated with the `vat_number`, they can be provided as the `entity_identifiers[]` array. -. - - */ - - entity_identifier_scheme?:string; - - /** - * @description The standard used for specifying the `entity_identifier_scheme`. Currently only `iso6523-actorid-upis` is supported and is used by default when not provided. -**Tip:** - - -If there are additional entity identifiers for the customer not associated with the `vat_number`, they can be provided as the `entity_identifiers[]` array. -. - - */ - - entity_identifier_standard?:string; - - /** - * @description Confirms that a customer is registered under GST. If set to `true` then the [Reverse Charge Mechanism](https://www.chargebee.com/docs/australian-gst.html#reverse-charge-mechanism) is applicable. This field is applicable only when Australian GST is configured for your site. - - */ - - registered_for_gst?:boolean; - - /** - * @description Determines whether the customer is e-invoiced. When set to `true` or not set to any value, the customer is e-invoiced so long as e-invoicing is enabled for their country (`billing_address.country`). When set to `false`, the customer is not e-invoiced even if e-invoicing is enabled for their country. -**Tip:** - - -It is possible to set a value for this flag even when E-Invoicing is disabled. However, it comes into effect only when E-Invoicing is enabled. -. - - */ - - is_einvoice_enabled?:boolean; - - /** - * @description Determines whether to send an e-invoice manually or automatic. \* automatic - Use this value to send e-invoice every time an invoice or credit note is created. \* manual - When manual is selected the automatic e-invoice sending is disabled. Use this value to send e-invoice manually through UI or API. \* site_default - The default value of the site which can be overridden at the customer level. + * @description The number of days within which the customer has to make payment for the invoice. . */ - einvoicing_method?:EinvoicingMethod; + net_term_days?:number; /** * @description Specifies if the customer is liable for tax. \* taxable - Computes tax for the customer based on the [site configuration](https://www.chargebee.com/docs/tax.html). In some cases, depending on the region, shipping_address is needed. If not provided, then billing_address is used to compute tax. If that's not available either, the tax is taken as zero. \* exempt - @@ -1420,7 +1277,7 @@ To know more about what values you need to provide, refer to this [Avalara' exemption_details?:any[]; /** - * @description Indicates the type of the customer. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. \* industrial - When the purchase is made by an industrial business \* senior_citizen - When the purchase is made by a customer who meets the jurisdiction requirements to be considered a senior citizen and qualifies for senior citizen tax breaks \* business - When the purchase is made at a place of business \* residential - When the purchase is made by a customer for home use + * @description Indicates the type of the customer. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. \* senior_citizen - When the purchase is made by a customer who meets the jurisdiction requirements to be considered a senior citizen and qualifies for senior citizen tax breaks \* industrial - When the purchase is made by an industrial business \* business - When the purchase is made at a place of business \* residential - When the purchase is made by a customer for home use */ @@ -1434,19 +1291,12 @@ To know more about what values you need to provide, refer to this [Avalara' client_profile_id?:string; /** - * @description Indicates the exemption type of the customer. This is applicable only if you use Chargebee's TaxJar integration. \* other - Other \* government - Government \* wholesale - Whole-sale + * @description Indicates the exemption type of the customer. This is applicable only if you use Chargebee's TaxJar integration. \* government - Government \* other - Other \* wholesale - Whole-sale */ taxjar_exemption_category?:TaxjarExemptionCategory; - /** - * @description Confirms that a customer is a valid business without an EU/UK VAT number. - - */ - - business_customer_without_vat_number?:boolean; - /** * @description Determines which region-specific language Chargebee uses to communicate with the customer. In the absence of the locale attribute, Chargebee will use your site's default language for customer communication. @@ -1455,7 +1305,7 @@ To know more about what values you need to provide, refer to this [Avalara' locale?:string; /** - * @description The exemption category of the customer, for USA and Canada. Applicable if you use Chargebee's [AvaTax for Sales integration](https://www.chargebee.com/docs/avalara.html#configuring-tax-exemption). \* l - Other or custom \* m - Educational organization \* n - Local government \* h - Commercial agricultural production \* i - Industrial production/manufacturer \* j - Direct pay permit \* k - Direct mail \* p - Commercial aquaculture \* q - Commercial Fishery \* r - Non-resident \* med2 - US Medical Device Excise Tax with taxable sales tax \* med1 - US Medical Device Excise Tax with exempt sales tax \* d - Foreign diplomat \* e - Charitable or benevolent organization \* f - Religious organization \* g - Resale \* a - Federal government \* b - State government \* c - Tribe/Status Indian/Indian Band + * @description The exemption category of the customer, for USA and Canada. Applicable if you use Chargebee's [AvaTax for Sales integration](https://www.chargebee.com/docs/avalara.html#configuring-tax-exemption). \* med2 - US Medical Device Excise Tax with taxable sales tax \* med1 - US Medical Device Excise Tax with exempt sales tax \* d - Foreign diplomat \* e - Charitable or benevolent organization \* f - Religious organization \* g - Resale \* a - Federal government \* b - State government \* c - Tribe/Status Indian/Indian Band \* l - Other or custom \* m - Educational organization \* n - Local government \* h - Commercial agricultural production \* i - Industrial production/manufacturer \* j - Direct pay permit \* k - Direct mail \* p - Commercial aquaculture \* q - Commercial Fishery \* r - Non-resident */ @@ -1469,18 +1319,18 @@ To know more about what values you need to provide, refer to this [Avalara' exempt_number?:string; /** - * @description A set of key-value pairs stored as additional information for the customer. [Learn more](./#meta_data). + * @description The preferred offline payment method for the customer. \* bank_transfer - Bank Transfer \* boleto - Boleto \* sepa_credit - SEPA Credit \* cash - Cash \* check - Check \* no_preference - No Preference \* ach_credit - ACH Credit */ - meta_data?:object; + offline_payment_method?:OfflinePaymentMethod; /** - * @description The preferred offline payment method for the customer. \* sepa_credit - SEPA Credit \* cash - Cash \* no_preference - No Preference \* bank_transfer - Bank Transfer \* boleto - Boleto \* check - Check \* ach_credit - ACH Credit + * @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. */ - offline_payment_method?:OfflinePaymentMethod; + invoice_notes?:string; /** * @description Override for this customer, the [site-level setting](https://www.chargebee.com/docs/2.0/metered_billing.html#configuring-metered-billing) for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute is also available at the [subscription level](/docs/api/subscriptions?prod_cat_ver=2#subscription_auto_close_invoices) which takes precedence. @@ -1489,6 +1339,22 @@ To know more about what values you need to provide, refer to this [Avalara' auto_close_invoices?:boolean; + /** + * @description A collection of key-value pairs that provides extra information about the customer. +**Note:** There's a character limit of 65,535. +[Learn more](advanced-features?prod_cat_ver=2#metadata). + + */ + + meta_data?:object; + + /** + * @description Indicates whether or not the customer has been identified as fraudulent. \* fraudulent - The customer has been marked as fraudulent \* suspicious - The customer has been identified as potentially fraudulent by the gateway \* safe - The customer has been marked as safe + + */ + + fraud_flag?:'safe' | 'fraudulent'; + /** * @description Indicates whether invoices raised on the same day for the `customer` are consolidated. When provided, this overrides the default configuration at the [site-level](https://www.chargebee.com/docs/consolidated-invoicing.html#configuring-consolidated-invoicing). This parameter can be provided only when [Consolidated Invoicing](https://www.chargebee.com/docs/consolidated-invoicing.html) is enabled. **Note:** @@ -1499,87 +1365,118 @@ Any invoices raised when a subscription activates from `in_trial` or & */ consolidated_invoicing?:boolean; + } + export interface UpdatePaymentMethodResponse { + customer:Customer; + + card?:Card; + } + export interface UpdatePaymentMethodInputParam { /** - * @description The Chargebee payment token generated by Chargebee JS. + * @description Parameters for payment_method */ - token_id?:string; + payment_method?:{additional_information?:object,gateway_account_id?:string,issuing_country?:string,reference_id?:string,tmp_token?:string,type:Type}; + } + export interface UpdateBillingInfoResponse { + customer:Customer; + + card?:Card; + } + export interface UpdateBillingInfoInputParam { /** - * @description The unique ID of the [business entity](https://apidocs.chargebee.com/docs/api/advanced-features?prod_cat_ver=2#mbe) this customer should be [linked](https://apidocs.chargebee.com/docs/api/advanced-features?prod_cat_ver=2#mbe-linked-be) to. Applicable only when multiple business entities have been created for the site. When not provided, the customer is linked to the [default business entity](https://apidocs.chargebee.com/docs/api/advanced-features?prod_cat_ver=2#mbe-default-be) defined for the site. -**Note** - -An alternative way of passing this parameter is by means of a [custom HTTP header](https://apidocs.chargebee.com/docs/api/advanced-features?prod_cat_ver=2#mbe-header-main). -. + * @description The VAT/tax registration number for the customer. For customers with [billing_address](customers#customer_billing_address) `country` as `XI` (which is **United Kingdom - Northern Ireland** ), the first two characters of the [full VAT +number](https://en.wikipedia.org/wiki/VAT_identification_number) can be overridden by setting [vat_number_prefix](customers#customer_vat_number_prefix). */ - business_entity_id?:string; + vat_number?:string; /** - * @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. + * @description An overridden value for the first two characters of the [full VAT +number](https://en.wikipedia.org/wiki/VAT_identification_number). Only applicable specifically for customers with [billing_address](customers#customer_billing_address) `country` as `XI` (which is **United Kingdom - Northern Ireland** ). + +When you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or have [manually +enabled](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, you have the option of setting [billing_address](customers#customer_billing_address) `country` as `XI`. That's the code for **United Kingdom - Northern +Ireland** . The first two characters of the VAT number in such a case is `XI` by default. However, if the VAT number was registered in UK, the value should be `GB`. Set `vat_number_prefix` to `GB` for such cases. */ - invoice_notes?:string; + vat_number_prefix?:string; /** - * @description Parameters for card + * @description The Peppol BIS scheme associated with the [vat_number](customers#customer_vat_number) of the customer. This helps identify the specific type of customer entity. For example, `DE:VAT` is used for a German business entity while `DE:LWID45` is used for a German government entity. The value must be from the list of possible values and must correspond to the country provided under `billing_address.country`. See [list of possible values](https://www.chargebee.com/docs/e-invoicing.html#supported-countries). +**Tip:** + + +If there are additional entity identifiers for the customer not associated with the `vat_number`, they can be provided as the `entity_identifiers[]` array. +. */ - card?:{additional_information?:object,billing_addr1?:string,billing_addr2?:string,billing_city?:string,billing_country?:string,billing_state?:string,billing_state_code?:string,billing_zip?:string,cvv?:string,expiry_month?:number,expiry_year?:number,first_name?:string,gateway_account_id?:string,last_name?:string,number?:string}; + entity_identifier_scheme?:string; /** - * @description Parameters for bank_account + * @description The standard used for specifying the `entity_identifier_scheme`. Currently only `iso6523-actorid-upis` is supported and is used by default when not provided. +**Tip:** + + +If there are additional entity identifiers for the customer not associated with the `vat_number`, they can be provided as the `entity_identifiers[]` array. +. */ - bank_account?:{account_holder_type?:AccountHolderType,account_number?:string,account_type?:AccountType,bank_code?:string,bank_name?:string,billing_address?:object,company?:string,echeck_type?:EcheckType,email?:string,first_name?:string,gateway_account_id?:string,iban?:string,issuing_country?:string,last_name?:string,phone?:string,routing_number?:string,swedish_identity_number?:string}; + entity_identifier_standard?:string; /** - * @description Parameters for payment_method + * @description Confirms that a customer is registered under GST. If set to `true` then the [Reverse Charge Mechanism](https://www.chargebee.com/docs/australian-gst.html#reverse-charge-mechanism) is applicable. This field is applicable only when Australian GST is configured for your site. */ - payment_method?:{additional_information?:object,gateway_account_id?:string,issuing_country?:string,reference_id?:string,tmp_token?:string,type?:Type}; + registered_for_gst?:boolean; /** - * @description Parameters for payment_intent + * @description Confirms that a customer is a valid business without an EU/UK VAT number. */ - payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'sofort' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'card',reference_id?:string}; + business_customer_without_vat_number?:boolean; /** - * @description Parameters for billing_address + * @description Determines whether the customer is e-invoiced. When set to `true` or not set to any value, the customer is e-invoiced so long as e-invoicing is enabled for their country (`billing_address.country`). When set to `false`, the customer is not e-invoiced even if e-invoicing is enabled for their country. +**Tip:** + + +It is possible to set a value for this flag even when E-Invoicing is disabled. However, it comes into effect only when E-Invoicing is enabled. +. */ - billing_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}; + is_einvoice_enabled?:boolean; /** - * @description Parameters for entity_identifiers + * @description Determines whether to send einvoice manually or automatic. \* automatic - Use this value to send e-invoice every time an invoice or credit note is created. \* manual - When manual is selected the automatic e-invoice sending is disabled. Use this value to send e-invoice manually through UI or API. \* site_default - The default value of the site which can be overridden at the customer level. */ - entity_identifiers?:{id?:string,scheme?:string,standard?:string,value?:string}[]; - } - export interface AddContactResponse { - customer:Customer; + einvoicing_method?:EinvoicingMethod; - card?:Card; - } - export interface AddContactInputParam { + /** + * @description Parameters for billing_address + + */ + + billing_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}; /** - * @description Parameters for contact + * @description Parameters for entity_identifiers */ - contact?:{email:string,enabled?:boolean,first_name?:string,id?:string,label?:string,last_name?:string,phone?:string,send_account_email?:boolean,send_billing_email?:boolean}; + entity_identifiers?:{id?:string,operation?:Operation,scheme?:string,standard?:string,value?:string}[]; } export interface ContactsForCustomerResponse { /** @@ -1599,41 +1496,102 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade export interface ContactsForCustomerInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description This API retrieves all the contacts for a customer. */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description This API retrieves all the contacts for a customer. */ offset?:string; } - export interface ClearPersonalDataResponse { + export interface AssignPaymentRoleResponse { customer:Customer; + + payment_source:PaymentSource; } - - export interface MergeResponse { + export interface AssignPaymentRoleInputParam { + + /** + * @description Payment source id this role will be assigned to. + + */ + + payment_source_id:string; + + /** + * @description Indicates whether the payment source is Primary, Backup, or neither. \* backup - Backup \* none - None \* primary - Primary + + */ + + role:Role; + } + export interface AddContactResponse { customer:Customer; + + card?:Card; } - export interface MergeInputParam { + export interface AddContactInputParam { /** - * @description From customer id. + * @description Parameters for contact */ - from_customer_id:string; + contact?:{email:string,enabled?:boolean,first_name?:string,id?:string,label?:string,last_name?:string,phone?:string,send_account_email?:boolean,send_billing_email?:boolean}; + } + export interface UpdateContactResponse { + customer:Customer; + + card?:Card; + } + export interface UpdateContactInputParam { /** - * @description To customer id. + * @description Parameters for contact */ - to_customer_id:string; + contact?:{email?:string,enabled?:boolean,first_name?:string,id:string,label?:string,last_name?:string,phone?:string,send_account_email?:boolean,send_billing_email?:boolean}; + } + export interface DeleteContactResponse { + customer:Customer; + + card?:Card; + } + export interface DeleteContactInputParam { + + /** + * @description Parameters for contact + + */ + + contact?:{id:string}; + } + export interface RecordExcessPaymentResponse { + customer:Customer; + + transaction:Transaction; + } + export interface RecordExcessPaymentInputParam { + + /** + * @description Remarks, if any, on the payment. + + */ + + comment?:string; + + /** + * @description Parameters for transaction + + */ + + transaction?:{amount:number,currency_code?:string,date:number,payment_method:PaymentMethod,reference_number?:string}; } export interface CollectPaymentResponse { customer:Customer; @@ -1678,7 +1636,7 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade retain_payment_source?:boolean; /** - * @description null + * @description The type of initiator to be used for the payment request triggered by this operation. \* customer - Pass this value to indicate that the request is initiated by the customer \* merchant - Pass this value to indicate that the request is initiated by the merchant */ @@ -1703,7 +1661,7 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade */ - payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'sofort' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'card',reference_id?:string}; + payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'faster_payments' | 'sofort' | 'upi' | 'venmo' | 'amazon_payments' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'pay_to' | 'card',reference_id?:string}; /** * @description Parameters for invoice_allocations @@ -1712,168 +1670,210 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade invoice_allocations?:{allocation_amount?:number,invoice_id:string}[]; } - export interface RecordExcessPaymentResponse { + export interface DeleteResponse { customer:Customer; - transaction:Transaction; + card?:Card; } - export interface RecordExcessPaymentInputParam { + export interface DeleteInputParam { + + /** + * @description Deletes the Payment Method from the gateway/vault. + + */ + + delete_payment_method?:boolean; + } + export interface MoveResponse { + resource_migration:ResourceMigration; + } + export interface MoveInputParam { + + /** + * @description Id of the customer to be copied. + + */ + + id_at_from_site:string; + + /** + * @description Name of the site from which this customer need to be copied. + + */ + + from_site:string; + } + export interface ChangeBillingDateResponse { + customer:Customer; + } + export interface ChangeBillingDateInputParam { + + /** + * @description Applicable when *calendar billing* (with customer specific billing date support) is enabled. When set, renewals of all the monthly and yearly subscriptions of this customer will be aligned to this date. + + */ + + billing_date?:number; + + /** + * @description `billing_month`, together with `billing_date`, specify, for this customer, the day of the year when the renewals of all the year-based subscriptions take place. + +For example, the renewals happen on 15th July when `billing_month` is `7` and `billing_date` is `15`. +**Note** + +Applicable when [Calendar Billing](https://www.chargebee.com/docs/calendar-billing.html) (with customer-specific billing date support) is enabled and `billing_date_mode` is `manually_set`. + + */ + + billing_month?:number; /** - * @description Remarks, if any, on the payment. + * @description Indicates whether this customer's *billing_date* value is derived as per configurations or its specifically set (overriden). When specifically set, the *billing_date* will not be reset even when all of the monthly/yearly subscriptions are cancelled. \* manually_set - Billing date is specifically set (default configuration is overridden) \* using_defaults - Billing date is set based on defaults configured. */ - comment?:string; + billing_date_mode?:BillingDateMode; /** - * @description Parameters for transaction + * @description Applicable when *calendar billing* (with customer specific billing date support) is enabled. When set, renewals of all the weekly subscriptions of this customer will be aligned to this week day. \* sunday - Sunday \* wednesday - Wednesday \* tuesday - Tuesday \* monday - Monday \* saturday - Saturday \* friday - Friday \* thursday - Thursday */ - transaction?:{amount:number,currency_code?:string,date:number,payment_method:PaymentMethod,reference_number?:string}; - } - export interface UpdateContactResponse { - customer:Customer; - - card?:Card; - } - export interface UpdateContactInputParam { + billing_day_of_week?:'sunday' | 'saturday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'monday'; /** - * @description Parameters for contact + * @description Indicates whether this customer's *billing_day_of_week* value is derived as per configurations or its specifically set (overriden). When specifically set, the *billing_day_of_week* will not be reset even when all of the weekly subscriptions are cancelled. \* manually_set - Billing date is specifically set (default configuration is overridden) \* using_defaults - Billing date is set based on defaults configured. */ - contact?:{email?:string,enabled?:boolean,first_name?:string,id:string,label?:string,last_name?:string,phone?:string,send_account_email?:boolean,send_billing_email?:boolean}; + billing_day_of_week_mode?:BillingDayOfWeekMode; } - export interface UpdateHierarchySettingsResponse { + export interface MergeResponse { customer:Customer; } - export interface UpdateHierarchySettingsInputParam { - - /** - * @description Determines whether the site default settings are applied for the access levels. - -* Value set to `true`: Removes any customized access levels for the customer. The global settings configured in the admin console now apply. -* Value set to `false`: Changes the access levels for this customer. Pass the `parent_account_access` and `child_account_access` parameters to specify the new settings. If you skip passing any parameters, they will remain unchanged. -. - - */ - - use_default_hierarchy_settings?:boolean; + export interface MergeInputParam { /** - * @description Parameters for parent_account_access + * @description From customer id. */ - parent_account_access?:{portal_download_child_invoices?:'no' | 'yes' | 'view_only',portal_edit_child_subscriptions?:'no' | 'yes' | 'view_only',send_invoice_emails?:boolean,send_payment_emails?:boolean,send_subscription_emails?:boolean}; + from_customer_id:string; /** - * @description Parameters for child_account_access + * @description To customer id. */ - child_account_access?:{portal_download_invoices?:'no' | 'yes' | 'view_only',portal_edit_subscriptions?:'yes' | 'view_only',send_invoice_emails?:boolean,send_payment_emails?:boolean,send_subscription_emails?:boolean}; + to_customer_id:string; } - export interface UpdateBillingInfoResponse { + export interface ClearPersonalDataResponse { customer:Customer; - - card?:Card; } - export interface UpdateBillingInfoInputParam { + + export interface RelationshipsResponse { + customer:Customer; + } + export interface RelationshipsInputParam { /** - * @description The VAT/tax registration number for the customer. For customers with [billing_address](customers#customer_billing_address) `country` as `XI` (which is **United Kingdom - Northern Ireland** ), the first two characters of the [full VAT -number](https://en.wikipedia.org/wiki/VAT_identification_number) can be overridden by setting [vat_number_prefix](customers#customer_vat_number_prefix). + * @description The `id` of the customer which is to be set as the immediate parent. */ - vat_number?:string; + parent_id?:string; /** - * @description An overridden value for the first two characters of the [full VAT -number](https://en.wikipedia.org/wiki/VAT_identification_number). Only applicable specifically for customers with [billing_address](customers#customer_billing_address) `country` as `XI` (which is **United Kingdom - Northern Ireland** ). - -When you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or have [manually -enabled](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, you have the option of setting [billing_address](customers#customer_billing_address) `country` as `XI`. That's the code for **United Kingdom - Northern -Ireland** . The first two characters of the VAT number in such a case is `XI` by default. However, if the VAT number was registered in UK, the value should be `GB`. Set `vat_number_prefix` to `GB` for such cases. + * @description The `id` of the customer who will pay the invoices for this customer. Can be the child itself or the `invoice_owner_id`. */ - vat_number_prefix?:string; + payment_owner_id?:string; /** - * @description The Peppol BIS scheme associated with the [vat_number](customers#customer_vat_number) of the customer. This helps identify the specific type of customer entity. For example, `DE:VAT` is used for a German business entity while `DE:LWID45` is used for a German government entity. The value must be from the list of possible values and must correspond to the country provided under `billing_address.country`. See [list of possible values](https://www.chargebee.com/docs/e-invoicing.html#supported-countries). -**Tip:** - - -If there are additional entity identifiers for the customer not associated with the `vat_number`, they can be provided as the `entity_identifiers[]` array. -. + * @description The `id` of the customer who will be invoiced for charges incurred. Can be the child itself or any parent in its hierarchy. */ - entity_identifier_scheme?:string; + invoice_owner_id?:string; /** - * @description The standard used for specifying the `entity_identifier_scheme`. Currently only `iso6523-actorid-upis` is supported and is used by default when not provided. -**Tip:** + * @description The level of access that the parent and the child itself have to the child's information can be set here. This data falls into two categories: + +* **Self-Serve Portal data:** subscriptions and invoices of the child. +* **Email Notifications:** subscription-, invoice- and payment-related notifications for the child. -If there are additional entity identifiers for the customer not associated with the `vat_number`, they can be provided as the `entity_identifiers[]` array. + +**Usage:** + +* Value set to `true`: Applies the global access levels defined in the Account Hierarchy settings to this child. These global settings are configured in the admin console +* Value set to `false`: Customizes the access levels for this customer. Pass the `parent_account_access` and `child_account_access` parameters to specify the settings. If you skip passing any parameters, the global settings are applied for them. . */ - entity_identifier_standard?:string; + use_default_hierarchy_settings?:boolean; /** - * @description Confirms that a customer is registered under GST. If set to `true` then the [Reverse Charge Mechanism](https://www.chargebee.com/docs/australian-gst.html#reverse-charge-mechanism) is applicable. This field is applicable only when Australian GST is configured for your site. + * @description Parameters for parent_account_access */ - registered_for_gst?:boolean; + parent_account_access?:{portal_download_child_invoices?:'no' | 'yes' | 'view_only',portal_edit_child_subscriptions?:'no' | 'yes' | 'view_only',send_invoice_emails?:boolean,send_payment_emails?:boolean,send_subscription_emails?:boolean}; /** - * @description Confirms that a customer is a valid business without an EU/UK VAT number. + * @description Parameters for child_account_access */ - business_customer_without_vat_number?:boolean; + child_account_access?:{portal_download_invoices?:'no' | 'yes' | 'view_only',portal_edit_subscriptions?:'yes' | 'view_only',send_invoice_emails?:boolean,send_payment_emails?:boolean,send_subscription_emails?:boolean}; + } + export interface DeleteRelationshipResponse { + customer:Customer; + } + + export interface HierarchyResponse { + hierarchies:Hierarchy[]; + } + export interface HierarchyInputParam { /** - * @description Determines whether the customer is e-invoiced. When set to `true` or not set to any value, the customer is e-invoiced so long as e-invoicing is enabled for their country (`billing_address.country`). When set to `false`, the customer is not e-invoiced even if e-invoicing is enabled for their country. -**Tip:** - - -It is possible to set a value for this flag even when E-Invoicing is disabled. However, it comes into effect only when E-Invoicing is enabled. -. + * @description Retrieves the [account hierarchy tree](/docs/api/hierarchies) for the customer. */ - - is_einvoice_enabled?:boolean; + + hierarchy_operation_type:'complete_hierarchy' | 'subordinates' | 'path_to_root'; + } + export interface UpdateHierarchySettingsResponse { + customer:Customer; + } + export interface UpdateHierarchySettingsInputParam { /** - * @description Determines whether to send einvoice manually or automatic. \* automatic - Use this value to send e-invoice every time an invoice or credit note is created. \* manual - When manual is selected the automatic e-invoice sending is disabled. Use this value to send e-invoice manually through UI or API. \* site_default - The default value of the site which can be overridden at the customer level. + * @description Determines whether the site default settings are applied for the access levels. + +* Value set to `true`: Removes any customized access levels for the customer. The global settings configured in the admin console now apply. +* Value set to `false`: Changes the access levels for this customer. Pass the `parent_account_access` and `child_account_access` parameters to specify the new settings. If you skip passing any parameters, they will remain unchanged. +. */ - einvoicing_method?:EinvoicingMethod; + use_default_hierarchy_settings?:boolean; /** - * @description Parameters for billing_address + * @description Parameters for parent_account_access */ - billing_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}; + parent_account_access?:{portal_download_child_invoices?:'no' | 'yes' | 'view_only',portal_edit_child_subscriptions?:'no' | 'yes' | 'view_only',send_invoice_emails?:boolean,send_payment_emails?:boolean,send_subscription_emails?:boolean}; /** - * @description Parameters for entity_identifiers + * @description Parameters for child_account_access */ - entity_identifiers?:{id?:string,operation?:Operation,scheme?:string,standard?:string,value?:string}[]; + child_account_access?:{portal_download_invoices?:'no' | 'yes' | 'view_only',portal_edit_subscriptions?:'yes' | 'view_only',send_invoice_emails?:boolean,send_payment_emails?:boolean,send_subscription_emails?:boolean}; } export interface BillingAddress { /** @@ -1982,40 +1982,125 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 validation_status?:ValidationStatus; } export interface ReferralUrl { + /** + * @description External customer id in the referral system + + */ + external_customer_id?:string; - referral_sharing_url?:string; + /** + * @description Referral sharing url for the customer + + */ + + referral_sharing_url:string; + + /** + * @description The referral url creation time + + */ + + created_at:number; + + /** + * @description The referral url updation time + + */ + + updated_at:number; + + /** + * @description Referral campaign id + + */ - created_at?:number; + referral_campaign_id:string; - updated_at?:number; + /** + * @description Referral account id + + */ - referral_campaign_id?:string; + referral_account_id:string; - referral_account_id?:string; + /** + * @description Referral external campaign id + + */ referral_external_campaign_id?:string; - referral_system?:'referral_candy' | 'friendbuy' | 'referral_saasquatch'; + /** + * @description Url for the referral system account \* referral_saasquatch - Referral Saasquatch \* friendbuy - Friendbuy \* referral_candy - Referral Candy + + */ + + referral_system:'referral_candy' | 'friendbuy' | 'referral_saasquatch'; } export interface Contact { - id?:string; + /** + * @description Unique reference ID provided for the contact. + + */ + + id:string; + + /** + * @description First name of the contact. + + */ first_name?:string; + /** + * @description Last name of the contact. + + */ + last_name?:string; - email?:string; + /** + * @description Email of the contact. + + */ + + email:string; + + /** + * @description Phone number of the contact. + + */ phone?:string; + /** + * @description Label/Tag provided for contact. + + */ + label?:string; - enabled?:boolean; + /** + * @description Contact enabled / disabled + + */ + + enabled:boolean; - send_account_email?:boolean; + /** + * @description Whether Account Emails option is enabled for the contact. + + */ + + send_account_email:boolean; + + /** + * @description Whether Billing Emails option is enabled for the contact. + + */ - send_billing_email?:boolean; + send_billing_email:boolean; } export interface PaymentMethod { /** @@ -2023,14 +2108,14 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - type?:Type; + type:Type; /** * @description Name of the gateway the payment method is associated with. \* ecentric - Ecentric provides a seamless payment processing service in South Africa specializing on omnichannel capabilities. \* paypal_payflow_pro - PayPal Payflow Pro is a payment gateway. \* sage_pay - Sage Pay is a payment gateway. \* wepay - WePay is a payment gateway. \* wirecard - WireCard Account is a payment service provider. \* migs - MasterCard Internet Gateway Service payment gateway. \* beanstream - Bambora(formerly known as Beanstream) is a payment gateway. \* adyen - Adyen is a payment gateway. \* razorpay - Razorpay is a fast growing payment service provider in India working with all leading banks and support for major local payment methods including Netbanking, UPI etc. \* braintree - Braintree is a payment gateway. \* nmi - NMI is a payment gateway. \* chargebee_payments - Chargebee Payments gateway \* bluepay - BluePay is a payment gateway. \* paypal - PayPal Commerce is a payment gateway. \* bank_of_america - Bank of America is a payment gateway. \* paypal_pro - PayPal Pro Account is a payment gateway. \* eway_rapid - eWAY Rapid is a payment gateway. \* windcave - Windcave provides an end to end payment processing solution in ANZ and other leading global markets. \* moneris_us - Moneris USA is a payment gateway. \* exact - Exact Payments is a payment gateway. \* paypal_express_checkout - PayPal Express Checkout is a payment gateway. \* tco - 2Checkout is a payment gateway. \* chargebee - Chargebee test gateway. \* stripe - Stripe is a payment gateway. \* eway - eWAY Account is a payment gateway. \* authorize_net - Authorize.net is a payment gateway \* moneris - Moneris is a payment gateway. \* worldpay - WorldPay is a payment gateway \* pin - Pin is a payment gateway \* gocardless - GoCardless is a payment service provider. \* elavon - Elavon Virtual Merchant is a payment solution. \* cybersource - CyberSource is a payment gateway. \* vantiv - Vantiv is a payment gateway. \* amazon_payments - Amazon Payments is a payment service provider. \* global_payments - Global Payments is a payment service provider. \* first_data_global - First Data Global Gateway Virtual Terminal Account \* orbital - Chase Paymentech(Orbital) is a payment gateway. \* checkout_com - Checkout.com is a payment gateway. \* quickbooks - Intuit QuickBooks Payments gateway \* mollie - Mollie is a payment gateway. \* bluesnap - BlueSnap is a payment gateway. \* paymill - PAYMILL is a payment gateway. \* ogone - Ingenico ePayments (formerly known as Ogone) is a payment gateway. \* not_applicable - Indicates that payment gateway is not applicable for this resource. \* hdfc - HDFC Account is a payment gateway. \* balanced_payments - Balanced is a payment gateway \* ingenico_direct - Worldline Online Payments is a payment gateway. \* metrics_global - Metrics global is a leading payment service provider providing unified payment services in the US. */ - gateway?:Gateway; + gateway:Gateway; /** * @description The gateway account this payment method is stored with. @@ -2044,7 +2129,7 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - status?:'valid' | 'expiring' | 'expired' | 'invalid' | 'pending_verification'; + status:'valid' | 'expiring' | 'expired' | 'invalid' | 'pending_verification'; /** * @description The reference id. In the case of Amazon and PayPal this will be the 'billing agreement id'. For GoCardless direct debit this will be 'mandate id'. In the case of card payments this will be the identifier provided by the gateway/card vault for the specific payment method resource. @@ -2052,25 +2137,82 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - reference_id?:string; + reference_id:string; } export interface CustomerBalance { - promotional_credits?:number; + /** + * @description Promotional credits balance of this customer. + + */ + + promotional_credits:number; + + /** + * @description Total unused payments associated with the customer. + + */ - excess_payments?:number; + excess_payments:number; + + /** + * @description Refundable credits balance of this customer + + */ + + refundable_credits:number; + + /** + * @description Total unbilled charges for this customer. + + */ - refundable_credits?:number; + unbilled_charges:number; - unbilled_charges?:number; + /** + * @description The currency code (ISO 4217 format) for balance + + */ - currency_code?:string; + currency_code:string; } export interface EntityIdentifier { - id?:string; + /** + * @description The unique id for the `entity_identifier` in Chargebee. When not provided, it is autogenerated. + + */ + + id:string; + + /** + * @description The value of the `entity_identifier`. This identifies the customer entity on the Peppol network. For example: `10101010-STO-10`. +**Tip:** + + +If there is only one entity identifier for the customer and the value is the same as `vat_number`, then there is no need to provide the `entity_identifiers[]` array. See [description for `entity_identifiers[]`](customers#customer_entity_identifiers). + + */ value?:string; - scheme?:string; + /** + * @description The Peppol BIS scheme associated with the [vat_number](customers#customer_vat_number) of the customer. This helps identify the specific type of customer entity. For example, `DE:VAT` is used for a German business entity while `DE:LWID45` is used for a German government entity. The value must be from the list of possible values and must correspond to the country provided under `billing_address.country`. See [list of possible values](https://www.chargebee.com/docs/e-invoicing.html#supported-countries). +**Tip:** + + +If there is only one entity identifier for the customer and the value is the same as `vat_number`, then there is no need to provide the `entity_identifiers[]` array. See [description for `entity_identifiers[]`](customers#customer_entity_identifiers). + + */ + + scheme:string; + + /** + * @description The standard used for specifying the `entity_identifier` `scheme`. Currently, only `iso6523-actorid-upis` is supported and is used by default when not provided. +**Tip:** + + +If there is only one entity identifier for the customer and the value is the same as `vat_number`, then there is no need to provide the `entity_identifiers[]` array. See [description for `entity_identifiers[]`](customers#customer_entity_identifiers). + + */ standard?:string; } @@ -2087,14 +2229,14 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - payment_owner_id?:string; + payment_owner_id:string; /** * @description The `id` of the customer who is invoiced for charges incurred. Can be the customer itself or any parent in its hierarchy. */ - invoice_owner_id?:string; + invoice_owner_id:string; } export interface ParentAccountAccess { /** @@ -2116,21 +2258,21 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - send_subscription_emails?:boolean; + send_subscription_emails:boolean; /** * @description If `true`, the parent account will receive invoice-related emails sent to the child account. */ - send_invoice_emails?:boolean; + send_invoice_emails:boolean; /** * @description If `true`, the parent account will receive payment-related emails sent to the child account. */ - send_payment_emails?:boolean; + send_payment_emails:boolean; } export interface ChildAccountAccess { /** @@ -2152,21 +2294,21 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - send_subscription_emails?:boolean; + send_subscription_emails:boolean; /** * @description If `true`, the child account will receive invoice-related emails for its own invoices. */ - send_invoice_emails?:boolean; + send_invoice_emails:boolean; /** * @description If `true`, the child account will receive payment-related emails for its own invoices. */ - send_payment_emails?:boolean; + send_payment_emails:boolean; } } } \ No newline at end of file diff --git a/types/resources/DifferentialPrice.d.ts b/types/resources/DifferentialPrice.d.ts index d2a944a..d6eb0ab 100644 --- a/types/resources/DifferentialPrice.d.ts +++ b/types/resources/DifferentialPrice.d.ts @@ -96,63 +96,103 @@ declare module 'chargebee' { export namespace DifferentialPrice { export class DifferentialPriceResource { /** - * @description Delete a differential price using a `differential_price_id` and `item_price_id`. + * @description Create a differential price for addon item price, addon item price with tiered pricing, or charge item price. */ - delete(differential_price_id:string, input:DeleteInputParam):ChargebeeRequest; + create(item_price_id:string, input:CreateInputParam):ChargebeeRequest; /** - * @description Create a differential price for addon item price, addon item price with tiered pricing, or charge item price. + * @description Retrieve a differential price using a `differential_price_id` and `item_price_id`. */ - create(item_price_id:string, input:CreateInputParam):ChargebeeRequest; + retrieve(differential_price_id:string, input:RetrieveInputParam):ChargebeeRequest; /** - * @description Returns a list of differential prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). + * @description Update a differential price using a `differential_price_id` and `item_price_id`. */ - list(input?:ListInputParam):ChargebeeRequest; + update(differential_price_id:string, input:UpdateInputParam):ChargebeeRequest; /** - * @description Retrieve a differential price using a `differential_price_id` and `item_price_id`. + * @description Delete a differential price using a `differential_price_id` and `item_price_id`. */ - retrieve(differential_price_id:string, input:RetrieveInputParam):ChargebeeRequest; + delete(differential_price_id:string, input:DeleteInputParam):ChargebeeRequest; /** - * @description Update a differential price using a `differential_price_id` and `item_price_id`. + * @description Returns a list of differential prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). */ - update(differential_price_id:string, input:UpdateInputParam):ChargebeeRequest; + list(input?:ListInputParam):ChargebeeRequest; } - export interface DeleteResponse { + export interface CreateResponse { differential_price:DifferentialPrice; } - export interface DeleteInputParam { + export interface CreateInputParam { /** - * @description The id of the item price (`addon` or `charge`) whose price should change according to the plan-item it is applied to. + * @description The id of the plan-item, in relation to which, the differential pricing for the addon or charge is defined. For example, this would be the id of the *Standard* or *Enterprise* plans-items mentioned in the [examples above](./differential_prices?prod_cat_ver=2). */ + parent_item_id:string; + + /** + * @description The differential price. If the pricing model of the `item_price_id` is `tiered`, `volume`, or `stairstep`, pass `tiers` instead of this. + + */ + + price?:number; + + /** + * @description The price of the item when the pricing_model is `flat_fee`. When the pricing model is `per_unit`, it is the price per unit quantity of the item. Not applicable for the other pricing models. The value is in decimal and in major units of the currency. Also, this is only applicable when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + + price_in_decimal?:string; + + /** + * @description Parameters for parent_periods + + */ + + parent_periods?:{period?:any[],period_unit:'week' | 'month' | 'year' | 'day'}[]; + + /** + * @description Parameters for tiers + + */ + + tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; + } + export interface RetrieveResponse { + differential_price:DifferentialPrice; + } + export interface RetrieveInputParam { + + /** + * @description Retrieve a differential price using a `differential_price_id` and `item_price_id`. + + */ + item_price_id:string; } - export interface CreateResponse { + export interface UpdateResponse { differential_price:DifferentialPrice; } - export interface CreateInputParam { + export interface UpdateInputParam { /** - * @description The id of the plan-item, in relation to which, the differential pricing for the addon or charge is defined. For example, this would be the id of the *Standard* or *Enterprise* plans-items mentioned in the [examples above](./differential_prices?prod_cat_ver=2). + * @description The id of the item price (`addon` or `charge`) whose price should change according to the plan-item it is applied to. */ - parent_item_id:string; + item_price_id:string; /** * @description The differential price. If the pricing model of the `item_price_id` is `tiered`, `volume`, or `stairstep`, pass `tiers` instead of this. @@ -182,6 +222,18 @@ declare module 'chargebee' { tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; } + export interface DeleteResponse { + differential_price:DifferentialPrice; + } + export interface DeleteInputParam { + + /** + * @description The id of the item price (`addon` or `charge`) whose price should change according to the plan-item it is applied to. + + */ + + item_price_id:string; + } export interface ListResponse { /** * @description Returns a list of differential prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). @@ -200,105 +252,68 @@ declare module 'chargebee' { export interface ListInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description Returns a list of differential prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Returns a list of differential prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). */ offset?:string; /** - * @description The id of the item price (`addon` or `charge`) whose price should change according to the plan-item it is applied to. + * @description Returns a list of differential prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). */ item_price_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Item Id of Addon / Charge item price for which differential pricing is applied to + * @description Returns a list of differential prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). */ item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description A unique and immutable id for the differential price. It is auto-generated when the differential price is created. + * @description Returns a list of differential prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). */ id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description The id of the plan-item, in relation to which, the differential pricing for the addon or charge is defined. For example, this would be the id of the *Standard* or *Enterprise* plans-items mentioned in the [examples above](./differential_prices?prod_cat_ver=2). + * @description Returns a list of differential prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order (latest first). */ parent_item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; } - export interface RetrieveResponse { - differential_price:DifferentialPrice; - } - export interface RetrieveInputParam { - - /** - * @description Retrieve a differential price using a `differential_price_id` and `item_price_id`. - - */ - - item_price_id:string; - } - export interface UpdateResponse { - differential_price:DifferentialPrice; - } - export interface UpdateInputParam { - - /** - * @description The id of the item price (`addon` or `charge`) whose price should change according to the plan-item it is applied to. + export interface Tier { + /** + * @description The lower limit of a range of units for the tier - */ + */ - item_price_id:string; + starting_unit:number; - /** - * @description The differential price. If the pricing model of the `item_price_id` is `tiered`, `volume`, or `stairstep`, pass `tiers` instead of this. + /** + * @description The upper limit of a range of units for the tier - */ + */ - price?:number; - - /** - * @description The price of the item when the pricing_model is `flat_fee`. When the pricing model is `per_unit`, it is the price per unit quantity of the item. Not applicable for the other pricing models. The value is in decimal and in major units of the currency. Also, this is only applicable when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. - - */ - - price_in_decimal?:string; - - /** - * @description Parameters for parent_periods - - */ - - parent_periods?:{period?:any[],period_unit:'week' | 'month' | 'year' | 'day'}[]; + ending_unit?:number; - /** - * @description Parameters for tiers + /** + * @description The per-unit price for the tier when the `pricing_model` is `tiered` or `volume`; the total cost for the item price when the `pricing_model` is `stairstep`. The value is in the [minor unit of the currency](https://apidocs.chargebee.com/docs/api#handling_currency_units). - */ - - tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; - } - export interface Tier { - starting_unit?:number; + */ - ending_unit?:number; - - price?:number; + price:number; starting_unit_in_decimal?:string; @@ -307,7 +322,17 @@ declare module 'chargebee' { price_in_decimal?:string; } export interface ParentPeriod { - period_unit?:'week' | 'month' | 'year' | 'day'; + /** + * @description The unit of time for `period`. \* month - A period of 1 calendar month. \* day - A period of 24 hours. \* week - A period of 7 days. \* year - A period of 1 calendar year. + + */ + + period_unit:'week' | 'month' | 'year' | 'day'; + + /** + * @description The billing period of the plan in `period_unit`s. For example, a 6 month plan has `period` as 6 and `period_unit` as `month`. + + */ period?:any[]; } diff --git a/types/resources/EntitlementOverride.d.ts b/types/resources/EntitlementOverride.d.ts index 80c41af..b7db51e 100644 --- a/types/resources/EntitlementOverride.d.ts +++ b/types/resources/EntitlementOverride.d.ts @@ -76,14 +76,38 @@ declare module 'chargebee' { } export namespace EntitlementOverride { export class EntitlementOverrideResource { + /** + * @description Upserts or removes a set of `entitlement_overrides` for a `subscription` depending on the `action` specified. The API returns the upserted or deleted `entitlement_overrides` after successfully completing the operation. The operation returns an error when the first `entitlement_override` fails to be processed. Either all the `entitlement_overrides` provided in the request are processed or none. + + */ + + add_entitlement_override_for_subscription(subscription_id:string, input?:AddEntitlementOverrideForSubscriptionInputParam):ChargebeeRequest; + /** * @description Retrieve the list of entitlement overrides for a subscription. */ list_entitlement_override_for_subscription(subscription_id:string, input?:ListEntitlementOverrideForSubscriptionInputParam):ChargebeeRequest; + } + export interface AddEntitlementOverrideForSubscriptionResponse { + entitlement_override:EntitlementOverride; + } + export interface AddEntitlementOverrideForSubscriptionInputParam { - add_entitlement_override_for_subscription(subscription_id:string, input?:AddEntitlementOverrideForSubscriptionInputParam):ChargebeeRequest; + /** + * @description The specific action to be performed for each `entitlement_override` specified. . \* remove - Deletes the `entitlement_override` for the `feature_id` and `item_id` combination, if it exists. \* upsert - If the `entitlement_override` already exists for the `feature_id` and `{subscription_id}` combination, the `value` of the `entitlement_override` is updated. If it doesn't exist, a new `entitlement_override` is created. + + */ + + action?:Action; + + /** + * @description Parameters for entitlement_overrides + + */ + + entitlement_overrides?:{expires_at?:number,feature_id:string,value?:string}[]; } export interface ListEntitlementOverrideForSubscriptionResponse { /** @@ -103,28 +127,19 @@ declare module 'chargebee' { export interface ListEntitlementOverrideForSubscriptionInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description Retrieve the list of entitlement overrides for a subscription. */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Retrieve the list of entitlement overrides for a subscription. */ offset?:string; } - export interface AddEntitlementOverrideForSubscriptionResponse { - entitlement_override:EntitlementOverride; - } - export interface AddEntitlementOverrideForSubscriptionInputParam { - - action?:Action; - - entitlement_overrides?:{expires_at?:number,feature_id:string,value?:string}[]; - } } } \ No newline at end of file diff --git a/types/resources/Estimate.d.ts b/types/resources/Estimate.d.ts index 5b4cdc1..31f7581 100644 --- a/types/resources/Estimate.d.ts +++ b/types/resources/Estimate.d.ts @@ -60,29 +60,6 @@ declare module 'chargebee' { } export namespace Estimate { export class EstimateResource { - /** - * @description This returns an estimate of the amount that will be charged when the subscription is billed next. The estimate is calculated based on the current recurring items of the subscription - plan, addons, and coupons. - -In the response, - -* **estimate.subscription_estimate** has the current subscription details like its status, next billing date, and so on. -* **estimate.invoice_estimate** has details of the invoice that will be generated at the next billing date. - - The generated invoice estimate will include all the balances - [Promotional Credits](https://www.chargebee.com/docs/promotional-credits.html), Refundable Credits, and Excess Payments - if any. If you don't want these balances to be included you can specify 'false' for the parameter *use_existing_balances*. - - To exclude the [delayed charges](https://www.chargebee.com/docs/charges.html) from the invoice estimate, specify 'false' for the parameter *include_delayed_charges*. - -**Note:** - -* This API will not generate a renewal invoice if an [advance invoice](https://www.chargebee.com/docs/advance-invoices.html) is already present for the subscription. -* For 'Non Renewing' subscriptions, only the [delayed charges](https://www.chargebee.com/docs/charges.html) will be included in the invoice estimate. -* This API is not supported for 'Cancelled' subscriptions. -* Only the subscription's charges will be included. If you have enabled the Consolidated invoicing feature, use the *Upcoming Invoices* estimate available for the Customer object to get the actual estimate invoice for the customer. - - */ - - renewal_estimate(subscription_id:string, input?:RenewalEstimateInputParam):ChargebeeRequest; - /** * @description Generates an estimate for creating a subscription when the customer does not exist in Chargebee. This estimate API can be called when the customer has not yet signed up and you want to preview how a new subscription would look like for them. @@ -106,43 +83,14 @@ The response contains one or more of the following objects: create_sub_item_estimate(input?:CreateSubItemEstimateInputParam):ChargebeeRequest; /** - * @description This creates an estimate for canceling a subscription without actually canceling it. Estimate details include canceling date, unbilled charge options, refund credit handling, the amount to be credited after cancellation, and so on. - - */ - - cancel_subscription_for_items(subscription_id:string, input?:CancelSubscriptionForItemsInputParam):ChargebeeRequest; - - /** - * @description Generates an estimate for the 'resume subscription' operation. This is similar to the [Resume a subscription](/docs/api/subscriptions#resume_a_subscription) API, but the subscription will not be resumed. Only an estimate for this operation is created. - -In the response, - -* **estimate.subscription_estimate** has the subscription details. -* **estimate.invoice_estimate** has details of the invoice that will be generated immediately. This will not be present if no immediate invoice is generated for this operation. This will happen for in-term resumption^++^. - - **^++^What is an "in-term resumption"?** - An "in-term resumption" is when the resumption happens within the billing term of the subscription. -* **estimate.next_invoice_estimate** has details of the invoice that will be generated during the next billing date of this subscription. This will be present only if no immediate invoice is generated during this operation (scenario mentioned above) and this subscription has next billing. - - The generated invoice_estimate/next_invoice_estimate will include all the balances - [Promotional Credits](https://www.chargebee.com/docs/promotional-credits.html), Refundable Credits, and Excess Payments - if any. - - */ - - resume_subscription(subscription_id:string, input?:ResumeSubscriptionInputParam):ChargebeeRequest; - - /** - * @description This endpoint creates an invoice estimate for non-recurring items. + * @description Generates an estimate without creating a subscription. This endpoint can be called when you want to preview details of a new subscription before actually creating one. +**See also** - */ - - create_invoice_for_items(input?:CreateInvoiceForItemsInputParam):ChargebeeRequest; - - /** - * @description This endpoint generates an estimate for a subscription that is intended to be a gift. The estimate provides details about the gift sender, gift recipient, address details of the recipient, and the type and details of subscription items included in the gift. +* [Estimate a purchase](https://apidocs.chargebee.com/docs/api/purchases#estimates_for_purchase): an operation that estimates a `purchase` representing multiple subscriptions bought together by a customer. */ - gift_subscription_for_items(input?:GiftSubscriptionForItemsInputParam):ChargebeeRequest; + create_sub_item_for_customer_estimate(customer_id:string, input?:CreateSubItemForCustomerEstimateInputParam):ChargebeeRequest; /** * @description Returns an estimate for updating a subscription. @@ -164,17 +112,34 @@ In the response, update_subscription_for_items(input?:UpdateSubscriptionForItemsInputParam):ChargebeeRequest; /** - * @description Estimate of the upcoming scheduled invoices (subscription activations, renewals etc) of a customer. For now preview of the invoices generated on the immediate upcoming date is supported. Say a customer has couple of subscription renewals scheduled on *Jan,10th* and another subscription renewal scheduled on *Jan,15th* . This API gives the preview of all the invoices scheduled to be generated on *Jan,10th* (immediate upcoming date). + * @description This returns an estimate of the amount that will be charged when the subscription is billed next. The estimate is calculated based on the current recurring items of the subscription - plan, addons, and coupons. -In the response: +In the response, -* **estimate.invoice_estimates\[\]** has details of the invoices scheduled to be generated. +* **estimate.subscription_estimate** has the current subscription details like its status, next billing date, and so on. +* **estimate.invoice_estimate** has details of the invoice that will be generated at the next billing date. -**Note:** If *consolidated invoicing* is enabled you may use this API to test whether upcoming renewals are consolidated. + The generated invoice estimate will include all the balances - [Promotional Credits](https://www.chargebee.com/docs/promotional-credits.html), Refundable Credits, and Excess Payments - if any. If you don't want these balances to be included you can specify 'false' for the parameter *use_existing_balances*. + + To exclude the [delayed charges](https://www.chargebee.com/docs/charges.html) from the invoice estimate, specify 'false' for the parameter *include_delayed_charges*. + +**Note:** + +* This API will not generate a renewal invoice if an [advance invoice](https://www.chargebee.com/docs/advance-invoices.html) is already present for the subscription. +* For 'Non Renewing' subscriptions, only the [delayed charges](https://www.chargebee.com/docs/charges.html) will be included in the invoice estimate. +* This API is not supported for 'Cancelled' subscriptions. +* Only the subscription's charges will be included. If you have enabled the Consolidated invoicing feature, use the *Upcoming Invoices* estimate available for the Customer object to get the actual estimate invoice for the customer. */ - upcoming_invoices_estimate(customer_id:string):ChargebeeRequest; + renewal_estimate(subscription_id:string, input?:RenewalEstimateInputParam):ChargebeeRequest; + + /** + * @description This API is used to generate an invoice estimate for preview. Estimate details include the number of billing cycles to be invoiced in advance, the number of billing cycles in one interval, advance invoicing schedules, and so on. + + */ + + advance_invoice_estimate(subscription_id:string, input?:AdvanceInvoiceEstimateInputParam):ChargebeeRequest; /** * @description Regenerates the invoice for the current term of the subscription. The subscription must have `status` as `active` or `non_renewing`. This operation is not allowed when any of the following conditions hold true for the subscription: @@ -200,14 +165,17 @@ Returns an `estimate` object with one of the following components depe regenerate_invoice_estimate(subscription_id:string, input?:RegenerateInvoiceEstimateInputParam):ChargebeeRequest; /** - * @description Generates an estimate without creating a subscription. This endpoint can be called when you want to preview details of a new subscription before actually creating one. -**See also** + * @description Estimate of the upcoming scheduled invoices (subscription activations, renewals etc) of a customer. For now preview of the invoices generated on the immediate upcoming date is supported. Say a customer has couple of subscription renewals scheduled on *Jan,10th* and another subscription renewal scheduled on *Jan,15th* . This API gives the preview of all the invoices scheduled to be generated on *Jan,10th* (immediate upcoming date). -* [Estimate a purchase](https://apidocs.chargebee.com/docs/api/purchases#estimates_for_purchase): an operation that estimates a `purchase` representing multiple subscriptions bought together by a customer. +In the response: + +* **estimate.invoice_estimates\[\]** has details of the invoices scheduled to be generated. + +**Note:** If *consolidated invoicing* is enabled you may use this API to test whether upcoming renewals are consolidated. */ - create_sub_item_for_customer_estimate(customer_id:string, input?:CreateSubItemForCustomerEstimateInputParam):ChargebeeRequest; + upcoming_invoices_estimate(customer_id:string):ChargebeeRequest; /** * @description Generates an estimate for the 'change term end' operation. This is similar to the [Change term end](/docs/api/subscriptions#change_term_end) API but the subscription's term end will not be changed, only an estimate for this operation is created. This is applicable only for subscriptions in 'in-trial', 'active' and 'non-renewing' states. @@ -226,6 +194,13 @@ In the response, change_term_end(subscription_id:string, input:ChangeTermEndInputParam):ChargebeeRequest; + /** + * @description This creates an estimate for canceling a subscription without actually canceling it. Estimate details include canceling date, unbilled charge options, refund credit handling, the amount to be credited after cancellation, and so on. + + */ + + cancel_subscription_for_items(subscription_id:string, input?:CancelSubscriptionForItemsInputParam):ChargebeeRequest; + /** * @description This API provides an estimate of the details pertaining to the [pause_subscription](/docs/api/subscriptions#pause_a_subscription) operation. It returns attributes such as [pause_date](/docs/api/estimates#estimate_subscription_estimate_pause_date) and [resume_date](/docs/api/estimates#estimate_subscription_estimate_resume_date). This is similar to the [Pause a subscription](/docs/api/subscriptions#pause_a_subscription) API with the exception that the subscription is not paused. Only an estimate for this operation is created. @@ -240,108 +215,36 @@ In the response, pause_subscription(subscription_id:string, input?:PauseSubscriptionInputParam):ChargebeeRequest; /** - * @description This API is used to generate an invoice estimate for preview. Estimate details include the number of billing cycles to be invoiced in advance, the number of billing cycles in one interval, advance invoicing schedules, and so on. - - */ - - advance_invoice_estimate(subscription_id:string, input?:AdvanceInvoiceEstimateInputParam):ChargebeeRequest; - } - export interface RenewalEstimateResponse { - estimate:Estimate; - } - export interface RenewalEstimateInputParam { - - /** - * @description This returns an estimate of the amount that will be charged when the subscription is billed next. The estimate is calculated based on the current recurring items of the subscription - plan, addons, and coupons. - -In the response, - -* **estimate.subscription_estimate** has the current subscription details like its status, next billing date, and so on. -* **estimate.invoice_estimate** has details of the invoice that will be generated at the next billing date. - - The generated invoice estimate will include all the balances - [Promotional Credits](https://www.chargebee.com/docs/promotional-credits.html), Refundable Credits, and Excess Payments - if any. If you don't want these balances to be included you can specify 'false' for the parameter *use_existing_balances*. - - To exclude the [delayed charges](https://www.chargebee.com/docs/charges.html) from the invoice estimate, specify 'false' for the parameter *include_delayed_charges*. - -**Note:** - -* This API will not generate a renewal invoice if an [advance invoice](https://www.chargebee.com/docs/advance-invoices.html) is already present for the subscription. -* For 'Non Renewing' subscriptions, only the [delayed charges](https://www.chargebee.com/docs/charges.html) will be included in the invoice estimate. -* This API is not supported for 'Cancelled' subscriptions. -* Only the subscription's charges will be included. If you have enabled the Consolidated invoicing feature, use the *Upcoming Invoices* estimate available for the Customer object to get the actual estimate invoice for the customer. - - */ - - include_delayed_charges?:boolean; - - /** - * @description This returns an estimate of the amount that will be charged when the subscription is billed next. The estimate is calculated based on the current recurring items of the subscription - plan, addons, and coupons. + * @description Generates an estimate for the 'resume subscription' operation. This is similar to the [Resume a subscription](/docs/api/subscriptions#resume_a_subscription) API, but the subscription will not be resumed. Only an estimate for this operation is created. In the response, -* **estimate.subscription_estimate** has the current subscription details like its status, next billing date, and so on. -* **estimate.invoice_estimate** has details of the invoice that will be generated at the next billing date. - - The generated invoice estimate will include all the balances - [Promotional Credits](https://www.chargebee.com/docs/promotional-credits.html), Refundable Credits, and Excess Payments - if any. If you don't want these balances to be included you can specify 'false' for the parameter *use_existing_balances*. - - To exclude the [delayed charges](https://www.chargebee.com/docs/charges.html) from the invoice estimate, specify 'false' for the parameter *include_delayed_charges*. +* **estimate.subscription_estimate** has the subscription details. +* **estimate.invoice_estimate** has details of the invoice that will be generated immediately. This will not be present if no immediate invoice is generated for this operation. This will happen for in-term resumption^++^. -**Note:** + **^++^What is an "in-term resumption"?** + An "in-term resumption" is when the resumption happens within the billing term of the subscription. +* **estimate.next_invoice_estimate** has details of the invoice that will be generated during the next billing date of this subscription. This will be present only if no immediate invoice is generated during this operation (scenario mentioned above) and this subscription has next billing. -* This API will not generate a renewal invoice if an [advance invoice](https://www.chargebee.com/docs/advance-invoices.html) is already present for the subscription. -* For 'Non Renewing' subscriptions, only the [delayed charges](https://www.chargebee.com/docs/charges.html) will be included in the invoice estimate. -* This API is not supported for 'Cancelled' subscriptions. -* Only the subscription's charges will be included. If you have enabled the Consolidated invoicing feature, use the *Upcoming Invoices* estimate available for the Customer object to get the actual estimate invoice for the customer. + The generated invoice_estimate/next_invoice_estimate will include all the balances - [Promotional Credits](https://www.chargebee.com/docs/promotional-credits.html), Refundable Credits, and Excess Payments - if any. */ - - use_existing_balances?:boolean; + + resume_subscription(subscription_id:string, input?:ResumeSubscriptionInputParam):ChargebeeRequest; /** - * @description This returns an estimate of the amount that will be charged when the subscription is billed next. The estimate is calculated based on the current recurring items of the subscription - plan, addons, and coupons. - -In the response, - -* **estimate.subscription_estimate** has the current subscription details like its status, next billing date, and so on. -* **estimate.invoice_estimate** has details of the invoice that will be generated at the next billing date. - - The generated invoice estimate will include all the balances - [Promotional Credits](https://www.chargebee.com/docs/promotional-credits.html), Refundable Credits, and Excess Payments - if any. If you don't want these balances to be included you can specify 'false' for the parameter *use_existing_balances*. - - To exclude the [delayed charges](https://www.chargebee.com/docs/charges.html) from the invoice estimate, specify 'false' for the parameter *include_delayed_charges*. - -**Note:** - -* This API will not generate a renewal invoice if an [advance invoice](https://www.chargebee.com/docs/advance-invoices.html) is already present for the subscription. -* For 'Non Renewing' subscriptions, only the [delayed charges](https://www.chargebee.com/docs/charges.html) will be included in the invoice estimate. -* This API is not supported for 'Cancelled' subscriptions. -* Only the subscription's charges will be included. If you have enabled the Consolidated invoicing feature, use the *Upcoming Invoices* estimate available for the Customer object to get the actual estimate invoice for the customer. + * @description This endpoint generates an estimate for a subscription that is intended to be a gift. The estimate provides details about the gift sender, gift recipient, address details of the recipient, and the type and details of subscription items included in the gift. */ - - ignore_scheduled_cancellation?:boolean; + + gift_subscription_for_items(input?:GiftSubscriptionForItemsInputParam):ChargebeeRequest; /** - * @description This returns an estimate of the amount that will be charged when the subscription is billed next. The estimate is calculated based on the current recurring items of the subscription - plan, addons, and coupons. - -In the response, - -* **estimate.subscription_estimate** has the current subscription details like its status, next billing date, and so on. -* **estimate.invoice_estimate** has details of the invoice that will be generated at the next billing date. - - The generated invoice estimate will include all the balances - [Promotional Credits](https://www.chargebee.com/docs/promotional-credits.html), Refundable Credits, and Excess Payments - if any. If you don't want these balances to be included you can specify 'false' for the parameter *use_existing_balances*. - - To exclude the [delayed charges](https://www.chargebee.com/docs/charges.html) from the invoice estimate, specify 'false' for the parameter *include_delayed_charges*. - -**Note:** - -* This API will not generate a renewal invoice if an [advance invoice](https://www.chargebee.com/docs/advance-invoices.html) is already present for the subscription. -* For 'Non Renewing' subscriptions, only the [delayed charges](https://www.chargebee.com/docs/charges.html) will be included in the invoice estimate. -* This API is not supported for 'Cancelled' subscriptions. -* Only the subscription's charges will be included. If you have enabled the Consolidated invoicing feature, use the *Upcoming Invoices* estimate available for the Customer object to get the actual estimate invoice for the customer. + * @description This endpoint creates an invoice estimate for non-recurring items. */ - - ignore_scheduled_changes?:boolean; + + create_invoice_for_items(input?:CreateInvoiceForItemsInputParam):ChargebeeRequest; } export interface CreateSubItemEstimateResponse { estimate:Estimate; @@ -461,291 +364,109 @@ In the response, item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; } - export interface CancelSubscriptionForItemsResponse { + export interface CreateSubItemForCustomerEstimateResponse { estimate:Estimate; } - export interface CancelSubscriptionForItemsInputParam { + export interface CreateSubItemForCustomerEstimateInputParam { /** - * @description Set this to `true` if you want to cancel the subscription at the end of the current subscription billing cycle. The subscription `status` changes to `non_renewing`. + * @description The generated invoice_estimate/next_invoice_estimate will include all the balances - Promotional Credits, Refundable Credits, and Excess Payments - if any. If you don't want these balances to be included you can specify 'false' for the parameter *use_existing_balances*. */ - end_of_term?:boolean; + use_existing_balances?:boolean; /** - * @description Specify the date/time at which you want to cancel the subscription. This parameter should not be provided when `end_of_term` is passed as `true`. `cancel_at` can be set to a value in the past. This is called backdating. Use backdating when the subscription has been canceled already but its billing has been delayed. The following prerequisites must be met to allow backdating: - -* Backdating must be enabled for subscription cancellation. -* The current day of the month does not exceed the limit set in Chargebee for backdating subscription cancellation. This limit is typically the day of the month by which the accounting for the previous month must be closed. -* The date is on or after `current_term_start`. -* The date is on or after the last date/time any of the following changes were made: - * Changes in the recurring items or their prices. - * Addition of non-recurring items. -* The date is not more than duration X into the past where X is the billing period of the plan. For example, if the period of the subscription's plan is 2 months and today is 14th April, `changes_scheduled_at` cannot be earlier than 14th February. -. + * @description If there are charges raised immediately for the subscription, this parameter specifies whether those charges are to be invoiced immediately or added to [unbilled charges](https://www.chargebee.com/docs/unbilled-charges.html). The default value is as per the [site settings](https://www.chargebee.com/docs/unbilled-charges.html#configuration). +**Note:** `invoice_immediately` only affects charges that are raised at the time of execution of this API call. Any charges scheduled to be raised in the future are not affected by this parameter. . */ - cancel_at?:number; + invoice_immediately?:boolean; /** - * @description For immediate cancellation (`end_of_term` = `false`), specify how to provide credits for current term charges. When not provided, the [site default](https://www.chargebee.com/docs/cancellations.html#configure-subscription-cancellation) is considered. \* none - No credits notes are created. \* full - Credits are issues for the full value of the current term charges. \* prorate - Prorated credits are issued. + * @description The number of billing cycles the subscription runs before canceling. If not provided, then the billing cycles [set for the plan-item price](https://apidocs.chargebee.com/docs/api/item_prices?prod_cat_ver=2#item_price_billing_cycles) is used. */ - credit_option_for_current_term_charges?:CreditOptionForCurrentTermCharges; + billing_cycles?:number; /** - * @description For immediate cancellation (`end_of_term` = `false`), specify how to handle any unbilled charges. When not provided, the [site default](https://www.chargebee.com/docs/cancellations.html#configure-subscription-cancellation) is considered. \* invoice - An invoice is generated immediately with the unbilled charges. \* delete - The unbilled charges are deleted. + * @description Item ids of [mandatorily attached addons](./attached_items?prod_cat_ver=2) that are to be removed from the subscription. */ - unbilled_charges_option?:UnbilledChargesOption; + mandatory_items_to_remove?:string[]; /** - * @description Applicable when the subscription has past due invoices. Specify this if you want to close the due invoices of the subscription. If specified as schedule_payment_collection/write_off, the due invoices of the subscription will be qualified for the selected operation after the remaining refundable credits and excess payments are applied. **Note:** The payment collection attempt will be asynchronous. Not applicable when 'end_of_term' is true. \* no_action - No action is taken. \* write_off - The amount due in the invoices will be written-off. Credit notes created due to write-off will not be sent in the response. \* schedule_payment_collection - An automatic charge for the due amount of the past invoices will be attempted on the payment method available, if customer's auto-collection property is 'ON'. + * @description The number of subscription billing cycles (including the first one) to [invoice in advance](https://www.chargebee.com/docs/advance-invoices.html). */ - account_receivables_handling?:AccountReceivablesHandling; + terms_to_charge?:number; /** - * @description Applicable when the customer has remaining refundable credits(issued against online payments). If specified as schedule_refund, the refund will be initiated for these credits after they are applied against the subscription's past due invoices if any. **Note:** The refunds initiated will be asynchronous. Not applicable when 'end_of_term' is true. \* schedule_refund - Initiates refund of the remaining credits. \* no_action - No action is taken. + * @description Override the [billing alignment mode](https://www.chargebee.com/docs/calendar-billing.html#alignment-of-billing-date) for Calendar Billing. Only applicable when using Calendar Billing. The default value is that which has been configured for the site. \* delayed - Subscription period will be aligned with the configured billing date at the next renewal. \* immediate - Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly.. */ - refundable_credits_handling?:RefundableCreditsHandling; + billing_alignment_mode?:BillingAlignmentMode; /** - * @description Cancels the current contract term. - -* `terminate_immediately` immediately does the following: - * sets the contract term [`status`](contract_terms#contract_term_status) to `terminated`. - * Cancels the subscription. - * Collects any [termination fee](contract_terms#termintation_fee). -* `end_of_contract_term` Sets the [`contract_term[action_at_term_end]`](contract_terms#contract_term_action_at_term_end) to `cancel`. In other words, the contract term is not renewed and the subscription is canceled at the end of the contract term. -. \* terminate_immediately - Terminate immediately \* end_of_contract_term - End of contract term + * @description The document date displayed on the invoice PDF. By default, it is the date of creation of the invoice or, when Metered Billing is enabled, it can be the date of closing the invoice. Provide this value to backdate the invoice (set the invoice date to a value in the past). Backdating an invoice is done for reasons such as booking revenue for a previous date or when the non-recurring charge is effective as of a past date. `taxes` and `line_item_taxes` are computed based on the tax configuration as of this date. The date should not be more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December. */ - contract_term_cancel_option?:ContractTermCancelOption; + invoice_date?:number; /** - * @description The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if `create_pending_invoices` is `true`, and if the site is configured to set invoice dates to date of closing, then upon invoice closure, this date is changed to the invoice closing date. `taxes` and `line_item_taxes` are computed based on the `tax` configuration as of `invoice_date`. When passing this parameter, the following prerequisites must be met: - -* `invoice_date` must be in the past. -* `invoice_date` is not more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December. -* It is not earlier than `cancel_at`. -. - - */ - - invoice_date?:number; - - /** - * @description Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Subscriptions \> Subscription Cancellation**. Must be passed if set as mandatory in the app. The codes are case-sensitive. - - */ - - cancel_reason_code?:string; - - /** - * @description Parameters for subscription_items - - */ - - subscription_items?:{item_price_id?:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,unit_price?:number,unit_price_in_decimal?:string}[]; - } - export interface ResumeSubscriptionResponse { - estimate:Estimate; - } - export interface ResumeSubscriptionInputParam { - - /** - * @description List of options to resume the subscription. \* immediately - Resume immediately \* specific_date - Resume on a specific date - - */ - - resume_option?:ResumeOption; - - /** - * @description Applicable when charges get added during this operation and **resume_option** is set as 'immediately'. Allows to raise invoice immediately or add them to unbilled charges. \* add_to_unbilled_charges - Add to unbilled charges \* invoice_immediately - Invoice immediately - - */ - - charges_handling?:ChargesHandling; - - /** - * @description Parameters for subscription - - */ - - subscription?:{resume_date?:number}; - } - export interface CreateInvoiceForItemsResponse { - estimate:Estimate; - } - export interface CreateInvoiceForItemsInputParam { - - /** - * @description The currency code (ISO 4217 format) of the invoice amount. - - */ - - currency_code?:string; - - /** - * @description A note for this particular invoice. This, and [all other notes](/docs/api/invoices#invoice_notes) for the invoice are displayed on the PDF invoice sent to the customer. - - */ - - invoice_note?:string; - - /** - * @description Set as `true` to remove the **[general note](https://www.chargebee.com/docs/invoice_notes.html#adding-general-notes)** from this invoice. - - */ - - remove_general_note?:boolean; - - /** - * @description List of Coupons to be added. + * @description List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. */ coupon_ids?:string[]; /** - * @description Authorization transaction to be captured. - - */ - - authorization_transaction_id?:string; - - /** - * @description Payment source to be used for this payment. - - */ - - payment_source_id?:string; - - /** - * @description The customer level auto collection will be override if specified. \* on - Whenever an invoice is created, an automatic attempt will be made to charge. \* off - Whenever an invoice is created as payment due. - - */ - - auto_collection?:AutoCollection; - - /** - * @description The document date displayed on the invoice PDF. By default, it is the date of creation of the invoice or, when Metered Billing is enabled, it can be the date of closing the invoice. Provide this value to backdate the invoice (set the invoice date to a value in the past). Backdating an invoice is done for reasons such as booking revenue for a previous date or when the non-recurring charge is effective as of a past date. `taxes` and `line_item_taxes` are computed based on the tax configuration as of this date. The date should not be more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December. - - */ - - invoice_date?:number; - - /** - * @description Parameters for invoice + * @description Parameters for subscription */ - invoice?:{customer_id?:string,po_number?:string,subscription_id?:string}; + subscription?:{contract_term_billing_cycle_on_renewal?:number,free_period?:number,free_period_unit?:FreePeriodUnit,id?:string,start_date?:number,trial_end?:number,trial_end_action?:TrialEndAction}; /** * @description Parameters for shipping_address */ - 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}; - - /** - * @description Parameters for item_prices - - */ - - item_prices?:{date_from?:number,date_to?:number,item_price_id?:string,quantity?:number,quantity_in_decimal?:string,unit_price?:number,unit_price_in_decimal?:string}[]; - - /** - * @description Parameters for item_tiers - - */ - - item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; + shipping_address?:{city?:string,country?:string,line1?:string,line2?:string,line3?:string,state_code?:string,validation_status?:ValidationStatus,zip?:string}; /** - * @description Parameters for charges + * @description Parameters for contract_term */ - charges?:{amount?:number,amount_in_decimal?:string,avalara_sale_type?:AvalaraSaleType,avalara_service_type?:number,avalara_tax_code?:string,avalara_transaction_type?:number,date_from?:number,date_to?:number,description?:string,hsn_code?:string,tax_profile_id?:string,taxable?:boolean,taxjar_product_code?:string}[]; + contract_term?:{action_at_term_end?:'cancel' | 'renew' | 'evergreen',cancellation_cutoff_period?:number}; /** - * @description Parameters for notes_to_remove + * @description Parameters for subscription_items */ - notes_to_remove?:{entity_id?:string,entity_type?:EntityType}[]; + subscription_items?:{billing_cycles?:number,charge_on_event?:ChargeOnEvent,charge_on_option?:ChargeOnOption,charge_once?:boolean,item_price_id:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,trial_end?:number,unit_price?:number,unit_price_in_decimal?:string}[]; /** * @description Parameters for discounts */ - discounts?:{amount?:number,apply_on:ApplyOn,item_price_id?:string,percentage?:number}[]; - } - export interface GiftSubscriptionForItemsResponse { - estimate:Estimate; - } - export interface GiftSubscriptionForItemsInputParam { - - /** - * @description List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. - - */ - - coupon_ids?:string[]; - - /** - * @description Parameters for gift - - */ - - gift?:{auto_claim?:boolean,claim_expiry_date?:number,no_expiry?:boolean,scheduled_at?:number}; - - /** - * @description Parameters for gifter - - */ - - gifter?:{customer_id:string,note?:string,payment_src_id?:string,signature:string}; - - /** - * @description Parameters for gift_receiver - - */ - - gift_receiver?:{customer_id:string,email:string,first_name:string,last_name:string}; - - /** - * @description Parameters for payment_intent - - */ - - payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'sofort' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'card',reference_id?:string}; - - /** - * @description Parameters for shipping_address - - */ - - 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}; + discounts?:{amount?:number,apply_on:ApplyOn,duration_type:DurationType,included_in_mrr?:boolean,item_price_id?:string,percentage?:number,period?:number,period_unit?:PeriodUnit}[]; /** - * @description Parameters for subscription_items + * @description Parameters for item_tiers */ - subscription_items?:{item_price_id?:string,quantity?:number,quantity_in_decimal?:string}[]; + item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; } export interface UpdateSubscriptionForItemsResponse { estimate:Estimate; @@ -940,147 +661,182 @@ An immediate previous change was made item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; } - export interface UpcomingInvoicesEstimateResponse { - estimate:Estimate; - } - - export interface RegenerateInvoiceEstimateResponse { + export interface RenewalEstimateResponse { estimate:Estimate; } - export interface RegenerateInvoiceEstimateInputParam { + export interface RenewalEstimateInputParam { /** - * @description The start date of the period being invoiced. The default value is [current_term_start](https://apidocs.chargebee.com/docs/api/subscriptions#subscription_current_term_start ). + * @description This returns an estimate of the amount that will be charged when the subscription is billed next. The estimate is calculated based on the current recurring items of the subscription - plan, addons, and coupons. - */ - - date_from?:number; - - /** - * @description The end date of the period being invoiced. The default value is [current_term_end](https://apidocs.chargebee.com/docs/api/subscriptions#subscription_current_term_end ). +In the response, - */ - - date_to?:number; - - /** - * @description Whether the charges should be prorated according to the term specified by `date_from` and `date_to`. Should not be passed without `date_from` and `date_to`. +* **estimate.subscription_estimate** has the current subscription details like its status, next billing date, and so on. +* **estimate.invoice_estimate** has details of the invoice that will be generated at the next billing date. - */ - - prorate?:boolean; - - /** - * @description Only applicable when [Consolidated Invoicing](https://www.chargebee.com/docs/consolidated-invoicing.html ) is enabled for the customer. Set to `false` to leave the current term charge for the subscription as [unbilled](https://www.chargebee.com/docs/unbilled-charges.html ). Once you have done this for all suitable subscriptions of the customer, call [Create an invoice for unbilled charges](https://apidocs.chargebee.com/docs/api/unbilled_charges#create_an_invoice_for_unbilled_charges ) to invoice them. + The generated invoice estimate will include all the balances - [Promotional Credits](https://www.chargebee.com/docs/promotional-credits.html), Refundable Credits, and Excess Payments - if any. If you don't want these balances to be included you can specify 'false' for the parameter *use_existing_balances*. - */ - - invoice_immediately?:boolean; - } - export interface CreateSubItemForCustomerEstimateResponse { - estimate:Estimate; - } - export interface CreateSubItemForCustomerEstimateInputParam { - - /** - * @description The generated invoice_estimate/next_invoice_estimate will include all the balances - Promotional Credits, Refundable Credits, and Excess Payments - if any. If you don't want these balances to be included you can specify 'false' for the parameter *use_existing_balances*. + To exclude the [delayed charges](https://www.chargebee.com/docs/charges.html) from the invoice estimate, specify 'false' for the parameter *include_delayed_charges*. - */ - - use_existing_balances?:boolean; - - /** - * @description If there are charges raised immediately for the subscription, this parameter specifies whether those charges are to be invoiced immediately or added to [unbilled charges](https://www.chargebee.com/docs/unbilled-charges.html). The default value is as per the [site settings](https://www.chargebee.com/docs/unbilled-charges.html#configuration). -**Note:** `invoice_immediately` only affects charges that are raised at the time of execution of this API call. Any charges scheduled to be raised in the future are not affected by this parameter. . +**Note:** - */ - - invoice_immediately?:boolean; - - /** - * @description The number of billing cycles the subscription runs before canceling. If not provided, then the billing cycles [set for the plan-item price](https://apidocs.chargebee.com/docs/api/item_prices?prod_cat_ver=2#item_price_billing_cycles) is used. +* This API will not generate a renewal invoice if an [advance invoice](https://www.chargebee.com/docs/advance-invoices.html) is already present for the subscription. +* For 'Non Renewing' subscriptions, only the [delayed charges](https://www.chargebee.com/docs/charges.html) will be included in the invoice estimate. +* This API is not supported for 'Cancelled' subscriptions. +* Only the subscription's charges will be included. If you have enabled the Consolidated invoicing feature, use the *Upcoming Invoices* estimate available for the Customer object to get the actual estimate invoice for the customer. */ - - billing_cycles?:number; + + include_delayed_charges?:boolean; /** - * @description Item ids of [mandatorily attached addons](./attached_items?prod_cat_ver=2) that are to be removed from the subscription. + * @description This returns an estimate of the amount that will be charged when the subscription is billed next. The estimate is calculated based on the current recurring items of the subscription - plan, addons, and coupons. + +In the response, + +* **estimate.subscription_estimate** has the current subscription details like its status, next billing date, and so on. +* **estimate.invoice_estimate** has details of the invoice that will be generated at the next billing date. + + The generated invoice estimate will include all the balances - [Promotional Credits](https://www.chargebee.com/docs/promotional-credits.html), Refundable Credits, and Excess Payments - if any. If you don't want these balances to be included you can specify 'false' for the parameter *use_existing_balances*. + + To exclude the [delayed charges](https://www.chargebee.com/docs/charges.html) from the invoice estimate, specify 'false' for the parameter *include_delayed_charges*. + +**Note:** + +* This API will not generate a renewal invoice if an [advance invoice](https://www.chargebee.com/docs/advance-invoices.html) is already present for the subscription. +* For 'Non Renewing' subscriptions, only the [delayed charges](https://www.chargebee.com/docs/charges.html) will be included in the invoice estimate. +* This API is not supported for 'Cancelled' subscriptions. +* Only the subscription's charges will be included. If you have enabled the Consolidated invoicing feature, use the *Upcoming Invoices* estimate available for the Customer object to get the actual estimate invoice for the customer. */ - - mandatory_items_to_remove?:string[]; + + use_existing_balances?:boolean; /** - * @description The number of subscription billing cycles (including the first one) to [invoice in advance](https://www.chargebee.com/docs/advance-invoices.html). + * @description This returns an estimate of the amount that will be charged when the subscription is billed next. The estimate is calculated based on the current recurring items of the subscription - plan, addons, and coupons. + +In the response, + +* **estimate.subscription_estimate** has the current subscription details like its status, next billing date, and so on. +* **estimate.invoice_estimate** has details of the invoice that will be generated at the next billing date. + + The generated invoice estimate will include all the balances - [Promotional Credits](https://www.chargebee.com/docs/promotional-credits.html), Refundable Credits, and Excess Payments - if any. If you don't want these balances to be included you can specify 'false' for the parameter *use_existing_balances*. + + To exclude the [delayed charges](https://www.chargebee.com/docs/charges.html) from the invoice estimate, specify 'false' for the parameter *include_delayed_charges*. + +**Note:** + +* This API will not generate a renewal invoice if an [advance invoice](https://www.chargebee.com/docs/advance-invoices.html) is already present for the subscription. +* For 'Non Renewing' subscriptions, only the [delayed charges](https://www.chargebee.com/docs/charges.html) will be included in the invoice estimate. +* This API is not supported for 'Cancelled' subscriptions. +* Only the subscription's charges will be included. If you have enabled the Consolidated invoicing feature, use the *Upcoming Invoices* estimate available for the Customer object to get the actual estimate invoice for the customer. */ + + ignore_scheduled_cancellation?:boolean; - terms_to_charge?:number; + /** + * @description This returns an estimate of the amount that will be charged when the subscription is billed next. The estimate is calculated based on the current recurring items of the subscription - plan, addons, and coupons. + +In the response, + +* **estimate.subscription_estimate** has the current subscription details like its status, next billing date, and so on. +* **estimate.invoice_estimate** has details of the invoice that will be generated at the next billing date. + + The generated invoice estimate will include all the balances - [Promotional Credits](https://www.chargebee.com/docs/promotional-credits.html), Refundable Credits, and Excess Payments - if any. If you don't want these balances to be included you can specify 'false' for the parameter *use_existing_balances*. + + To exclude the [delayed charges](https://www.chargebee.com/docs/charges.html) from the invoice estimate, specify 'false' for the parameter *include_delayed_charges*. + +**Note:** + +* This API will not generate a renewal invoice if an [advance invoice](https://www.chargebee.com/docs/advance-invoices.html) is already present for the subscription. +* For 'Non Renewing' subscriptions, only the [delayed charges](https://www.chargebee.com/docs/charges.html) will be included in the invoice estimate. +* This API is not supported for 'Cancelled' subscriptions. +* Only the subscription's charges will be included. If you have enabled the Consolidated invoicing feature, use the *Upcoming Invoices* estimate available for the Customer object to get the actual estimate invoice for the customer. + + */ + + ignore_scheduled_changes?:boolean; + } + export interface AdvanceInvoiceEstimateResponse { + estimate:Estimate; + } + export interface AdvanceInvoiceEstimateInputParam { /** - * @description Override the [billing alignment mode](https://www.chargebee.com/docs/calendar-billing.html#alignment-of-billing-date) for Calendar Billing. Only applicable when using Calendar Billing. The default value is that which has been configured for the site. \* delayed - Subscription period will be aligned with the configured billing date at the next renewal. \* immediate - Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly.. + * @description * For `schedule_type = immediate`: the number of future billing cycles to be invoiced in advance. The invoicing is done for the [`remaining_billing_cycles`](subscriptions#subscription_remaining_billing_cycles) of the subscription if that is less than `terms_to_charge`. +* For `schedule_type = fixed_intervals`: The number of future billing cycles in one [interval](advance_invoice_schedules#fixed_interval_schedule). The schedule is created such that the total number of billing cycles in the schedule does not exceed the [remaining_billing_cycles](subscriptions#subscription_remaining_billing_cycles) of the subscription. +. */ - billing_alignment_mode?:BillingAlignmentMode; + terms_to_charge?:number; /** - * @description The document date displayed on the invoice PDF. By default, it is the date of creation of the invoice or, when Metered Billing is enabled, it can be the date of closing the invoice. Provide this value to backdate the invoice (set the invoice date to a value in the past). Backdating an invoice is done for reasons such as booking revenue for a previous date or when the non-recurring charge is effective as of a past date. `taxes` and `line_item_taxes` are computed based on the tax configuration as of this date. The date should not be more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December. + * @description Whether the charge should be invoiced immediately or added to [`unbilled_charges`](unbilled_charges). Applicable only when [`schedule_type`](subscriptions#charge_future_renewals_schedule_type) is `immediate`. */ - invoice_date?:number; + invoice_immediately?:boolean; /** - * @description List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. + * @description The type of advance invoice or advance invoicing schedule. \* immediate - Charge immediately for the number of billing cycles specified by [`terms_to_charge`](subscriptions#charge_future_renewals_terms_to_charge). \* specific_dates - Charge on [specific dates](subscriptions#charge_future_renewals_specific_dates_schedule_date). For each date, specify the [number of billing cycles](subscriptions#charge_future_renewals_specific_dates_schedule_terms_to_charge) to charge for. Up to 5 dates can be configured. \* fixed_intervals - Charge at fixed intervals of time. Specify the [number of billing cycles](subscriptions#charge_future_renewals_terms_to_charge) that constitute an interval and the number of [days before each interval](subscriptions#charge_future_renewals_fixed_interval_schedule_days_before_renewal) that the invoice should be generated. Also specify [when the schedule should end](subscriptions#charge_future_renewals_fixed_interval_schedule_end_schedule_on). */ - coupon_ids?:string[]; + schedule_type?:ScheduleType; /** - * @description Parameters for subscription + * @description Parameters for fixed_interval_schedule */ - subscription?:{contract_term_billing_cycle_on_renewal?:number,free_period?:number,free_period_unit?:FreePeriodUnit,id?:string,start_date?:number,trial_end?:number,trial_end_action?:TrialEndAction}; + fixed_interval_schedule?:{days_before_renewal?:number,end_date?:number,end_schedule_on?:EndScheduleOn,number_of_occurrences?:number}; /** - * @description Parameters for shipping_address + * @description Parameters for specific_dates_schedule */ - shipping_address?:{city?:string,country?:string,line1?:string,line2?:string,line3?:string,state_code?:string,validation_status?:ValidationStatus,zip?:string}; + specific_dates_schedule?:{date?:number,terms_to_charge?:number}[]; + } + export interface RegenerateInvoiceEstimateResponse { + estimate:Estimate; + } + export interface RegenerateInvoiceEstimateInputParam { /** - * @description Parameters for contract_term + * @description The start date of the period being invoiced. The default value is [current_term_start](https://apidocs.chargebee.com/docs/api/subscriptions#subscription_current_term_start ). */ - contract_term?:{action_at_term_end?:'cancel' | 'renew' | 'evergreen',cancellation_cutoff_period?:number}; + date_from?:number; /** - * @description Parameters for subscription_items + * @description The end date of the period being invoiced. The default value is [current_term_end](https://apidocs.chargebee.com/docs/api/subscriptions#subscription_current_term_end ). */ - subscription_items?:{billing_cycles?:number,charge_on_event?:ChargeOnEvent,charge_on_option?:ChargeOnOption,charge_once?:boolean,item_price_id:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,trial_end?:number,unit_price?:number,unit_price_in_decimal?:string}[]; + date_to?:number; /** - * @description Parameters for discounts + * @description Whether the charges should be prorated according to the term specified by `date_from` and `date_to`. Should not be passed without `date_from` and `date_to`. */ - discounts?:{amount?:number,apply_on:ApplyOn,duration_type:DurationType,included_in_mrr?:boolean,item_price_id?:string,percentage?:number,period?:number,period_unit?:PeriodUnit}[]; + prorate?:boolean; /** - * @description Parameters for item_tiers + * @description Only applicable when [Consolidated Invoicing](https://www.chargebee.com/docs/consolidated-invoicing.html ) is enabled for the customer. Set to `false` to leave the current term charge for the subscription as [unbilled](https://www.chargebee.com/docs/unbilled-charges.html ). Once you have done this for all suitable subscriptions of the customer, call [Create an invoice for unbilled charges](https://apidocs.chargebee.com/docs/api/unbilled_charges#create_an_invoice_for_unbilled_charges ) to invoice them. */ - item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; + invoice_immediately?:boolean; + } + export interface UpcomingInvoicesEstimateResponse { + estimate:Estimate; } + export interface ChangeTermEndResponse { estimate:Estimate; } @@ -1108,6 +864,102 @@ An immediate previous change was made invoice_immediately?:boolean; } + export interface CancelSubscriptionForItemsResponse { + estimate:Estimate; + } + export interface CancelSubscriptionForItemsInputParam { + + /** + * @description Set this to `true` if you want to cancel the subscription at the end of the current subscription billing cycle. The subscription `status` changes to `non_renewing`. + + */ + + end_of_term?:boolean; + + /** + * @description Specify the date/time at which you want to cancel the subscription. This parameter should not be provided when `end_of_term` is passed as `true`. `cancel_at` can be set to a value in the past. This is called backdating. Use backdating when the subscription has been canceled already but its billing has been delayed. The following prerequisites must be met to allow backdating: + +* Backdating must be enabled for subscription cancellation. +* The current day of the month does not exceed the limit set in Chargebee for backdating subscription cancellation. This limit is typically the day of the month by which the accounting for the previous month must be closed. +* The date is on or after `current_term_start`. +* The date is on or after the last date/time any of the following changes were made: + * Changes in the recurring items or their prices. + * Addition of non-recurring items. +* The date is not more than duration X into the past where X is the billing period of the plan. For example, if the period of the subscription's plan is 2 months and today is 14th April, `changes_scheduled_at` cannot be earlier than 14th February. +. + + */ + + cancel_at?:number; + + /** + * @description For immediate cancellation (`end_of_term` = `false`), specify how to provide credits for current term charges. When not provided, the [site default](https://www.chargebee.com/docs/cancellations.html#configure-subscription-cancellation) is considered. \* none - No credits notes are created. \* full - Credits are issues for the full value of the current term charges. \* prorate - Prorated credits are issued. + + */ + + credit_option_for_current_term_charges?:CreditOptionForCurrentTermCharges; + + /** + * @description For immediate cancellation (`end_of_term` = `false`), specify how to handle any unbilled charges. When not provided, the [site default](https://www.chargebee.com/docs/cancellations.html#configure-subscription-cancellation) is considered. \* invoice - An invoice is generated immediately with the unbilled charges. \* delete - The unbilled charges are deleted. + + */ + + unbilled_charges_option?:UnbilledChargesOption; + + /** + * @description Applicable when the subscription has past due invoices. Specify this if you want to close the due invoices of the subscription. If specified as schedule_payment_collection/write_off, the due invoices of the subscription will be qualified for the selected operation after the remaining refundable credits and excess payments are applied. **Note:** The payment collection attempt will be asynchronous. Not applicable when 'end_of_term' is true. \* no_action - No action is taken. \* write_off - The amount due in the invoices will be written-off. Credit notes created due to write-off will not be sent in the response. \* schedule_payment_collection - An automatic charge for the due amount of the past invoices will be attempted on the payment method available, if customer's auto-collection property is 'ON'. + + */ + + account_receivables_handling?:AccountReceivablesHandling; + + /** + * @description Applicable when the customer has remaining refundable credits(issued against online payments). If specified as schedule_refund, the refund will be initiated for these credits after they are applied against the subscription's past due invoices if any. **Note:** The refunds initiated will be asynchronous. Not applicable when 'end_of_term' is true. \* schedule_refund - Initiates refund of the remaining credits. \* no_action - No action is taken. + + */ + + refundable_credits_handling?:RefundableCreditsHandling; + + /** + * @description Cancels the current contract term. + +* `terminate_immediately` immediately does the following: + * sets the contract term [`status`](contract_terms#contract_term_status) to `terminated`. + * Cancels the subscription. + * Collects any [termination fee](contract_terms#termintation_fee). +* `end_of_contract_term` Sets the [`contract_term[action_at_term_end]`](contract_terms#contract_term_action_at_term_end) to `cancel`. In other words, the contract term is not renewed and the subscription is canceled at the end of the contract term. +. \* terminate_immediately - Terminate immediately \* end_of_contract_term - End of contract term + + */ + + contract_term_cancel_option?:ContractTermCancelOption; + + /** + * @description The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if `create_pending_invoices` is `true`, and if the site is configured to set invoice dates to date of closing, then upon invoice closure, this date is changed to the invoice closing date. `taxes` and `line_item_taxes` are computed based on the `tax` configuration as of `invoice_date`. When passing this parameter, the following prerequisites must be met: + +* `invoice_date` must be in the past. +* `invoice_date` is not more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December. +* It is not earlier than `cancel_at`. +. + + */ + + invoice_date?:number; + + /** + * @description Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Subscriptions \> Subscription Cancellation**. Must be passed if set as mandatory in the app. The codes are case-sensitive. + + */ + + cancel_reason_code?:string; + + /** + * @description Parameters for subscription_items + + */ + + subscription_items?:{item_price_id?:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,unit_price?:number,unit_price_in_decimal?:string}[]; + } export interface PauseSubscriptionResponse { estimate:Estimate; } @@ -1149,47 +1001,195 @@ If `no_action` is chosen, charges are added to the resumption invoice. subscription?:{pause_date?:number,resume_date?:number,skip_billing_cycles?:number}; } - export interface AdvanceInvoiceEstimateResponse { + export interface ResumeSubscriptionResponse { estimate:Estimate; } - export interface AdvanceInvoiceEstimateInputParam { + export interface ResumeSubscriptionInputParam { /** - * @description * For `schedule_type = immediate`: the number of future billing cycles to be invoiced in advance. The invoicing is done for the [`remaining_billing_cycles`](subscriptions#subscription_remaining_billing_cycles) of the subscription if that is less than `terms_to_charge`. -* For `schedule_type = fixed_intervals`: The number of future billing cycles in one [interval](advance_invoice_schedules#fixed_interval_schedule). The schedule is created such that the total number of billing cycles in the schedule does not exceed the [remaining_billing_cycles](subscriptions#subscription_remaining_billing_cycles) of the subscription. -. + * @description List of options to resume the subscription. \* immediately - Resume immediately \* specific_date - Resume on a specific date */ - terms_to_charge?:number; + resume_option?:ResumeOption; /** - * @description Whether the charge should be invoiced immediately or added to [`unbilled_charges`](unbilled_charges). Applicable only when [`schedule_type`](subscriptions#charge_future_renewals_schedule_type) is `immediate`. + * @description Applicable when charges get added during this operation and **resume_option** is set as 'immediately'. Allows to raise invoice immediately or add them to unbilled charges. \* add_to_unbilled_charges - Add to unbilled charges \* invoice_immediately - Invoice immediately */ - invoice_immediately?:boolean; + charges_handling?:ChargesHandling; /** - * @description The type of advance invoice or advance invoicing schedule. \* immediate - Charge immediately for the number of billing cycles specified by [`terms_to_charge`](subscriptions#charge_future_renewals_terms_to_charge). \* specific_dates - Charge on [specific dates](subscriptions#charge_future_renewals_specific_dates_schedule_date). For each date, specify the [number of billing cycles](subscriptions#charge_future_renewals_specific_dates_schedule_terms_to_charge) to charge for. Up to 5 dates can be configured. \* fixed_intervals - Charge at fixed intervals of time. Specify the [number of billing cycles](subscriptions#charge_future_renewals_terms_to_charge) that constitute an interval and the number of [days before each interval](subscriptions#charge_future_renewals_fixed_interval_schedule_days_before_renewal) that the invoice should be generated. Also specify [when the schedule should end](subscriptions#charge_future_renewals_fixed_interval_schedule_end_schedule_on). + * @description Parameters for subscription */ - schedule_type?:ScheduleType; + subscription?:{resume_date?:number}; + } + export interface GiftSubscriptionForItemsResponse { + estimate:Estimate; + } + export interface GiftSubscriptionForItemsInputParam { /** - * @description Parameters for fixed_interval_schedule + * @description List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. */ - fixed_interval_schedule?:{days_before_renewal?:number,end_date?:number,end_schedule_on?:EndScheduleOn,number_of_occurrences?:number}; + coupon_ids?:string[]; /** - * @description Parameters for specific_dates_schedule + * @description Parameters for gift */ - specific_dates_schedule?:{date?:number,terms_to_charge?:number}[]; + gift?:{auto_claim?:boolean,claim_expiry_date?:number,no_expiry?:boolean,scheduled_at?:number}; + + /** + * @description Parameters for gifter + + */ + + gifter?:{customer_id:string,note?:string,payment_src_id?:string,signature:string}; + + /** + * @description Parameters for gift_receiver + + */ + + gift_receiver?:{customer_id:string,email:string,first_name:string,last_name:string}; + + /** + * @description Parameters for payment_intent + + */ + + payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'faster_payments' | 'sofort' | 'upi' | 'venmo' | 'amazon_payments' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'pay_to' | 'card',reference_id?:string}; + + /** + * @description Parameters for shipping_address + + */ + + 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}; + + /** + * @description Parameters for subscription_items + + */ + + subscription_items?:{item_price_id?:string,quantity?:number,quantity_in_decimal?:string}[]; + } + export interface CreateInvoiceForItemsResponse { + estimate:Estimate; + } + export interface CreateInvoiceForItemsInputParam { + + /** + * @description The currency code (ISO 4217 format) of the invoice amount. + + */ + + currency_code?:string; + + /** + * @description A note for this particular invoice. This, and [all other notes](/docs/api/invoices#invoice_notes) for the invoice are displayed on the PDF invoice sent to the customer. + + */ + + invoice_note?:string; + + /** + * @description Set as `true` to remove the **[general note](https://www.chargebee.com/docs/invoice_notes.html#adding-general-notes)** from this invoice. + + */ + + remove_general_note?:boolean; + + /** + * @description List of Coupons to be added. + + */ + + coupon_ids?:string[]; + + /** + * @description Authorization transaction to be captured. + + */ + + authorization_transaction_id?:string; + + /** + * @description Payment source to be used for this payment. + + */ + + payment_source_id?:string; + + /** + * @description The customer level auto collection will be override if specified. \* on - Whenever an invoice is created, an automatic attempt will be made to charge. \* off - Whenever an invoice is created as payment due. + + */ + + auto_collection?:AutoCollection; + + /** + * @description The document date displayed on the invoice PDF. By default, it is the date of creation of the invoice or, when Metered Billing is enabled, it can be the date of closing the invoice. Provide this value to backdate the invoice (set the invoice date to a value in the past). Backdating an invoice is done for reasons such as booking revenue for a previous date or when the non-recurring charge is effective as of a past date. `taxes` and `line_item_taxes` are computed based on the tax configuration as of this date. The date should not be more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December. + + */ + + invoice_date?:number; + + /** + * @description Parameters for invoice + + */ + + invoice?:{customer_id?:string,po_number?:string,subscription_id?:string}; + + /** + * @description Parameters for shipping_address + + */ + + 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}; + + /** + * @description Parameters for item_prices + + */ + + item_prices?:{date_from?:number,date_to?:number,item_price_id?:string,quantity?:number,quantity_in_decimal?:string,unit_price?:number,unit_price_in_decimal?:string}[]; + + /** + * @description Parameters for item_tiers + + */ + + item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; + + /** + * @description Parameters for charges + + */ + + charges?:{amount?:number,amount_in_decimal?:string,avalara_sale_type?:AvalaraSaleType,avalara_service_type?:number,avalara_tax_code?:string,avalara_transaction_type?:number,date_from?:number,date_to?:number,description?:string,hsn_code?:string,tax_profile_id?:string,taxable?:boolean,taxjar_product_code?:string}[]; + + /** + * @description Parameters for notes_to_remove + + */ + + notes_to_remove?:{entity_id?:string,entity_type?:EntityType}[]; + + /** + * @description Parameters for discounts + + */ + + discounts?:{amount?:number,apply_on:ApplyOn,item_price_id?:string,percentage?:number}[]; } } diff --git a/types/resources/Event.d.ts b/types/resources/Event.d.ts index e5d01be..69e88fc 100644 --- a/types/resources/Event.d.ts +++ b/types/resources/Event.d.ts @@ -17,7 +17,7 @@ declare module 'chargebee' { occurred_at:number; /** - * @description Source of the event \* hosted_page - Operation made through the Hosted Pages \* admin_console - Operation made through the Chargebee admin UI \* external_service - Operation that are triggered via webhook \* portal - Operation made through [Self-Serve Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html) \* system - Operation that are triggered by ChargeBee System \* scheduled_job - Operation made through the Scheduled Jobs \* migration - Deprecated \* none - If no source can be identified for an operation \* api - Operation made through the API \* bulk_operation - Operation that are triggerd through bulk operation. \* js_api - Operation made through the JS API + * @description Source of the event \* admin_console - Operation made through the Chargebee admin UI \* external_service - Operation that are triggered via webhook \* scheduled_job - Operation made through the Scheduled Jobs \* bulk_operation - Operation that are triggerd through bulk operation. \* hosted_page - Operation made through the Hosted Pages \* portal - Operation made through [Self-Serve Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html) \* system - Operation that are triggered by ChargeBee System \* migration - Deprecated \* none - If no source can be identified for an operation \* api - Operation made through the API \* js_api - Operation made through the JS API */ @@ -36,7 +36,7 @@ declare module 'chargebee' { user?:string; /** - * @description The types of event provided by chargebee. Refer [event types](#event_types) for all the event types provided by us currently. \* card_deleted - Sent when a card is deleted for a customer \* customer_deleted - Sent when a customer is deleted \* subscription_cancelled - Sent when the subscription gets cancelled. If cancelled due to non payment or card not present, the subscription will have the possible reason as 'cancel_reason'. \* coupon_deleted - Sent when a coupon is deleted. \* customer_changed - Sent when a customer is changed \* invoice_deleted - Event triggered when an invoice is deleted. \* quote_deleted - Triggered when quote is deleted \* subscription_shipping_address_updated - Triggered when shipping address is added or updated for a subscription. \* differential_price_created - Triggered when a differential price is created \* subscription_created - Sent when a new subscription is created. \* card_updated - Sent when the card is updated for a customer. \* coupon_created - Sent when a coupon is created. \* payment_initiated - Sent when a payment is initiated via direct debit \* quote_created - Triggered when quote is created \* quote_updated - Triggered when quote is updated \* add_usages_reminder - Sent every month day before renewal date of plan's period \* payment_source_added - Sent when a payment source is added for a customer. \* contract_term_created - Triggered when new contract term is created \* business_entity_updated - Sent when a business entity is updated. \* subscription_changed - Sent after the subscription's recurring items have been changed \* customer_created - Sent when a customer is created. This event happens when only a new customer is created or when a customer is automatically created during new subscription creation. \* subscription_deleted - Sent when a subscription has been deleted \* differential_price_deleted - Triggered when a differential price is deleted \* coupon_set_deleted - Sent when a coupon set is deleted \* refund_initiated - Sent when a refund is initiated via direct debit \* transaction_deleted - Triggered when a transaction is deleted. \* order_cancelled - Triggered when order is cancelled \* entitlement_overrides_removed - Triggered when an override entitlement is removed \* coupon_codes_added - Sent when coupon codes are added in coupon set \* item_family_deleted - Triggered when an item family is deleted \* card_added - Sent when a card is added for a customer. \* payment_failed - Sent when attempt to charge customer's credit card fails \* subscription_reactivated_with_backdating - Sent when the subscription is moved from cancelled state to active or in_trial state with past date \* gift_cancelled - Triggered when a gift is cancelled. \* entitlement_overrides_auto_removed - Triggered when Subscription entitlements overrides for a feature are auto removed after expiry \* payment_source_deleted - Sent when a payment source is deleted for a customer \* payment_source_expiring - Sent when the customer's payment source is expiring soon. Sent 30 days before the expiry date. \* credit_note_created - Sent when a credit note is created \* subscription_resumption_scheduled - Triggered when the subscription resumption is scheduled. \* item_price_deleted - Triggered when an item price is deleted \* subscription_advance_invoice_schedule_updated - Triggered when scheduled advance invoice is updated for a subscription. \* item_deleted - Triggered when an item is deleted \* gift_claimed - Triggered when a gift is claimed \* feature_reactivated - Triggered when a feature \`status\` transitions to \`active\` for the second time or more. \* item_price_updated - Triggered when an item price is updated \* order_ready_to_process - Triggered when order reaches it's order date \* subscription_activated - Sent after the subscription has been moved from trial to active state \* subscription_resumed - Sent when the subscription is moved from paused state to active state \* entitlement_overrides_updated - Triggered when an override entitlement is updated \* item_updated - Triggered when an item is updated \* credit_note_deleted - Sent when a credit note is deleted \* subscription_advance_invoice_schedule_added - Triggered when advance invoice is scheduled for a subscription. \* differential_price_updated - Triggered when a differential price is updated \* coupon_set_updated - Sent when a coupon set is changed \* subscription_reactivated - Sent when the subscription is moved from cancelled state to active or in_trial state \* order_deleted - Triggered when order is deleted \* token_expired - Sent when a Token is expired \* addon_updated - Sent when a addon is changed. \* subscription_scheduled_changes_removed - Sent when scheduled change for the subscription is removed. \* transaction_updated - Triggered when a transaction is updated. E.g. (1) When a transaction is removed, (2) or when an excess payment is applied on an invoice, (3) or when amount_capturable gets updated. \* subscription_cancellation_reminder - Sent when the customer's subscription is nearing it's scheduled cancellation date. \* payment_refunded - Sent when a payment refund is made \* subscription_started - Sent when a 'future' subscription gets started at the scheduled date. \* attached_item_created - Triggered when an Attached item is created \* invoice_generated - Event triggered when a new invoice is generated. In case of metered billing, this event is triggered when a "Pending" invoice is closed. \* token_created - Sent when a Token is created \* item_family_created - Triggered when an item family is created \* order_delivered - Triggered when order is marked as delivered \* subscription_created_with_backdating - Sent when a new subscription is created with backdating. \* pending_invoice_created - Event triggered (in the case of metered billing) when a "Pending" invoice is created that has usage related charges or line items to be added, before being closed. This is triggered only when the "Notify for Pending Invoices" option is enabled. \* unbilled_charges_deleted - Triggered when unbilled charges are deleted \* promotional_credits_added - Sent when a customer prmotion credits added \* subscription_canceled_with_backdating - Sent when the subscription gets cancelled. If cancelled due to non payment or card not present, the subscription will have the possible reason as 'cancel_reason'. \* item_entitlements_updated - Triggered when item entitlements are updated to a feature \* card_expired - Sent when a card for a customer is expired \* payment_intent_created - Sent when a Payment intent is created \* subscription_changed_with_backdating - Sent after the subscription's recurring items have been changed with backdated date \* subscription_scheduled_cancellation_removed - Sent when scheduled cancellation is removed for the subscription. \* authorization_succeeded - Triggered when a authorization transaction is created. \* invoice_generated_with_backdating - Event triggered when a new invoice is generated with past date as invoice date. \* feature_updated - Triggered when an feature is updated \* subscription_cancellation_scheduled - Sent when subscription is scheduled to cancel at end of current term \* order_created - Triggered when order is created \* hierarchy_deleted - Triggered when a hierarchy is deleted \* plan_deleted - Sent when a plan is deleted. \* subscription_activated_with_backdating - Sent after the subscription changes to \`active\` from another \`status\`, while the change is backdated. \* plan_updated - Sent when a plan is changed. \* tax_withheld_recorded - Triggered when a tax withheld is recorded for an invoice \* tax_withheld_refunded - Sent when a tax withheld refund is made \* unbilled_charges_voided - Triggered when unbilled charges are voided \* customer_moved_out - Sent when a customer is copied to another site \* credit_note_created_with_backdating - Sent when a credit note is created with past date as credit note date \* gift_updated - Triggered when a gift is updated \* order_resent - Triggered when order is resent \* feature_created - Triggered when a feature is created. \* hierarchy_created - Triggered when a hierarchy is created \* addon_deleted - Sent when a addon is deleted. \* coupon_codes_deleted - Sent when coupon codes are deleted in coupon set \* subscription_paused - Sent when the subscription is paused. \* order_updated - Triggered when order is updated \* unbilled_charges_created - Triggered when unbilled charges are created \* feature_archived - Triggered when an feature is archived \* customer_moved_in - Sent when a customer is copied from another site \* attached_item_deleted - Triggered when an Attached item is deleted \* payment_succeeded - Sent when the payment is successfully collected \* mrr_updated - Sent when either of MRR or CMRR of a subscription changes \* unbilled_charges_invoiced - Triggered when unbilled charges are invoiced \* subscription_pause_scheduled - Sent when the subscription is scheduled to pause. \* order_returned - Triggered when order is marked as returned \* payment_source_expired - Sent when a payment source for a customer is expired \* contract_term_terminated - Triggered when contract term is terminated \* subscription_scheduled_resumption_removed - Triggered when scheduled resumption is removed for the subscription. \* subscription_changes_scheduled - Sent when subscription changes are scheduled for later. Changes will be applied at the end of current term. \* order_ready_to_ship - Triggered when order reaches it's shipping date \* payment_source_updated - Sent when the payment source is updated for a customer or when role is assigned to the payment source. \* pending_invoice_updated - Event triggered when the option "Notify and wait to close invoices" is enabled, and the 'Pending' invoice is updated. \* subscription_advance_invoice_schedule_removed - Triggered when scheduled advance invoice is removed for a subscription. \* tax_withheld_deleted - Triggered when a tax withheld is deleted \* business_entity_created - Sent when a business entity is created. \* item_price_created - Triggered when an item price is created \* purchase_created - Triggered when purchase action completed successfully \* virtual_bank_account_updated - Sent when the virtual bank account is updated for a customer. \* credit_note_updated - Sent when a credit note is updated \* subscription_scheduled_pause_removed - Triggered when scheduled pause is removed for the subscription. \* subscription_trial_end_reminder - Sent when the customer's trial period is about to end. \* feature_activated - Triggered when a feature \`status\` transitions to \`active\` for the first time. \* subscription_renewed - Sent when the subscription is renewed from the current term. \* card_expiry_reminder - Sent when the customer's credit card is expiring soon. Sent 30 days before the expiry date. \* coupon_set_created - Sent when a coupon set is created \* virtual_bank_account_deleted - Sent when a virtual bank account is deleted for a customer. \* gift_scheduled - Triggered when a new gift is created \* business_entity_deleted - Sent when a business entity is deleted. \* plan_created - Sent when a plan is created. \* item_created - Triggered when an item is created \* coupon_codes_updated - Sent when coupon codes are updated \* gift_unclaimed - Triggered when a new gift is unclaimed and is ready to be claimed \* promotional_credits_deducted - Sent when a customer prmotion credits deducted \* subscription_entitlements_created - Triggered when subscription entitlements are created for a new subscription \* contract_term_renewed - Triggered when new contract term is renewed \* item_entitlements_removed - Triggered when item entitlements are removed for a feature \* virtual_bank_account_added - Sent when a virtual bank account is added for a customer. \* gift_expired - Triggered when a gift expires \* contract_term_cancelled - Triggered when contract term is cancelled \* contract_term_completed - Triggered when contract term is completed \* feature_deleted - Triggered when a feature is deleted \* authorization_voided - Triggered when a authorization transaction is voided. Authorization can be voided either manually or when blocked funds are released by the gateway after a certain period of time. \* item_family_updated - Triggered when an item family is updated \* subscription_renewal_reminder - Sent before each subscription's renewal based on plan's period \* addon_created - Sent when a addon is created. \* attached_item_updated - Triggered when an Attached item is updated \* invoice_updated - Triggered when the invoice's shipping/billing address is updated, if the invoice is voided, or when the amount due is modified due to payments applied/removed. \* payment_intent_updated - Sent when a Payment intent is updated \* coupon_updated - Sent when a coupon is changed. \* token_consumed - Sent when a Token is consumed \* transaction_created - Triggered when a transaction is recorded + * @description The types of event provided by chargebee. Refer [event types](#event_types) for all the event types provided by us currently. \* card_deleted - Sent when a card is deleted for a customer \* subscription_cancelled - Sent when the subscription gets cancelled. If cancelled due to non payment or card not present, the subscription will have the possible reason as 'cancel_reason'. \* customer_changed - Sent when a customer is changed \* invoice_deleted - Event triggered when an invoice is deleted. \* subscription_shipping_address_updated - Triggered when shipping address is added or updated for a subscription. \* differential_price_created - Triggered when a differential price is created \* subscription_created - Sent when a new subscription is created. \* payment_initiated - Sent when a payment is initiated via direct debit \* quote_updated - Triggered when quote is updated \* payment_source_added - Sent when a payment source is added for a customer. \* contract_term_created - Triggered when new contract term is created \* subscription_deleted - Sent when a subscription has been deleted \* differential_price_deleted - Triggered when a differential price is deleted \* voucher_created - Triggered when a payment voucher is created \* transaction_deleted - Triggered when a transaction is deleted. \* item_family_deleted - Triggered when an item family is deleted \* product_updated - Triggered when the product update is completed successfully \* payment_failed - Sent when attempt to charge customer's credit card fails \* subscription_reactivated_with_backdating - Sent when the subscription is moved from cancelled state to active or in_trial state with past date \* payment_source_expiring - Sent when the customer's payment source is expiring soon. Sent 30 days before the expiry date. \* item_price_updated - Triggered when an item price is updated \* order_ready_to_process - Triggered when order reaches it's order date \* entitlement_overrides_updated - Triggered when an override entitlement is updated \* item_updated - Triggered when an item is updated \* coupon_set_updated - Sent when a coupon set is changed \* subscription_reactivated - Sent when the subscription is moved from cancelled state to active or in_trial state \* variant_created - Triggered when product variant create completed successfully \* addon_updated - Sent when a addon is changed. \* subscription_scheduled_changes_removed - Sent when scheduled change for the subscription is removed. \* payment_refunded - Sent when a payment refund is made \* subscription_started - Sent when a 'future' subscription gets started at the scheduled date. \* attached_item_created - Triggered when an Attached item is created \* token_created - Sent when a Token is created \* item_family_created - Triggered when an item family is created \* subscription_created_with_backdating - Sent when a new subscription is created with backdating. \* unbilled_charges_deleted - Triggered when unbilled charges are deleted \* promotional_credits_added - Sent when a customer prmotion credits added \* subscription_canceled_with_backdating - Sent when the subscription gets cancelled. If cancelled due to non payment or card not present, the subscription will have the possible reason as 'cancel_reason'. \* item_entitlements_updated - Triggered when item entitlements are updated to a feature \* card_expired - Sent when a card for a customer is expired \* payment_intent_created - Sent when a Payment intent is created \* subscription_changed_with_backdating - Sent after the subscription's recurring items have been changed with backdated date \* subscription_scheduled_cancellation_removed - Sent when scheduled cancellation is removed for the subscription. \* feature_updated - Triggered when an feature is updated \* plan_deleted - Sent when a plan is deleted. \* tax_withheld_refunded - Sent when a tax withheld refund is made \* unbilled_charges_voided - Triggered when unbilled charges are voided \* customer_moved_out - Sent when a customer is copied to another site \* feature_created - Triggered when a feature is created. \* coupon_codes_deleted - Sent when coupon codes are deleted in coupon set \* subscription_paused - Sent when the subscription is paused. \* order_updated - Triggered when order is updated \* unbilled_charges_created - Triggered when unbilled charges are created \* feature_archived - Triggered when an feature is archived \* payment_succeeded - Sent when the payment is successfully collected \* voucher_expired - Triggered when a payment voucher is expired \* mrr_updated - Sent when either of MRR or CMRR of a subscription changes \* subscription_scheduled_resumption_removed - Triggered when scheduled resumption is removed for the subscription. \* subscription_changes_scheduled - Sent when subscription changes are scheduled for later. Changes will be applied at the end of current term. \* order_ready_to_ship - Triggered when order reaches it's shipping date \* purchase_created - Triggered when purchase action completed successfully \* variant_updated - Triggered when product variant update completed successfully \* variant_deleted - Triggered when product variant delete completed successfully \* subscription_trial_end_reminder - Sent when the customer's trial period is about to end. \* feature_activated - Triggered when a feature \`status\` transitions to \`active\` for the first time. \* subscription_renewed - Sent when the subscription is renewed from the current term. \* plan_created - Sent when a plan is created. \* item_created - Triggered when an item is created \* coupon_codes_updated - Sent when coupon codes are updated \* gift_unclaimed - Triggered when a new gift is unclaimed and is ready to be claimed \* subscription_entitlements_created - Triggered when subscription entitlements are created for a new subscription \* virtual_bank_account_added - Sent when a virtual bank account is added for a customer. \* contract_term_completed - Triggered when contract term is completed \* feature_deleted - Triggered when a feature is deleted \* subscription_renewal_reminder - Sent before each subscription's renewal based on plan's period \* coupon_updated - Sent when a coupon is changed. \* token_consumed - Sent when a Token is consumed \* transaction_created - Triggered when a transaction is recorded \* customer_deleted - Sent when a customer is deleted \* coupon_deleted - Sent when a coupon is deleted. \* quote_deleted - Triggered when quote is deleted \* card_updated - Sent when the card is updated for a customer. \* coupon_created - Sent when a coupon is created. \* quote_created - Triggered when quote is created \* add_usages_reminder - Sent every month day before renewal date of plan's period \* business_entity_updated - Sent when a business entity is updated. \* subscription_changed - Sent after the subscription's recurring items have been changed \* customer_created - Sent when a customer is created. This event happens when only a new customer is created or when a customer is automatically created during new subscription creation. \* coupon_set_deleted - Sent when a coupon set is deleted \* refund_initiated - Sent when a refund is initiated via direct debit \* order_cancelled - Triggered when order is cancelled \* entitlement_overrides_removed - Triggered when an override entitlement is removed \* coupon_codes_added - Sent when coupon codes are added in coupon set \* card_added - Sent when a card is added for a customer. \* gift_cancelled - Triggered when a gift is cancelled. \* entitlement_overrides_auto_removed - Triggered when Subscription entitlements overrides for a feature are auto removed after expiry \* payment_source_deleted - Sent when a payment source is deleted for a customer \* credit_note_created - Sent when a credit note is created \* subscription_resumption_scheduled - Triggered when the subscription resumption is scheduled. \* item_price_deleted - Triggered when an item price is deleted \* subscription_advance_invoice_schedule_updated - Triggered when scheduled advance invoice is updated for a subscription. \* item_deleted - Triggered when an item is deleted \* gift_claimed - Triggered when a gift is claimed \* feature_reactivated - Triggered when a feature \`status\` transitions to \`active\` for the second time or more. \* subscription_activated - Sent after the subscription has been moved from trial to active state \* subscription_resumed - Sent when the subscription is moved from paused state to active state \* credit_note_deleted - Sent when a credit note is deleted \* subscription_advance_invoice_schedule_added - Triggered when advance invoice is scheduled for a subscription. \* differential_price_updated - Triggered when a differential price is updated \* order_deleted - Triggered when order is deleted \* token_expired - Sent when a Token is expired \* transaction_updated - Triggered when a transaction is updated. E.g. (1) When a transaction is removed, (2) or when an excess payment is applied on an invoice, (3) or when amount_capturable gets updated. \* subscription_cancellation_reminder - Sent when the customer's subscription is nearing it's scheduled cancellation date. \* product_deleted - Triggered when the product delete is completed successfully \* invoice_generated - Event triggered when a new invoice is generated. In case of metered billing, this event is triggered when a "Pending" invoice is closed. \* order_delivered - Triggered when order is marked as delivered \* pending_invoice_created - Event triggered (in the case of metered billing) when a "Pending" invoice is created that has usage related charges or line items to be added, before being closed. This is triggered only when the "Notify for Pending Invoices" option is enabled. \* authorization_succeeded - Triggered when a authorization transaction is created. \* invoice_generated_with_backdating - Event triggered when a new invoice is generated with past date as invoice date. \* subscription_cancellation_scheduled - Sent when subscription is scheduled to cancel at end of current term \* order_created - Triggered when order is created \* hierarchy_deleted - Triggered when a hierarchy is deleted \* subscription_activated_with_backdating - Sent after the subscription changes to \`active\` from another \`status\`, while the change is backdated. \* plan_updated - Sent when a plan is changed. \* tax_withheld_recorded - Triggered when a tax withheld is recorded for an invoice \* credit_note_created_with_backdating - Sent when a credit note is created with past date as credit note date \* gift_updated - Triggered when a gift is updated \* order_resent - Triggered when order is resent \* hierarchy_created - Triggered when a hierarchy is created \* addon_deleted - Sent when a addon is deleted. \* voucher_create_failed - Triggered when a payment voucher creation is failed \* customer_moved_in - Sent when a customer is copied from another site \* attached_item_deleted - Triggered when an Attached item is deleted \* unbilled_charges_invoiced - Triggered when unbilled charges are invoiced \* subscription_pause_scheduled - Sent when the subscription is scheduled to pause. \* order_returned - Triggered when order is marked as returned \* payment_source_expired - Sent when a payment source for a customer is expired \* contract_term_terminated - Triggered when contract term is terminated \* product_created - Triggered when the product create is completed successfully \* payment_source_updated - Sent when the payment source is updated for a customer or when role is assigned to the payment source. \* pending_invoice_updated - Event triggered when the option "Notify and wait to close invoices" is enabled, and the 'Pending' invoice is updated. \* subscription_advance_invoice_schedule_removed - Triggered when scheduled advance invoice is removed for a subscription. \* tax_withheld_deleted - Triggered when a tax withheld is deleted \* business_entity_created - Sent when a business entity is created. \* item_price_created - Triggered when an item price is created \* virtual_bank_account_updated - Sent when the virtual bank account is updated for a customer. \* credit_note_updated - Sent when a credit note is updated \* subscription_scheduled_pause_removed - Triggered when scheduled pause is removed for the subscription. \* card_expiry_reminder - Sent when the customer's credit card is expiring soon. Sent 30 days before the expiry date. \* coupon_set_created - Sent when a coupon set is created \* virtual_bank_account_deleted - Sent when a virtual bank account is deleted for a customer. \* gift_scheduled - Triggered when a new gift is created \* business_entity_deleted - Sent when a business entity is deleted. \* promotional_credits_deducted - Sent when a customer prmotion credits deducted \* contract_term_renewed - Triggered when new contract term is renewed \* subscription_trial_extended - Trial Extension \* item_entitlements_removed - Triggered when item entitlements are removed for a feature \* gift_expired - Triggered when a gift expires \* contract_term_cancelled - Triggered when contract term is cancelled \* authorization_voided - Triggered when a authorization transaction is voided. Authorization can be voided either manually or when blocked funds are released by the gateway after a certain period of time. \* item_family_updated - Triggered when an item family is updated \* addon_created - Sent when a addon is created. \* attached_item_updated - Triggered when an Attached item is updated \* invoice_updated - Triggered when the invoice's shipping/billing address is updated, if the invoice is voided, or when the amount due is modified due to payments applied/removed. \* payment_intent_updated - Sent when a Payment intent is updated \* payment_source_locally_deleted - Sent when a payment source for a customer removed from Chargebee */ @@ -102,50 +102,56 @@ declare module 'chargebee' { export interface ListInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description Retrieves list of events. + */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Retrieves list of events. + */ offset?:string; /** - * @description Uniquely identifies a event + * @description Retrieves list of events. + */ id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Returns the events (occurred in the past 6 days) which has this status in any of the events' webhooks. -**Note**: To retrieve events which have occurred before the 6 day period, use the occurred_at(start_time/end_time) attribute. + * @description Retrieves list of events. + */ webhook_status?:{in?:string,is?:'not_configured' | 're_scheduled' | 'scheduled' | 'failed' | 'not_applicable' | 'succeeded' | 'skipped',is_not?:'not_configured' | 're_scheduled' | 'scheduled' | 'failed' | 'not_applicable' | 'succeeded' | 'skipped',not_in?:string}; /** - * @description Specify it if you need to fetch events of a particular type. + * @description Retrieves list of events. + */ event_type?:{in?:string,is?:'subscription_pause_scheduled' | 'order_delivered' | 'subscription_advance_invoice_schedule_added' | 'gift_expired' | 'tax_withheld_deleted' | 'coupon_codes_added' | 'unbilled_charges_deleted' | 'gift_cancelled' | 'coupon_updated' | 'order_cancelled' | 'coupon_deleted' | 'product_updated' | 'subscription_scheduled_changes_removed' | 'pending_invoice_created' | 'product_deleted' | 'entitlement_overrides_auto_removed' | 'unbilled_charges_created' | 'subscription_resumed' | 'subscription_cancelled' | 'item_entitlements_removed' | 'business_entity_created' | 'payment_source_deleted' | 'quote_deleted' | 'invoice_updated' | 'coupon_set_updated' | 'differential_price_updated' | 'subscription_advance_invoice_schedule_removed' | 'entitlement_overrides_removed' | 'subscription_activated_with_backdating' | 'card_deleted' | 'order_ready_to_ship' | 'subscription_trial_end_reminder' | 'subscription_shipping_address_updated' | 'variant_updated' | 'voucher_create_failed' | 'gift_claimed' | 'business_entity_updated' | 'subscription_scheduled_resumption_removed' | 'payment_initiated' | 'feature_archived' | 'subscription_reactivated_with_backdating' | 'customer_deleted' | 'token_expired' | 'card_added' | 'coupon_created' | 'refund_initiated' | 'invoice_generated_with_backdating' | 'add_usages_reminder' | 'item_price_deleted' | 'virtual_bank_account_deleted' | 'subscription_created' | 'voucher_created' | 'feature_activated' | 'subscription_entitlements_created' | 'payment_source_locally_deleted' | 'order_returned' | 'subscription_deleted' | 'invoice_generated' | 'voucher_expired' | 'authorization_succeeded' | 'payment_source_added' | 'gift_scheduled' | 'item_price_created' | 'subscription_changes_scheduled' | 'subscription_changed_with_backdating' | 'variant_created' | 'subscription_scheduled_cancellation_removed' | 'payment_refunded' | 'gift_unclaimed' | 'product_created' | 'differential_price_created' | 'virtual_bank_account_added' | 'payment_intent_created' | 'transaction_created' | 'credit_note_created_with_backdating' | 'contract_term_terminated' | 'item_family_updated' | 'order_created' | 'payment_succeeded' | 'plan_deleted' | 'subscription_canceled_with_backdating' | 'unbilled_charges_voided' | 'quote_created' | 'customer_moved_in' | 'coupon_set_deleted' | 'subscription_advance_invoice_schedule_updated' | 'attached_item_created' | 'customer_changed' | 'subscription_started' | 'item_deleted' | 'subscription_activated' | 'payment_source_expiring' | 'subscription_reactivated' | 'order_updated' | 'subscription_scheduled_pause_removed' | 'subscription_cancellation_reminder' | 'addon_deleted' | 'subscription_created_with_backdating' | 'order_deleted' | 'item_entitlements_updated' | 'token_consumed' | 'addon_updated' | 'hierarchy_deleted' | 'subscription_cancellation_scheduled' | 'gift_updated' | 'subscription_trial_extended' | 'subscription_renewed' | 'feature_updated' | 'addon_created' | 'feature_deleted' | 'item_family_created' | 'card_expiry_reminder' | 'token_created' | 'purchase_created' | 'plan_created' | 'entitlement_overrides_updated' | 'plan_updated' | 'promotional_credits_added' | 'item_family_deleted' | 'subscription_resumption_scheduled' | 'feature_reactivated' | 'coupon_codes_deleted' | 'card_expired' | 'credit_note_updated' | 'promotional_credits_deducted' | 'payment_source_expired' | 'customer_moved_out' | 'subscription_paused' | 'order_ready_to_process' | 'feature_created' | 'hierarchy_created' | 'attached_item_deleted' | 'transaction_deleted' | 'credit_note_created' | 'item_updated' | 'item_created' | 'coupon_set_created' | 'transaction_updated' | 'payment_intent_updated' | 'variant_deleted' | 'mrr_updated' | 'order_resent' | 'unbilled_charges_invoiced' | 'tax_withheld_recorded' | 'item_price_updated' | 'differential_price_deleted' | 'coupon_codes_updated' | 'virtual_bank_account_updated' | 'contract_term_created' | 'subscription_changed' | 'contract_term_cancelled' | 'contract_term_renewed' | 'invoice_deleted' | 'payment_failed' | 'credit_note_deleted' | 'tax_withheld_refunded' | 'contract_term_completed' | 'card_updated' | 'customer_created' | 'pending_invoice_updated' | 'quote_updated' | 'subscription_renewal_reminder' | 'attached_item_updated' | 'payment_source_updated' | 'business_entity_deleted' | 'authorization_voided',is_not?:'subscription_pause_scheduled' | 'order_delivered' | 'subscription_advance_invoice_schedule_added' | 'gift_expired' | 'tax_withheld_deleted' | 'coupon_codes_added' | 'unbilled_charges_deleted' | 'gift_cancelled' | 'coupon_updated' | 'order_cancelled' | 'coupon_deleted' | 'product_updated' | 'subscription_scheduled_changes_removed' | 'pending_invoice_created' | 'product_deleted' | 'entitlement_overrides_auto_removed' | 'unbilled_charges_created' | 'subscription_resumed' | 'subscription_cancelled' | 'item_entitlements_removed' | 'business_entity_created' | 'payment_source_deleted' | 'quote_deleted' | 'invoice_updated' | 'coupon_set_updated' | 'differential_price_updated' | 'subscription_advance_invoice_schedule_removed' | 'entitlement_overrides_removed' | 'subscription_activated_with_backdating' | 'card_deleted' | 'order_ready_to_ship' | 'subscription_trial_end_reminder' | 'subscription_shipping_address_updated' | 'variant_updated' | 'voucher_create_failed' | 'gift_claimed' | 'business_entity_updated' | 'subscription_scheduled_resumption_removed' | 'payment_initiated' | 'feature_archived' | 'subscription_reactivated_with_backdating' | 'customer_deleted' | 'token_expired' | 'card_added' | 'coupon_created' | 'refund_initiated' | 'invoice_generated_with_backdating' | 'add_usages_reminder' | 'item_price_deleted' | 'virtual_bank_account_deleted' | 'subscription_created' | 'voucher_created' | 'feature_activated' | 'subscription_entitlements_created' | 'payment_source_locally_deleted' | 'order_returned' | 'subscription_deleted' | 'invoice_generated' | 'voucher_expired' | 'authorization_succeeded' | 'payment_source_added' | 'gift_scheduled' | 'item_price_created' | 'subscription_changes_scheduled' | 'subscription_changed_with_backdating' | 'variant_created' | 'subscription_scheduled_cancellation_removed' | 'payment_refunded' | 'gift_unclaimed' | 'product_created' | 'differential_price_created' | 'virtual_bank_account_added' | 'payment_intent_created' | 'transaction_created' | 'credit_note_created_with_backdating' | 'contract_term_terminated' | 'item_family_updated' | 'order_created' | 'payment_succeeded' | 'plan_deleted' | 'subscription_canceled_with_backdating' | 'unbilled_charges_voided' | 'quote_created' | 'customer_moved_in' | 'coupon_set_deleted' | 'subscription_advance_invoice_schedule_updated' | 'attached_item_created' | 'customer_changed' | 'subscription_started' | 'item_deleted' | 'subscription_activated' | 'payment_source_expiring' | 'subscription_reactivated' | 'order_updated' | 'subscription_scheduled_pause_removed' | 'subscription_cancellation_reminder' | 'addon_deleted' | 'subscription_created_with_backdating' | 'order_deleted' | 'item_entitlements_updated' | 'token_consumed' | 'addon_updated' | 'hierarchy_deleted' | 'subscription_cancellation_scheduled' | 'gift_updated' | 'subscription_trial_extended' | 'subscription_renewed' | 'feature_updated' | 'addon_created' | 'feature_deleted' | 'item_family_created' | 'card_expiry_reminder' | 'token_created' | 'purchase_created' | 'plan_created' | 'entitlement_overrides_updated' | 'plan_updated' | 'promotional_credits_added' | 'item_family_deleted' | 'subscription_resumption_scheduled' | 'feature_reactivated' | 'coupon_codes_deleted' | 'card_expired' | 'credit_note_updated' | 'promotional_credits_deducted' | 'payment_source_expired' | 'customer_moved_out' | 'subscription_paused' | 'order_ready_to_process' | 'feature_created' | 'hierarchy_created' | 'attached_item_deleted' | 'transaction_deleted' | 'credit_note_created' | 'item_updated' | 'item_created' | 'coupon_set_created' | 'transaction_updated' | 'payment_intent_updated' | 'variant_deleted' | 'mrr_updated' | 'order_resent' | 'unbilled_charges_invoiced' | 'tax_withheld_recorded' | 'item_price_updated' | 'differential_price_deleted' | 'coupon_codes_updated' | 'virtual_bank_account_updated' | 'contract_term_created' | 'subscription_changed' | 'contract_term_cancelled' | 'contract_term_renewed' | 'invoice_deleted' | 'payment_failed' | 'credit_note_deleted' | 'tax_withheld_refunded' | 'contract_term_completed' | 'card_updated' | 'customer_created' | 'pending_invoice_updated' | 'quote_updated' | 'subscription_renewal_reminder' | 'attached_item_updated' | 'payment_source_updated' | 'business_entity_deleted' | 'authorization_voided',not_in?:string}; /** - * @description Source of the event + * @description Retrieves list of events. + */ source?:{in?:string,is?:'admin_console' | 'system' | 'scheduled_job' | 'js_api' | 'bulk_operation' | 'hosted_page' | 'migration' | 'api' | 'none' | 'portal' | 'external_service',is_not?:'admin_console' | 'system' | 'scheduled_job' | 'js_api' | 'bulk_operation' | 'hosted_page' | 'migration' | 'api' | 'none' | 'portal' | 'external_service',not_in?:string}; /** - * @description Timestamp indicating when this event had occurred. + * @description Retrieves list of events. + */ @@ -164,9 +170,21 @@ declare module 'chargebee' { } export interface Webhook { - id?:string; + /** + * @description Uniquely identifies a webhook + + */ + + id:string; + + /** + * @description * **When the event resource is retrieved via API:** Represents the status of the webhook call made to this webhook. +* **When the event resource is passed as part of a webhook call:** The `webhooks` object is unavailable on the first webhook call for the event. For subsequent calls, this attribute holds the status from after the last retry. +\* failed - Webhook call has been suspended after the all retries have resulted in failure. \* succeeded - Webhook call was successful. \* scheduled - Webhook call has been scheduled. \* re_scheduled - Webhook call has been rescheduled due failure(s) in previous call(s) \* not_applicable - Webhook call is not applicable for this event. \* skipped - Skipped as specified in request \* not_configured - Webhook was not configured when this event occurred + + */ - webhook_status?:'not_configured' | 're_scheduled' | 'scheduled' | 'failed' | 'not_applicable' | 'succeeded' | 'skipped'; + webhook_status:'not_configured' | 're_scheduled' | 'scheduled' | 'failed' | 'not_applicable' | 'succeeded' | 'skipped'; } } } \ No newline at end of file diff --git a/types/resources/Export.d.ts b/types/resources/Export.d.ts index 71ac9ff..db9e783 100644 --- a/types/resources/Export.d.ts +++ b/types/resources/Export.d.ts @@ -47,261 +47,256 @@ declare module 'chargebee' { export namespace Export { export class ExportResource { /** - * @description This API triggers export of customer data. The exported zip file contains CSV files with customer-related data. + * @description This API gets the status of the export job initiated by the Exports API. If the export job is completed, the downloads resource will also be obtained in the API response. The returned URL in the downloads resource is secure and can be downloaded. The URL expires after 4 hours. Please note that this is a public URL, and can be downloaded by anyone with whom it's shared. + +**Note:** In case the export is in Failed or In-process state, then the downloads resource will not be available. */ - customers(input?:CustomersInputParam):ChargebeeRequest; + retrieve(export_id:string):ChargebeeRequest; /** - * @description This API triggers export of attached item data. The exported zip file contains CSV files with attached item-related data. + * @description This API triggers export for the revenue recognition report. + +**Note:** This API call is asynchronous. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. In case you are using any of the client libraries, use the **wait for export completion** function provided as an instance method in the library. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **waitForExportCompletion()** on the returned **Export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **waitForExportCompletion()** on the returned **Export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait_for_export_completion** on the returned **export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait_for_export_completion** on the returned **export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **WaitForExportCompletion** on the returned **Export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait_for_export_completion** on the returned **export** resource which wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait_for_export_completion** on the returned **export** resource which wait until the export status changes. */ - attached_items(input?:AttachedItemsInputParam):ChargebeeRequest; + revenue_recognition(input:RevenueRecognitionInputParam):ChargebeeRequest; /** - * @description This API triggers export of transaction data. The exported zip file contains CSV files with transaction-related data. + * @description This API triggers export for the Deferred Revenue Report. + +**Note:** This API call is asynchronous. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. In case you are using any of the client libraries, use the **wait for export completion** function provided as an instance method in the library. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **waitForExportCompletion()** on the returned **Export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **waitForExportCompletion()** on the returned **Export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait_for_export_completion** on the returned **export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait_for_export_completion** on the returned **export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **WaitForExportCompletion** on the returned **Export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait_for_export_completion** on the returned **export** resource which wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait_for_export_completion** on the returned **export** resource which wait until the export status changes. */ - transactions(input?:TransactionsInputParam):ChargebeeRequest; + deferred_revenue(input:DeferredRevenueInputParam):ChargebeeRequest; /** - * @description This API triggers export of differential price data. The exported zip file contains CSV files with differential price-related data. + * @description This API triggers export of coupon data. The exported zip file contains CSV files with coupon-related data. */ - differential_prices(input?:DifferentialPricesInputParam):ChargebeeRequest; + coupons(input?:CouponsInputParam):ChargebeeRequest; /** - * @description This API triggers export of item family data. The exported zip file contains CSV files with item family-related data. + * @description This API triggers export of customer data. The exported zip file contains CSV files with customer-related data. */ - item_families(input?:ItemFamiliesInputParam):ChargebeeRequest; + customers(input?:CustomersInputParam):ChargebeeRequest; /** - * @description This API triggers export of invoice data. The exported zip file contains CSV files with invoice-related data. + * @description This API triggers export of subscription data. The exported zip file contains CSV files with subscription-related data. */ - invoices(input?:InvoicesInputParam):ChargebeeRequest; + subscriptions(input?:SubscriptionsInputParam):ChargebeeRequest; /** - * @description This API gets the status of the export job initiated by the Exports API. If the export job is completed, the downloads resource will also be obtained in the API response. The returned URL in the downloads resource is secure and can be downloaded. The URL expires after 4 hours. Please note that this is a public URL, and can be downloaded by anyone with whom it's shared. - -**Note:** In case the export is in Failed or In-process state, then the downloads resource will not be available. + * @description This API triggers export of invoice data. The exported zip file contains CSV files with invoice-related data. */ - retrieve(export_id:string):ChargebeeRequest; + invoices(input?:InvoicesInputParam):ChargebeeRequest; /** - * @description This API triggers export of item data. The exported zip file contains CSV files with item-related data. + * @description This API triggers export of credit note data. The exported zip file contains CSV files with credit note-related data. */ - items(input?:ItemsInputParam):ChargebeeRequest; + credit_notes(input?:CreditNotesInputParam):ChargebeeRequest; /** - * @description This API triggers export for the Deferred Revenue Report. - -**Note:** This API call is asynchronous. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. In case you are using any of the client libraries, use the **wait for export completion** function provided as an instance method in the library. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **waitForExportCompletion()** on the returned **Export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **waitForExportCompletion()** on the returned **Export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait_for_export_completion** on the returned **export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait_for_export_completion** on the returned **export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **WaitForExportCompletion** on the returned **Export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait_for_export_completion** on the returned **export** resource which wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait_for_export_completion** on the returned **export** resource which wait until the export status changes. + * @description This API triggers export of transaction data. The exported zip file contains CSV files with transaction-related data. */ - deferred_revenue(input:DeferredRevenueInputParam):ChargebeeRequest; + transactions(input?:TransactionsInputParam):ChargebeeRequest; /** - * @description This API triggers export for the revenue recognition report. - -**Note:** This API call is asynchronous. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. In case you are using any of the client libraries, use the **wait for export completion** function provided as an instance method in the library. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **waitForExportCompletion()** on the returned **Export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **waitForExportCompletion()** on the returned **Export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait_for_export_completion** on the returned **export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait_for_export_completion** on the returned **export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **WaitForExportCompletion** on the returned **Export** resource which will wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait_for_export_completion** on the returned **export** resource which wait until the export status changes. You need to check if this operation has completed by checking if the export status is **completed** . You can do this by retrieving the export in a loop with a minimum delay of 10 secs between two retrieve requests. Use the method **wait_for_export_completion** on the returned **export** resource which wait until the export status changes. + * @description This API triggers export of order data. The exported zip file contains CSV files with order-related data. */ - revenue_recognition(input:RevenueRecognitionInputParam):ChargebeeRequest; + orders(input?:OrdersInputParam):ChargebeeRequest; /** - * @description This API triggers export of credit note data. The exported zip file contains CSV files with credit note-related data. + * @description This API triggers export of item family data. The exported zip file contains CSV files with item family-related data. */ - credit_notes(input?:CreditNotesInputParam):ChargebeeRequest; + item_families(input?:ItemFamiliesInputParam):ChargebeeRequest; /** - * @description This API triggers export of coupon data. The exported zip file contains CSV files with coupon-related data. + * @description This API triggers export of item data. The exported zip file contains CSV files with item-related data. */ - coupons(input?:CouponsInputParam):ChargebeeRequest; + items(input?:ItemsInputParam):ChargebeeRequest; /** - * @description This API triggers export of order data. The exported zip file contains CSV files with order-related data. + * @description This API triggers export of item price data. The exported zip file contains CSV files with item price-related data. */ - orders(input?:OrdersInputParam):ChargebeeRequest; + item_prices(input?:ItemPricesInputParam):ChargebeeRequest; /** - * @description This API triggers export of item price data. The exported zip file contains CSV files with item price-related data. + * @description This API triggers export of attached item data. The exported zip file contains CSV files with attached item-related data. */ - item_prices(input?:ItemPricesInputParam):ChargebeeRequest; + attached_items(input?:AttachedItemsInputParam):ChargebeeRequest; /** - * @description This API triggers export of subscription data. The exported zip file contains CSV files with subscription-related data. + * @description This API triggers export of differential price data. The exported zip file contains CSV files with differential price-related data. */ - subscriptions(input?:SubscriptionsInputParam):ChargebeeRequest; + differential_prices(input?:DifferentialPricesInputParam):ChargebeeRequest; } - export interface CustomersResponse { + export interface RetrieveResponse { export:Export; } - export interface CustomersInputParam { + + export interface RevenueRecognitionResponse { + export:Export; + } + export interface RevenueRecognitionInputParam { /** - * @description null + * @description Determines the scope of the report. Returns the report based on the value specified. \* subscription - Subscription \* invoice - Invoice \* product - Product (Includes Plan, Addon and Adhoc) \* customer - Customer */ - export_type?:ExportType; + report_by:ReportBy; /** - * @description The unique ID of the [business entity](/docs/api?prod_cat_ver=2#mbe) of this subscription. This is always the same as the [business entity](/docs/api/subscriptions?prod_cat_ver=2#subscription_customer_id) of the customer. -The ID of the business entity created for the site. For Product Catalog 1.0, all the site data is tied to this business entity. -**Note** - -[Multiple Business Entities](/docs/api?prod_cat_ver=2#mbe) is a feature available only on Product Catalog 2.0. + * @description Value must be in [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) format. Generates the report based on the value specified. If no currency_code value is specified, then consolidated report based on base currency is returned. */ - business_entity_id?:{is?:string,is_not?:string,starts_with?:string}; + currency_code?:string; /** - * @description Parameters for customer + * @description Obtains report data from the specified month, combined with the value specified for report_from_year. Values must be between 1 and 12, where 1 is January and 12 is December. */ - customer?:{auto_close_invoices?:{is?:'true' | 'false'},auto_collection?:{in?:string,is?:'off' | 'on',is_not?:'off' | 'on',not_in?:string},channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string},company?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},created_at?:{after?:string,before?:string,between?:string,on?:string},email?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},first_name?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},last_name?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},offline_payment_method?:{in?:string,is?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',is_not?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',not_in?:string},phone?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},taxability?:{in?:string,is?:'taxable' | 'exempt',is_not?:'taxable' | 'exempt',not_in?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; + report_from_month:number; /** - * @description Parameters for relationship + * @description Obtains report data from the specified year, combined with the value specified for report_from_month. */ - relationship?:{invoice_owner_id?:{is?:string,is_not?:string,starts_with?:string},parent_id?:{is?:string,is_not?:string,starts_with?:string},payment_owner_id?:{is?:string,is_not?:string,starts_with?:string}}; - } - export interface AttachedItemsResponse { - export:Export; - } - export interface AttachedItemsInputParam { + report_from_year:number; /** - * @description optional, enumerated string filter -To filter based on the type of of the attached item. Possible values are : `addon`, `charge`. Possible values are : plan, addon, charge. -**Supported operators :** is, is_not, in, not_in + * @description Obtains report data from the specified month, combined with the value specified for report_to_year. Values must be between 1 and 12, where 1 is January and 12 is December. -**Example →** *item_type\[is_not\] = "plan"* + */ + + report_to_month:number; + + /** + * @description Obtains report data until the specified year, combined with the value specified for report_to_month. */ - item_type?:{in?:string,is?:'charge' | 'addon' | 'plan',is_not?:'charge' | 'addon' | 'plan',not_in?:string}; + report_to_year:number; /** - * @description Parameters for attached_item + * @description Returns amount with discount in the report. If value specified is false, it returns amount without discount. */ - attached_item?:{charge_on_event?:{in?:string,is?:'subscription_creation' | 'subscription_activation' | 'subscription_trial_start' | 'contract_termination' | 'plan_activation' | 'on_demand',is_not?:'subscription_creation' | 'subscription_activation' | 'subscription_trial_start' | 'contract_termination' | 'plan_activation' | 'on_demand',not_in?:string},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},parent_item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},type?:{in?:string,is?:'optional' | 'mandatory' | 'recommended',is_not?:'optional' | 'mandatory' | 'recommended',not_in?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; - } - export interface TransactionsResponse { - export:Export; - } - export interface TransactionsInputParam { + include_discounts?:boolean; /** - * @description Parameters for transaction + * @description optional, string filter +Payment owner of an invoice. +**Supported operators :** is, is_not, starts_with, in, not_in + +**Example →** *payment_owner\[is\] = "payment_customer"* */ - transaction?:{amount?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},amount_capturable?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},customer_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string},date?:{after?:string,before?:string,between?:string,on?:string},gateway?:{in?:string,is?:'bluepay' | 'beanstream' | 'elavon' | 'orbital' | 'hdfc' | 'nmi' | 'moneris' | 'metrics_global' | 'pin' | 'stripe' | 'quickbooks' | 'razorpay' | 'eway_rapid' | 'balanced_payments' | 'ecentric' | 'wepay' | 'chargebee_payments' | 'bank_of_america' | 'braintree' | 'first_data_global' | 'paypal_express_checkout' | 'ingenico_direct' | 'moneris_us' | 'exact' | 'migs' | 'checkout_com' | 'not_applicable' | 'paypal_pro' | 'ogone' | 'eway' | 'gocardless' | 'global_payments' | 'paymill' | 'adyen' | 'paypal' | 'chargebee' | 'authorize_net' | 'tco' | 'bluesnap' | 'windcave' | 'paypal_payflow_pro' | 'amazon_payments' | 'mollie' | 'cybersource' | 'wirecard' | 'sage_pay' | 'vantiv' | 'worldpay',is_not?:'bluepay' | 'beanstream' | 'elavon' | 'orbital' | 'hdfc' | 'nmi' | 'moneris' | 'metrics_global' | 'pin' | 'stripe' | 'quickbooks' | 'razorpay' | 'eway_rapid' | 'balanced_payments' | 'ecentric' | 'wepay' | 'chargebee_payments' | 'bank_of_america' | 'braintree' | 'first_data_global' | 'paypal_express_checkout' | 'ingenico_direct' | 'moneris_us' | 'exact' | 'migs' | 'checkout_com' | 'not_applicable' | 'paypal_pro' | 'ogone' | 'eway' | 'gocardless' | 'global_payments' | 'paymill' | 'adyen' | 'paypal' | 'chargebee' | 'authorize_net' | 'tco' | 'bluesnap' | 'windcave' | 'paypal_payflow_pro' | 'amazon_payments' | 'mollie' | 'cybersource' | 'wirecard' | 'sage_pay' | 'vantiv' | 'worldpay',not_in?:string},gateway_account_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},id_at_gateway?:{is?:string,is_not?:string,starts_with?:string},payment_method?:{in?:string,is?:'other' | 'netbanking_emandates' | 'ach_credit' | 'dotpay' | 'boleto' | 'direct_debit' | 'chargeback' | 'wechat_pay' | 'cash' | 'giropay' | 'bank_transfer' | 'alipay' | 'ideal' | 'google_pay' | 'custom' | 'unionpay' | 'check' | 'sofort' | 'amazon_payments' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'sepa_credit' | 'card',is_not?:'other' | 'netbanking_emandates' | 'ach_credit' | 'dotpay' | 'boleto' | 'direct_debit' | 'chargeback' | 'wechat_pay' | 'cash' | 'giropay' | 'bank_transfer' | 'alipay' | 'ideal' | 'google_pay' | 'custom' | 'unionpay' | 'check' | 'sofort' | 'amazon_payments' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'sepa_credit' | 'card',not_in?:string},payment_source_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string},reference_number?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},status?:{in?:string,is?:'in_progress' | 'success' | 'failure' | 'voided' | 'timeout' | 'needs_attention',is_not?:'in_progress' | 'success' | 'failure' | 'voided' | 'timeout' | 'needs_attention',not_in?:string},subscription_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string},type?:{in?:string,is?:'authorization' | 'payment_reversal' | 'payment' | 'refund',is_not?:'authorization' | 'payment_reversal' | 'payment' | 'refund',not_in?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; - } - export interface DifferentialPricesResponse { - export:Export; - } - export interface DifferentialPricesInputParam { + payment_owner?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** * @description optional, string filter -Item Id of Addon / Charge item price for which differential pricing is applied to. +The plan item code. **Supported operators :** is, is_not, starts_with, in, not_in -**Example →** *item_id\[is\] = "day-pass"* +**Example →** *item_id\[is\] = "silver"* */ item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Parameters for differential_price + * @description optional, string filter +The plan item price code. +**Supported operators :** is, is_not, starts_with, in, not_in + +**Example →** *item_price_id\[is\] = "silver-USD-monthly"* */ - differential_price?:{id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},item_price_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},parent_item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}}; - } - export interface ItemFamiliesResponse { - export:Export; - } - export interface ItemFamiliesInputParam { + item_price_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Parameters for item_family + * @description optional, string filter +Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Subscriptions \> Subscription Cancellation** . Must be passed if set as mandatory in the app. The codes are case-sensitive. +**Supported operators :** is, is_not, starts_with, in, not_in + +**Example →** *cancel_reason_code\[is\] = "Not Paid"* */ - item_family?:{id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},name?:{is?:string,is_not?:string,starts_with?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; - } - export interface InvoicesResponse { - export:Export; - } - export interface InvoicesInputParam { + cancel_reason_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** * @description optional, string filter -Payment owner of an invoice. -**Supported operators :** is, is_not, starts_with, in, not_in +The unique ID of the [business entity](/docs/api?prod_cat_ver=2#mbe) of this subscription. This is always the same as the [business entity](/docs/api/subscriptions?prod_cat_ver=2#subscription_customer_id) of the customer. +**Supported operators :** is, is_not, starts_with -**Example →** *payment_owner\[is\] = "payment_customer"* +**Example →** *business_entity_id\[is_not\] = "business_entity_id"* */ - payment_owner?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + business_entity_id?:{is?:string,is_not?:string,starts_with?:string}; /** * @description Parameters for invoice */ - invoice?:{amount_adjusted?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},amount_due?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},amount_paid?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string},credits_applied?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},customer_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},date?:{after?:string,before?:string,between?:string,on?:string},dunning_status?:{in?:string,is?:'in_progress' | 'stopped' | 'success' | 'exhausted',is_not?:'in_progress' | 'stopped' | 'success' | 'exhausted',is_present?:'true' | 'false',not_in?:string},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},paid_at?:{after?:string,before?:string,between?:string,on?:string},price_type?:{in?:string,is?:'tax_exclusive' | 'tax_inclusive',is_not?:'tax_exclusive' | 'tax_inclusive',not_in?:string},recurring?:{is?:'true' | 'false'},status?:{in?:string,is?:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due',is_not?:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due',not_in?:string},subscription_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string},total?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; - } - export interface RetrieveResponse { - export:Export; - } - - export interface ItemsResponse { - export:Export; - } - export interface ItemsInputParam { + invoice?:{amount_adjusted?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},amount_due?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},amount_paid?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string},credits_applied?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},date?:{after?:string,before?:string,between?:string,on?:string},dunning_status?:{in?:string,is?:'in_progress' | 'stopped' | 'success' | 'exhausted',is_not?:'in_progress' | 'stopped' | 'success' | 'exhausted',is_present?:'true' | 'false',not_in?:string},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},paid_at?:{after?:string,before?:string,between?:string,on?:string},price_type?:{in?:string,is?:'tax_exclusive' | 'tax_inclusive',is_not?:'tax_exclusive' | 'tax_inclusive',not_in?:string},recurring?:{is?:'true' | 'false'},status?:{in?:string,is?:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due',is_not?:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due',not_in?:string},total?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; /** - * @description Parameters for item + * @description Parameters for subscription */ - item?:{channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string},enabled_for_checkout?:{is?:'true' | 'false'},enabled_in_portal?:{is?:'true' | 'false'},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},is_giftable?:{is?:'true' | 'false'},item_applicability?:{in?:string,is?:'all' | 'restricted',is_not?:'all' | 'restricted',not_in?:string},item_family_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},metered?:{is?:'true' | 'false'},name?:{is?:string,is_not?:string,starts_with?:string},status?:{in?:string,is?:'archived' | 'deleted' | 'active',is_not?:'archived' | 'deleted' | 'active',not_in?:string},type?:{in?:string,is?:'charge' | 'addon' | 'plan',is_not?:'charge' | 'addon' | 'plan',not_in?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string},usage_calculation?:{in?:string,is?:'max_usage' | 'sum_of_usages' | 'last_usage',is_not?:'max_usage' | 'sum_of_usages' | 'last_usage',not_in?:string}}; + subscription?:{activated_at?:{after?:string,before?:string,between?:string,is_present?:'true' | 'false',on?:string},auto_close_invoices?:{is?:'true' | 'false'},cancel_reason?:{in?:string,is?:'tax_calculation_failed' | 'fraud_review_failed' | 'currency_incompatible_with_gateway' | 'non_compliant_eu_customer' | 'non_compliant_customer' | 'not_paid' | 'no_card',is_not?:'tax_calculation_failed' | 'fraud_review_failed' | 'currency_incompatible_with_gateway' | 'non_compliant_eu_customer' | 'non_compliant_customer' | 'not_paid' | 'no_card',is_present?:'true' | 'false',not_in?:string},cancelled_at?:{after?:string,before?:string,between?:string,on?:string},channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string},created_at?:{after?:string,before?:string,between?:string,on?:string},customer_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},has_scheduled_changes?:{is?:'true' | 'false'},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},next_billing_at?:{after?:string,before?:string,between?:string,on?:string},offline_payment_method?:{in?:string,is?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',is_not?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',not_in?:string},remaining_billing_cycles?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,is_present?:'true' | 'false',lt?:string,lte?:string},status?:{in?:string,is?:'in_trial' | 'paused' | 'future' | 'active' | 'cancelled' | 'non_renewing',is_not?:'in_trial' | 'paused' | 'future' | 'active' | 'cancelled' | 'non_renewing',not_in?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; + + /** + * @description Parameters for customer + + */ + + customer?:{auto_close_invoices?:{is?:'true' | 'false'},auto_collection?:{in?:string,is?:'off' | 'on',is_not?:'off' | 'on',not_in?:string},channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string},company?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},created_at?:{after?:string,before?:string,between?:string,on?:string},email?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},first_name?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},last_name?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},offline_payment_method?:{in?:string,is?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',is_not?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',not_in?:string},phone?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},taxability?:{in?:string,is?:'taxable' | 'exempt',is_not?:'taxable' | 'exempt',not_in?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; + + /** + * @description Parameters for relationship + + */ + + relationship?:{invoice_owner_id?:{is?:string,is_not?:string,starts_with?:string},parent_id?:{is?:string,is_not?:string,starts_with?:string},payment_owner_id?:{is?:string,is_not?:string,starts_with?:string}}; } export interface DeferredRevenueResponse { export:Export; @@ -402,11 +397,11 @@ Reason code for canceling the subscription. Must be one from a list of reason co cancel_reason_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description The unique ID of the [business entity](/docs/api?prod_cat_ver=2#mbe) of this subscription. This is always the same as the [business entity](/docs/api/subscriptions?prod_cat_ver=2#subscription_customer_id) of the customer. -The ID of the business entity created for the site. For Product Catalog 1.0, all the site data is tied to this business entity. -**Note** + * @description optional, string filter +The unique ID of the [business entity](/docs/api?prod_cat_ver=2#mbe) of this subscription. This is always the same as the [business entity](/docs/api/subscriptions?prod_cat_ver=2#subscription_customer_id) of the customer. +**Supported operators :** is, is_not, starts_with -[Multiple Business Entities](/docs/api?prod_cat_ver=2#mbe) is a feature available only on Product Catalog 2.0. +**Example →** *business_entity_id\[is_not\] = "business_entity_id"* */ @@ -440,70 +435,77 @@ The ID of the business entity created for the site. For Product Catalog 1.0, all relationship?:{invoice_owner_id?:{is?:string,is_not?:string,starts_with?:string},parent_id?:{is?:string,is_not?:string,starts_with?:string},payment_owner_id?:{is?:string,is_not?:string,starts_with?:string}}; } - export interface RevenueRecognitionResponse { + export interface CouponsResponse { export:Export; } - export interface RevenueRecognitionInputParam { + export interface CouponsInputParam { /** - * @description Determines the scope of the report. Returns the report based on the value specified. \* subscription - Subscription \* invoice - Invoice \* product - Product (Includes Plan, Addon and Adhoc) \* customer - Customer + * @description optional, string filter +The currency code ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html)) of the coupon. Applicable for *fixed_amount* coupons alone. +**Supported operators :** is, is_not, starts_with, in, not_in - */ - - report_by:ReportBy; - - /** - * @description Value must be in [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) format. Generates the report based on the value specified. If no currency_code value is specified, then consolidated report based on base currency is returned. +**Example →** *currency_code\[is\] = "USD"* */ - currency_code?:string; + currency_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Obtains report data from the specified month, combined with the value specified for report_from_year. Values must be between 1 and 12, where 1 is January and 12 is December. + * @description Parameters for coupon */ - report_from_month:number; + coupon?:{apply_on?:{in?:string,is?:'invoice_amount' | 'each_specified_item',is_not?:'invoice_amount' | 'each_specified_item',not_in?:string},created_at?:{after?:string,before?:string,between?:string,on?:string},discount_type?:{in?:string,is?:'fixed_amount' | 'percentage',is_not?:'fixed_amount' | 'percentage',not_in?:string},duration_type?:{in?:string,is?:'limited_period' | 'one_time' | 'forever',is_not?:'limited_period' | 'one_time' | 'forever',not_in?:string},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},name?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},status?:{in?:string,is?:'archived' | 'expired' | 'deleted' | 'active',is_not?:'archived' | 'expired' | 'deleted' | 'active',not_in?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; + } + export interface CustomersResponse { + export:Export; + } + export interface CustomersInputParam { /** - * @description Obtains report data from the specified year, combined with the value specified for report_from_month. + * @description Determines the format of the data. Returns the export type based on the selected value. \* data - Download your current data in CSV. \* import_friendly_data - Download import friendly data in CSV. This CSV can be used to perform [bulk operations](https://www.chargebee.com/docs/bulk-operations.html). */ - report_from_year:number; + export_type?:ExportType; /** - * @description Obtains report data from the specified month, combined with the value specified for report_to_year. Values must be between 1 and 12, where 1 is January and 12 is December. + * @description optional, string filter +The unique ID of the [business entity](/docs/api?prod_cat_ver=2#mbe) of this subscription. This is always the same as the [business entity](/docs/api/subscriptions?prod_cat_ver=2#subscription_customer_id) of the customer. +**Supported operators :** is, is_not, starts_with + +**Example →** *business_entity_id\[is\] = "business_entity_id"* */ - report_to_month:number; + business_entity_id?:{is?:string,is_not?:string,starts_with?:string}; /** - * @description Obtains report data until the specified year, combined with the value specified for report_to_month. + * @description Parameters for customer */ - report_to_year:number; + customer?:{auto_close_invoices?:{is?:'true' | 'false'},auto_collection?:{in?:string,is?:'off' | 'on',is_not?:'off' | 'on',not_in?:string},channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string},company?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},created_at?:{after?:string,before?:string,between?:string,on?:string},email?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},first_name?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},last_name?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},offline_payment_method?:{in?:string,is?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',is_not?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',not_in?:string},phone?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},taxability?:{in?:string,is?:'taxable' | 'exempt',is_not?:'taxable' | 'exempt',not_in?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; /** - * @description Returns amount with discount in the report. If value specified is false, it returns amount without discount. + * @description Parameters for relationship */ - include_discounts?:boolean; + relationship?:{invoice_owner_id?:{is?:string,is_not?:string,starts_with?:string},parent_id?:{is?:string,is_not?:string,starts_with?:string},payment_owner_id?:{is?:string,is_not?:string,starts_with?:string}}; + } + export interface SubscriptionsResponse { + export:Export; + } + export interface SubscriptionsInputParam { /** - * @description optional, string filter -Payment owner of an invoice. -**Supported operators :** is, is_not, starts_with, in, not_in - -**Example →** *payment_owner\[is\] = "payment_customer"* + * @description Determines the format of the data. Returns the export type based on the selected value. \* data - Download your current data in CSV. \* import_friendly_data - Download import friendly data in CSV. This CSV can be used to perform [bulk operations](https://www.chargebee.com/docs/bulk-operations.html). */ - payment_owner?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + export_type?:ExportType; /** * @description optional, string filter @@ -538,44 +540,35 @@ Reason code for canceling the subscription. Must be one from a list of reason co cancel_reason_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; - /** - * @description The unique ID of the [business entity](/docs/api?prod_cat_ver=2#mbe) of this subscription. This is always the same as the [business entity](/docs/api/subscriptions?prod_cat_ver=2#subscription_customer_id) of the customer. -The ID of the business entity created for the site. For Product Catalog 1.0, all the site data is tied to this business entity. -**Note** - -[Multiple Business Entities](/docs/api?prod_cat_ver=2#mbe) is a feature available only on Product Catalog 2.0. - - */ - - business_entity_id?:{is?:string,is_not?:string,starts_with?:string}; - - /** - * @description Parameters for invoice - - */ - - invoice?:{amount_adjusted?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},amount_due?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},amount_paid?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string},credits_applied?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},date?:{after?:string,before?:string,between?:string,on?:string},dunning_status?:{in?:string,is?:'in_progress' | 'stopped' | 'success' | 'exhausted',is_not?:'in_progress' | 'stopped' | 'success' | 'exhausted',is_present?:'true' | 'false',not_in?:string},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},paid_at?:{after?:string,before?:string,between?:string,on?:string},price_type?:{in?:string,is?:'tax_exclusive' | 'tax_inclusive',is_not?:'tax_exclusive' | 'tax_inclusive',not_in?:string},recurring?:{is?:'true' | 'false'},status?:{in?:string,is?:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due',is_not?:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due',not_in?:string},total?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; - /** * @description Parameters for subscription */ subscription?:{activated_at?:{after?:string,before?:string,between?:string,is_present?:'true' | 'false',on?:string},auto_close_invoices?:{is?:'true' | 'false'},cancel_reason?:{in?:string,is?:'tax_calculation_failed' | 'fraud_review_failed' | 'currency_incompatible_with_gateway' | 'non_compliant_eu_customer' | 'non_compliant_customer' | 'not_paid' | 'no_card',is_not?:'tax_calculation_failed' | 'fraud_review_failed' | 'currency_incompatible_with_gateway' | 'non_compliant_eu_customer' | 'non_compliant_customer' | 'not_paid' | 'no_card',is_present?:'true' | 'false',not_in?:string},cancelled_at?:{after?:string,before?:string,between?:string,on?:string},channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string},created_at?:{after?:string,before?:string,between?:string,on?:string},customer_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},has_scheduled_changes?:{is?:'true' | 'false'},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},next_billing_at?:{after?:string,before?:string,between?:string,on?:string},offline_payment_method?:{in?:string,is?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',is_not?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',not_in?:string},remaining_billing_cycles?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,is_present?:'true' | 'false',lt?:string,lte?:string},status?:{in?:string,is?:'in_trial' | 'paused' | 'future' | 'active' | 'cancelled' | 'non_renewing',is_not?:'in_trial' | 'paused' | 'future' | 'active' | 'cancelled' | 'non_renewing',not_in?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; + } + export interface InvoicesResponse { + export:Export; + } + export interface InvoicesInputParam { /** - * @description Parameters for customer + * @description optional, string filter +Payment owner of an invoice. +**Supported operators :** is, is_not, starts_with, in, not_in + +**Example →** *payment_owner\[is\] = "payment_customer"* */ - customer?:{auto_close_invoices?:{is?:'true' | 'false'},auto_collection?:{in?:string,is?:'off' | 'on',is_not?:'off' | 'on',not_in?:string},channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string},company?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},created_at?:{after?:string,before?:string,between?:string,on?:string},email?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},first_name?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},last_name?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},offline_payment_method?:{in?:string,is?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',is_not?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',not_in?:string},phone?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},taxability?:{in?:string,is?:'taxable' | 'exempt',is_not?:'taxable' | 'exempt',not_in?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; + payment_owner?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Parameters for relationship + * @description Parameters for invoice */ - relationship?:{invoice_owner_id?:{is?:string,is_not?:string,starts_with?:string},parent_id?:{is?:string,is_not?:string,starts_with?:string},payment_owner_id?:{is?:string,is_not?:string,starts_with?:string}}; + invoice?:{amount_adjusted?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},amount_due?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},amount_paid?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string},credits_applied?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},customer_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},date?:{after?:string,before?:string,between?:string,on?:string},dunning_status?:{in?:string,is?:'in_progress' | 'stopped' | 'success' | 'exhausted',is_not?:'in_progress' | 'stopped' | 'success' | 'exhausted',is_present?:'true' | 'false',not_in?:string},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},paid_at?:{after?:string,before?:string,between?:string,on?:string},price_type?:{in?:string,is?:'tax_exclusive' | 'tax_inclusive',is_not?:'tax_exclusive' | 'tax_inclusive',not_in?:string},recurring?:{is?:'true' | 'false'},status?:{in?:string,is?:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due',is_not?:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due',not_in?:string},subscription_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string},total?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; } export interface CreditNotesResponse { export:Export; @@ -589,28 +582,17 @@ The ID of the business entity created for the site. For Product Catalog 1.0, all credit_note?:{amount_allocated?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},amount_available?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},amount_refunded?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string},create_reason_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},customer_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},date?:{after?:string,before?:string,between?:string,on?:string},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},price_type?:{in?:string,is?:'tax_exclusive' | 'tax_inclusive',is_not?:'tax_exclusive' | 'tax_inclusive',not_in?:string},reason_code?:{in?:string,is?:'other' | 'product_unsatisfactory' | 'subscription_pause' | 'order_cancellation' | 'service_unsatisfactory' | 'subscription_cancellation' | 'chargeback' | 'order_change' | 'write_off' | 'waiver' | 'subscription_change' | 'fraudulent',is_not?:'other' | 'product_unsatisfactory' | 'subscription_pause' | 'order_cancellation' | 'service_unsatisfactory' | 'subscription_cancellation' | 'chargeback' | 'order_change' | 'write_off' | 'waiver' | 'subscription_change' | 'fraudulent',not_in?:string},reference_invoice_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},status?:{in?:string,is?:'refund_due' | 'adjusted' | 'refunded' | 'voided',is_not?:'refund_due' | 'adjusted' | 'refunded' | 'voided',not_in?:string},subscription_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string},total?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},type?:{in?:string,is?:'adjustment' | 'refundable',is_not?:'adjustment' | 'refundable',not_in?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string},voided_at?:{after?:string,before?:string,between?:string,on?:string}}; } - export interface CouponsResponse { + export interface TransactionsResponse { export:Export; } - export interface CouponsInputParam { - - /** - * @description optional, string filter -The currency code ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html)) of the coupon. Applicable for *fixed_amount* coupons alone. -**Supported operators :** is, is_not, starts_with, in, not_in - -**Example →** *currency_code\[is\] = "USD"* - - */ - - currency_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + export interface TransactionsInputParam { /** - * @description Parameters for coupon + * @description Parameters for transaction */ - coupon?:{apply_on?:{in?:string,is?:'invoice_amount' | 'each_specified_item',is_not?:'invoice_amount' | 'each_specified_item',not_in?:string},created_at?:{after?:string,before?:string,between?:string,on?:string},discount_type?:{in?:string,is?:'fixed_amount' | 'percentage',is_not?:'fixed_amount' | 'percentage',not_in?:string},duration_type?:{in?:string,is?:'limited_period' | 'one_time' | 'forever',is_not?:'limited_period' | 'one_time' | 'forever',not_in?:string},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},name?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},status?:{in?:string,is?:'archived' | 'expired' | 'deleted' | 'active',is_not?:'archived' | 'expired' | 'deleted' | 'active',not_in?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; + transaction?:{amount?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},amount_capturable?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},customer_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string},date?:{after?:string,before?:string,between?:string,on?:string},gateway?:{in?:string,is?:'bluepay' | 'beanstream' | 'elavon' | 'orbital' | 'hdfc' | 'nmi' | 'moneris' | 'metrics_global' | 'ebanx' | 'pin' | 'stripe' | 'quickbooks' | 'razorpay' | 'eway_rapid' | 'balanced_payments' | 'ecentric' | 'wepay' | 'chargebee_payments' | 'bank_of_america' | 'braintree' | 'first_data_global' | 'paypal_express_checkout' | 'ingenico_direct' | 'moneris_us' | 'exact' | 'migs' | 'checkout_com' | 'not_applicable' | 'paypal_pro' | 'ogone' | 'eway' | 'gocardless' | 'global_payments' | 'paymill' | 'adyen' | 'paypal' | 'chargebee' | 'authorize_net' | 'tco' | 'bluesnap' | 'windcave' | 'paypal_payflow_pro' | 'amazon_payments' | 'mollie' | 'cybersource' | 'wirecard' | 'sage_pay' | 'vantiv' | 'worldpay' | 'pay_com',is_not?:'bluepay' | 'beanstream' | 'elavon' | 'orbital' | 'hdfc' | 'nmi' | 'moneris' | 'metrics_global' | 'ebanx' | 'pin' | 'stripe' | 'quickbooks' | 'razorpay' | 'eway_rapid' | 'balanced_payments' | 'ecentric' | 'wepay' | 'chargebee_payments' | 'bank_of_america' | 'braintree' | 'first_data_global' | 'paypal_express_checkout' | 'ingenico_direct' | 'moneris_us' | 'exact' | 'migs' | 'checkout_com' | 'not_applicable' | 'paypal_pro' | 'ogone' | 'eway' | 'gocardless' | 'global_payments' | 'paymill' | 'adyen' | 'paypal' | 'chargebee' | 'authorize_net' | 'tco' | 'bluesnap' | 'windcave' | 'paypal_payflow_pro' | 'amazon_payments' | 'mollie' | 'cybersource' | 'wirecard' | 'sage_pay' | 'vantiv' | 'worldpay' | 'pay_com',not_in?:string},gateway_account_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},id_at_gateway?:{is?:string,is_not?:string,starts_with?:string},payment_method?:{in?:string,is?:'other' | 'netbanking_emandates' | 'ach_credit' | 'dotpay' | 'boleto' | 'direct_debit' | 'chargeback' | 'wechat_pay' | 'pay_to' | 'cash' | 'giropay' | 'bank_transfer' | 'alipay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'custom' | 'unionpay' | 'check' | 'faster_payments' | 'sofort' | 'amazon_payments' | 'upi' | 'venmo' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'sepa_credit' | 'card',is_not?:'other' | 'netbanking_emandates' | 'ach_credit' | 'dotpay' | 'boleto' | 'direct_debit' | 'chargeback' | 'wechat_pay' | 'pay_to' | 'cash' | 'giropay' | 'bank_transfer' | 'alipay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'custom' | 'unionpay' | 'check' | 'faster_payments' | 'sofort' | 'amazon_payments' | 'upi' | 'venmo' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'sepa_credit' | 'card',not_in?:string},payment_source_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string},reference_number?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string},status?:{in?:string,is?:'in_progress' | 'success' | 'failure' | 'voided' | 'timeout' | 'needs_attention',is_not?:'in_progress' | 'success' | 'failure' | 'voided' | 'timeout' | 'needs_attention',not_in?:string},subscription_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string},type?:{in?:string,is?:'authorization' | 'payment_reversal' | 'payment' | 'refund',is_not?:'authorization' | 'payment_reversal' | 'payment' | 'refund',not_in?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; } export interface OrdersResponse { export:Export; @@ -635,6 +617,30 @@ Total amount charged for the order. order?:{amount_paid?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},cancelled_at?:{after?:string,before?:string,between?:string,on?:string},customer_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},delivered_at?:{after?:string,before?:string,between?:string,on?:string},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},is_resent?:{is?:'true' | 'false'},order_date?:{after?:string,before?:string,between?:string,on?:string},original_order_id?:{is?:string,is_not?:string,starts_with?:string},price_type?:{in?:string,is?:'tax_exclusive' | 'tax_inclusive',is_not?:'tax_exclusive' | 'tax_inclusive',not_in?:string},refundable_credits?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},refundable_credits_issued?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},resent_status?:{in?:string,is?:'fully_resent' | 'partially_resent',is_not?:'fully_resent' | 'partially_resent',not_in?:string},shipped_at?:{after?:string,before?:string,between?:string,on?:string},shipping_date?:{after?:string,before?:string,between?:string,on?:string},status?:{in?:string,is?:'new' | 'partially_delivered' | 'queued' | 'delivered' | 'on_hold' | 'shipped' | 'processing' | 'cancelled' | 'voided' | 'complete' | 'awaiting_shipment' | 'returned',is_not?:'new' | 'partially_delivered' | 'queued' | 'delivered' | 'on_hold' | 'shipped' | 'processing' | 'cancelled' | 'voided' | 'complete' | 'awaiting_shipment' | 'returned',not_in?:string},subscription_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; } + export interface ItemFamiliesResponse { + export:Export; + } + export interface ItemFamiliesInputParam { + + /** + * @description Parameters for item_family + + */ + + item_family?:{id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},name?:{is?:string,is_not?:string,starts_with?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; + } + export interface ItemsResponse { + export:Export; + } + export interface ItemsInputParam { + + /** + * @description Parameters for item + + */ + + item?:{channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string},enabled_for_checkout?:{is?:'true' | 'false'},enabled_in_portal?:{is?:'true' | 'false'},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},is_giftable?:{is?:'true' | 'false'},item_applicability?:{in?:string,is?:'all' | 'restricted',is_not?:'all' | 'restricted',not_in?:string},item_family_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},metered?:{is?:'true' | 'false'},name?:{is?:string,is_not?:string,starts_with?:string},status?:{in?:string,is?:'archived' | 'deleted' | 'active',is_not?:'archived' | 'deleted' | 'active',not_in?:string},type?:{in?:string,is?:'charge' | 'addon' | 'plan',is_not?:'charge' | 'addon' | 'plan',not_in?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string},usage_calculation?:{in?:string,is?:'max_usage' | 'sum_of_usages' | 'last_usage',is_not?:'max_usage' | 'sum_of_usages' | 'last_usage',not_in?:string}}; + } export interface ItemPricesResponse { export:Export; } @@ -680,57 +686,51 @@ Filter item prices based on their `currency_code`. item_price?:{channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},name?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},period?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},period_unit?:{in?:string,is?:'week' | 'month' | 'year' | 'day',is_not?:'week' | 'month' | 'year' | 'day',not_in?:string},pricing_model?:{in?:string,is?:'volume' | 'per_unit' | 'tiered' | 'flat_fee' | 'stairstep',is_not?:'volume' | 'per_unit' | 'tiered' | 'flat_fee' | 'stairstep',not_in?:string},status?:{in?:string,is?:'archived' | 'deleted' | 'active',is_not?:'archived' | 'deleted' | 'active',not_in?:string},trial_period?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string},trial_period_unit?:{in?:string,is?:'month' | 'day',is_not?:'month' | 'day',not_in?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; } - export interface SubscriptionsResponse { + export interface AttachedItemsResponse { export:Export; } - export interface SubscriptionsInputParam { - - /** - * @description null - - */ - - export_type?:ExportType; + export interface AttachedItemsInputParam { /** - * @description optional, string filter -The plan item code. -**Supported operators :** is, is_not, starts_with, in, not_in + * @description optional, enumerated string filter +To filter based on the type of of the attached item. Possible values are : `addon`, `charge`. Possible values are : plan, addon, charge. +**Supported operators :** is, is_not, in, not_in -**Example →** *item_id\[is\] = "silver"* +**Example →** *item_type\[is_not\] = "plan"* */ - item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + item_type?:{in?:string,is?:'charge' | 'addon' | 'plan',is_not?:'charge' | 'addon' | 'plan',not_in?:string}; /** - * @description optional, string filter -The plan item price code. -**Supported operators :** is, is_not, starts_with, in, not_in - -**Example →** *item_price_id\[is\] = "silver-USD-monthly"* + * @description Parameters for attached_item */ - item_price_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + attached_item?:{charge_on_event?:{in?:string,is?:'subscription_creation' | 'subscription_activation' | 'subscription_trial_start' | 'contract_termination' | 'plan_activation' | 'on_demand',is_not?:'subscription_creation' | 'subscription_activation' | 'subscription_trial_start' | 'contract_termination' | 'plan_activation' | 'on_demand',not_in?:string},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},parent_item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},type?:{in?:string,is?:'optional' | 'mandatory' | 'recommended',is_not?:'optional' | 'mandatory' | 'recommended',not_in?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; + } + export interface DifferentialPricesResponse { + export:Export; + } + export interface DifferentialPricesInputParam { /** * @description optional, string filter -Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Subscriptions \> Subscription Cancellation** . Must be passed if set as mandatory in the app. The codes are case-sensitive. +Item Id of Addon / Charge item price for which differential pricing is applied to. **Supported operators :** is, is_not, starts_with, in, not_in -**Example →** *cancel_reason_code\[is\] = "Not Paid"* +**Example →** *item_id\[is\] = "day-pass"* */ - cancel_reason_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Parameters for subscription + * @description Parameters for differential_price */ - subscription?:{activated_at?:{after?:string,before?:string,between?:string,is_present?:'true' | 'false',on?:string},auto_close_invoices?:{is?:'true' | 'false'},cancel_reason?:{in?:string,is?:'tax_calculation_failed' | 'fraud_review_failed' | 'currency_incompatible_with_gateway' | 'non_compliant_eu_customer' | 'non_compliant_customer' | 'not_paid' | 'no_card',is_not?:'tax_calculation_failed' | 'fraud_review_failed' | 'currency_incompatible_with_gateway' | 'non_compliant_eu_customer' | 'non_compliant_customer' | 'not_paid' | 'no_card',is_present?:'true' | 'false',not_in?:string},cancelled_at?:{after?:string,before?:string,between?:string,on?:string},channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string},created_at?:{after?:string,before?:string,between?:string,on?:string},customer_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},has_scheduled_changes?:{is?:'true' | 'false'},id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},next_billing_at?:{after?:string,before?:string,between?:string,on?:string},offline_payment_method?:{in?:string,is?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',is_not?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',not_in?:string},remaining_billing_cycles?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,is_present?:'true' | 'false',lt?:string,lte?:string},status?:{in?:string,is?:'in_trial' | 'paused' | 'future' | 'active' | 'cancelled' | 'non_renewing',is_not?:'in_trial' | 'paused' | 'future' | 'active' | 'cancelled' | 'non_renewing',not_in?:string},updated_at?:{after?:string,before?:string,between?:string,on?:string}}; + differential_price?:{id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},item_price_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string},parent_item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}}; } export interface Download { /** @@ -738,14 +738,14 @@ Reason code for canceling the subscription. Must be one from a list of reason co */ - download_url?:string; + download_url:string; /** * @description The time until which the `download_url` is valid. */ - valid_till?:number; + valid_till:number; /** * @description The [media type](https://en.wikipedia.org/wiki/Media_type) of the file. diff --git a/types/resources/Feature.d.ts b/types/resources/Feature.d.ts index 42889b8..78adea7 100644 --- a/types/resources/Feature.d.ts +++ b/types/resources/Feature.d.ts @@ -90,20 +90,6 @@ declare module 'chargebee' { create(input:CreateInputParam):ChargebeeRequest; - /** - * @description Deletes a feature. Any item entitlements and subscription entitlements defined for the feature are also removed. This action is not permissible when the `status` of the feature is `active`. - - */ - - delete(feature_id:string):ChargebeeRequest; - - /** - * @description Retrieve a specific feature using its id. - - */ - - retrieve(feature_id:string):ChargebeeRequest; - /** * @description Updates a specific feature. **Note** @@ -146,11 +132,18 @@ However, changing `levels[]` to the state shown below is not permissib update(feature_id:string, input?:UpdateInputParam):ChargebeeRequest; /** - * @description Archives an `active` feature so that no **new** [item](item_entitlements) or [subscription entitlements](subscription_entitlements) can be created towards the feature. Any pre-existing item or subscription entitlements from the time that the feature was `active` remain effective. This operation changes the [status](features#feature_status) of the feature to `archived`. The feature `status` must be `active` when calling this endpoint. + * @description Retrieve a specific feature using its id. */ - archive(feature_id:string):ChargebeeRequest; + retrieve(feature_id:string):ChargebeeRequest; + + /** + * @description Deletes a feature. Any item entitlements and subscription entitlements defined for the feature are also removed. This action is not permissible when the `status` of the feature is `active`. + + */ + + delete(feature_id:string):ChargebeeRequest; /** * @description Activates a `draft` feature so that any [item](item_entitlements) or [subscription entitlements](subscription_entitlements) defined towards it take effect immediately. This operation changes the [status](features#feature_status) of the feature to `active`. The feature `status` must be `draft` when calling this endpoint. @@ -159,6 +152,13 @@ However, changing `levels[]` to the state shown below is not permissib activate(feature_id:string):ChargebeeRequest; + /** + * @description Archives an `active` feature so that no **new** [item](item_entitlements) or [subscription entitlements](subscription_entitlements) can be created towards the feature. Any pre-existing item or subscription entitlements from the time that the feature was `active` remain effective. This operation changes the [status](features#feature_status) of the feature to `archived`. The feature `status` must be `active` when calling this endpoint. + + */ + + archive(feature_id:string):ChargebeeRequest; + /** * @description Reactivates an archived feature so that **new** [item](item_entitlements) or [subscription entitlements](subscription_entitlements) can be created towards the feature. This operation changes the [status](features#feature_status) of the feature to `active`. The feature `status` must be `archived` when calling this endpoint. @@ -184,43 +184,42 @@ However, changing `levels[]` to the state shown below is not permissib export interface ListInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description "This API fetches all the available features. " If the limit parameter is not set, it will return upto 10 features. " */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description "This API fetches all the available features. " If the limit parameter is not set, it will return upto 10 features. " */ offset?:string; /** - * @description A case-sensitive unique name for the feature. For example: `user license`, `data storage`, `Salesforce Integration`, `devices`, `UHD Streaming`, and so on. -**Note:** This name is not displayed on any customer-facing documents or pages such as [invoice PDFs](invoices#retrieve_invoice_as_pdf) or [hosted pages](hosted_pages). However, in the future, it is likely to be introduced on the [Self-Serve Portal](portal_sessions). + * @description "This API fetches all the available features. " If the limit parameter is not set, it will return upto 10 features. " */ name?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description A unique and immutable identifier for the feature. You can set it yourself, in which case it is recommended that a human-readable format (or slug) be used. For example, `number-of-users-ccjht01`. When not provided, a random value is automatically set. + * @description "This API fetches all the available features. " If the limit parameter is not set, it will return upto 10 features. " */ id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description The current status of the feature. + * @description "This API fetches all the available features. " If the limit parameter is not set, it will return upto 10 features. " */ status?:{in?:string,is?:'archived' | 'draft' | 'active',is_not?:'archived' | 'draft' | 'active',not_in?:string}; /** - * @description The type of feature. + * @description "This API fetches all the available features. " If the limit parameter is not set, it will return upto 10 features. " */ @@ -281,14 +280,6 @@ However, changing `levels[]` to the state shown below is not permissib levels?:{is_unlimited?:boolean,level?:number,name?:string,value?:string}[]; } - export interface DeleteResponse { - feature:Feature; - } - - export interface RetrieveResponse { - feature:Feature; - } - export interface UpdateResponse { feature:Feature; } @@ -330,7 +321,11 @@ However, changing `levels[]` to the state shown below is not permissib levels?:{is_unlimited?:boolean,level?:number,name?:string,value?:string}[]; } - export interface ArchiveResponse { + export interface RetrieveResponse { + feature:Feature; + } + + export interface DeleteResponse { feature:Feature; } @@ -338,18 +333,54 @@ However, changing `levels[]` to the state shown below is not permissib feature:Feature; } + export interface ArchiveResponse { + feature:Feature; + } + export interface ReactivateResponse { feature:Feature; } export interface Level { + /** + * @description A case-sensitive display name for the entitlement level. Provide a name that helps you clearly identify the entitlement level. For example: a feature such as `Email Support` can have entitlement levels named as `All weekdays`, `All days`, `40 hours per week` and so on. When not provided for `feature.type` `quantity` or `range`, this name is auto-generated as the space-separated concatenation of `levels[].value` and the pluralized version of `unit`. For example, if `levels[].value` is `20` and `unit` is `user`, then `levels[].name` becomes `20 users`. + + */ + name?:string; - value?:string; + /** + * @description The value denoting the entitlement level granted. + +* **When `type` is `quantity`:** this attribute denotes the quantity of units of the feature for this entitlement level. For example, a feature such as `number of users` can have `levels[].value` as `5`, `20`, `50`, and `100`. `levels[].is_unlimited` is used to set the entitlement level to "unlimited". +* **When `type` is `range`:** there can be be only two elements in the `levels[]` array; one corresponding to the minimum value (`levels[0]`) and the other to the maximum value (`levels[1]`) of the range of possible entitlement levels. For example, a feature such as `number of users` may have `levels[0].value` = `5` and `levels[1].value` = `50000`. When the upper limit is "unlimited", then `levels[1].value` is not set and `levels[1].is_unlimited` is `true`. +* **When `type` is `custom`:** this attribute denotes the value of this custom entitlement level. For example, a feature `Email Support` can have `levels[].value` as one of say, `24×7` and `24×5`. + + */ - level?:number; + value:string; + + /** + * @description This attribute represents the order of the entitlement levels from lowest to highest. + +* When `type` is `quantity` or `custom`: The lowest entitlement level has the value `0`, the next higher level has the value `1`, followed by `2`, and so on. +* When `type` is `range`: This attribute is `0` for the minimum value and `1` for the maximum value in the range. + +When not defined, it is assumed as the index of the `levels[]` array. + + */ + + level:number; + + /** + * @description When `type` is `quantity` or `range`, this attribute indicates whether the entitlement level corresponds to unlimited units of the feature. Possible values: + +* `true`: The entitlement level corresponds to unlimited units of the feature. `levels[].value` is ignored for this level. This can only be set for the level that has the highest value for `levels[].level.` +* `false`: The entitlement level does not correspond to unlimited units of the feature. + + */ - is_unlimited?:boolean; + is_unlimited:boolean; } } } \ No newline at end of file diff --git a/types/resources/Gift.d.ts b/types/resources/Gift.d.ts index b5887c5..7567895 100644 --- a/types/resources/Gift.d.ts +++ b/types/resources/Gift.d.ts @@ -89,39 +89,39 @@ declare module 'chargebee' { create_for_items(input?:CreateForItemsInputParam):ChargebeeRequest; /** - * @description This API allows to cancel gifts. Only gift in 'scheduled' and 'unclaimed' states can be cancelled. + * @description Retrieves a gift subscription. This API accepts the gift 'id' and returns the gift along with the subscription. */ - cancel(gift_id:string):ChargebeeRequest; + retrieve(gift_id:string):ChargebeeRequest; /** - * @description Change the date/time at which the gift notification email is to be sent. This only applies to gifts in the scheduled [status](https://apidocs.chargebee.com/docs/api/gifts#gift_status). + * @description Retrieves the list of gifts. */ - update_gift(gift_id:string, input:UpdateGiftInputParam):ChargebeeRequest; + list(input?:ListInputParam):ChargebeeRequest; /** - * @description Retrieves the list of gifts. + * @description Claiming a gift will move the status to 'claimed'. Only gifts in 'unclaimed' state can be claimed. */ - list(input?:ListInputParam):ChargebeeRequest; + claim(gift_id:string):ChargebeeRequest; /** - * @description Retrieves a gift subscription. This API accepts the gift 'id' and returns the gift along with the subscription. + * @description This API allows to cancel gifts. Only gift in 'scheduled' and 'unclaimed' states can be cancelled. */ - retrieve(gift_id:string):ChargebeeRequest; + cancel(gift_id:string):ChargebeeRequest; /** - * @description Claiming a gift will move the status to 'claimed'. Only gifts in 'unclaimed' state can be claimed. + * @description Change the date/time at which the gift notification email is to be sent. This only applies to gifts in the scheduled [status](https://apidocs.chargebee.com/docs/api/gifts#gift_status). */ - claim(gift_id:string):ChargebeeRequest; + update_gift(gift_id:string, input:UpdateGiftInputParam):ChargebeeRequest; } export interface CreateForItemsResponse { gift:Gift; @@ -186,7 +186,7 @@ declare module 'chargebee' { */ - payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'sofort' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'card',reference_id?:string}; + payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'faster_payments' | 'sofort' | 'upi' | 'venmo' | 'amazon_payments' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'pay_to' | 'card',reference_id?:string}; /** * @description Parameters for shipping_address @@ -202,33 +202,12 @@ declare module 'chargebee' { subscription_items?:{item_price_id?:string,quantity?:number,quantity_in_decimal?:string}[]; } - export interface CancelResponse { + export interface RetrieveResponse { gift:Gift; subscription:Subscription; } - export interface UpdateGiftResponse { - gift:Gift; - - subscription:Subscription; - } - export interface UpdateGiftInputParam { - - /** - * @description The new date/time at which the gift notification email is to be sent. The value must be greater than current time. If [no_expiry](https://apidocs.chargebee.com/docs/api/gifts#gift_no_expiry) is false then the value must also be less than [claim_expiry_date](https://apidocs.chargebee.com/docs/api/gifts#gift_claim_expiry_date). - - */ - - scheduled_at:number; - - /** - * @description An internal comment for this action. The comments are not retrievable via API and are only available on request via [Chargebee Support](https://chargebee.freshdesk.com/support/home). - - */ - - comment?:string; - } export interface ListResponse { /** * @description Retrieves the list of gifts. @@ -247,59 +226,80 @@ declare module 'chargebee' { export interface ListInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description Retrieves the list of gifts. */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Retrieves the list of gifts. */ offset?:string; /** - * @description Status of the gift. + * @description Retrieves the list of gifts. */ status?:{in?:string,is?:'expired' | 'scheduled' | 'unclaimed' | 'claimed' | 'cancelled',is_not?:'expired' | 'scheduled' | 'unclaimed' | 'claimed' | 'cancelled',not_in?:string}; /** - * @description Parameters for gift_receiver + * @description Retrieves the list of gifts. */ gift_receiver?:{customer_id?:{is?:string,is_not?:string,starts_with?:string},email?:{is?:string,is_not?:string,starts_with?:string}}; /** - * @description Parameters for gifter + * @description Retrieves the list of gifts. */ gifter?:{customer_id?:{is?:string,is_not?:string,starts_with?:string}}; } - export interface RetrieveResponse { + export interface ClaimResponse { gift:Gift; subscription:Subscription; } - export interface ClaimResponse { + export interface CancelResponse { gift:Gift; subscription:Subscription; } + export interface UpdateGiftResponse { + gift:Gift; + + subscription:Subscription; + } + export interface UpdateGiftInputParam { + + /** + * @description The new date/time at which the gift notification email is to be sent. The value must be greater than current time. If [no_expiry](https://apidocs.chargebee.com/docs/api/gifts#gift_no_expiry) is false then the value must also be less than [claim_expiry_date](https://apidocs.chargebee.com/docs/api/gifts#gift_claim_expiry_date). + + */ + + scheduled_at:number; + + /** + * @description An internal comment for this action. The comments are not retrievable via API and are only available on request via [Chargebee Support](https://chargebee.freshdesk.com/support/home). + + */ + + comment?:string; + } export interface Gifter { /** * @description Gifter customer id. */ - customer_id?:string; + customer_id:string; /** * @description Invoice raised on the gifter. @@ -328,14 +328,14 @@ declare module 'chargebee' { */ - customer_id?:string; + customer_id:string; /** * @description Subscription created for the gift. */ - subscription_id?:string; + subscription_id:string; /** * @description First name of the receiver as given by the gifter. @@ -359,7 +359,17 @@ declare module 'chargebee' { email?:string; } export interface GiftTimeline { - status?:'expired' | 'scheduled' | 'unclaimed' | 'claimed' | 'cancelled'; + /** + * @description Status of the gift. \* cancelled - Gift is cancelled. \* expired - Gift is expired. \* scheduled - Gift has been scheduled. \* claimed - Gift is claimed. \* unclaimed - Gift is not yet claimed and is ready to be claimed. + + */ + + status:'expired' | 'scheduled' | 'unclaimed' | 'claimed' | 'cancelled'; + + /** + * @description Timestamp indicating when this event occurred. + + */ occurred_at?:number; } diff --git a/types/resources/HostedPage.d.ts b/types/resources/HostedPage.d.ts index 3b4cd15..6ccadea 100644 --- a/types/resources/HostedPage.d.ts +++ b/types/resources/HostedPage.d.ts @@ -114,72 +114,71 @@ If multiple [business entities](/docs/api/advanced-features#mbe) are created for checkout_one_time_for_items(input?:CheckoutOneTimeForItemsInputParam):ChargebeeRequest; /** - * @description **Note:** If you're using [In-App Checkout](https://www.chargebee.com/docs/2.0/checkout.html), use [Manage Payment Sources API](/docs/api/hosted_pages#manage_payment_sources) to request your customers to update their payment method details or change their payment method. + * @description Create a Chargebee hosted page to accept payment details from a customer and checkout a new subscription. -Using this API, you can request your customers to update their payment method details or change their payment method. This is used in scenarios like customers updating their payment methods before the end of trial or customers switching among payment methods. +The following steps describe how best to use this API: -When this API is invoked, it returns a hosted page URL. When the customers are directed to this URL, they will be able to change/update their payment methods. +1. Call this endpoint, providing [item prices](./item_prices?prod_cat_ver=2), [coupons](./coupons?prod_cat_ver=2) and a host of other details such as billing and shipping addresses to be prefilled for the customer on the checkout page. +2. Send the customer to the Checkout `url` received in the response. +3. Once they complete checkout, a new subscription is automatically created and the customer is redirected to the `redirect_url` with the `id` and `state` attributes passed as query string parameters. + Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons. Chargebee recommends listening to appropriate webhooks such as [subscription_created](./events#subscription_created) or [invoice_generated](./events#invoice_generated) to verify a successful checkout. +4. [Retrieve the hosted page](./hosted_pages?prod_cat_ver=2#retrieve_a_hosted_page) at this stage to get the subscription and invoice details. -Depending on the payment methods (Card, PayPal Express Checkout, Amazon Payments) that you offer your customers, they will find options to switch among the various methods of payment. -**Note:** -* If the card\[gateway\] parameter is passed, and the customer chooses Card as a payment method, then the card details are stored in the gateway which is passed. However, if the card\[gateway\] parameter is passed and the customer chooses PayPal Express Checkout/Amazon Payments as a payment method, the gateway passed will be ignored. -* The option of embedding into an iframe is not supported for PayPal Express Checkout and Amazon Payments as customers are redirected to the respective website pages. Hence if you have PayPal Express Checkout/Amazon Payments configured and pass the parameter embed=true, this will result in an unsuccessful API request. Also, if you have all the three payment methods (Card, Paypal Express Checkout and Amazon Payments) configured and pass the parameter embed=true, the returned hosted page URL will show only Card Payment as a payment method. - */ - - update_payment_method(input?:UpdatePaymentMethodInputParam):ChargebeeRequest; - - /** - * @description This API generates a hosted page URL to extend the billing cycle of a subscription. +#### Customer resource lookup and creation {#customer_lookup2} - */ - - extend_subscription(input?:ExtendSubscriptionInputParam):ChargebeeRequest; - - /** - * @description Use this API to notify Chargebee about important events that occur on your web pages, such as subscription cancellations. An event contains data about affected resources and additional details such as when the change occurred. +When the [customer[id]](/docs/api/hosted_pages#create_checkout_for_a_new_subscription_customer_id) parameter is provided and if a customer resource with the ID is found to be already created in Chargebee, the subscription is created under that customer resource. If not found, then a new customer resource is created with the ID provided and the subscription is created under it. + +##### Multiple business entities + +If multiple [business entities](/docs/api/advanced-features?prod_cat_ver=2#mbe) are created for the site, the customer resource lookup and creation happen within the [context](/docs/api/advanced-features#mbe-context) of the business entity [specified](/docs/api/advanced-features#mbe-header-main) in this API call. If no business entity is specified, the customer resource lookup is performed within the [site context](/docs/api/advanced-features#mbe-context), and if not found, the resource is created for the [default business entity](/docs/api/advanced-features#mbe-default-be) of the site. */ - events(input:EventsInputParam):ChargebeeRequest; + checkout_new_for_items(input?:CheckoutNewForItemsInputParam):ChargebeeRequest; /** - * @description Creates a hosted page for a customer (called the gifter) to gift a subscription to another customer (called the receiver). - -#### Gifter customer resource lookup and creation {#gifter_lookup} - -When [gifter[customer_id]](/docs/api/hosted_pages#checkout_gift_subscription_for_items_gifter_customer_id) is provided, it is looked up in Chargebee when the gifter completes the hosted page checkout. If not found, a new customer resource is created with this ID. - -##### Multiple business entities + * @description Create a Chargebee hosted page to accept payment details from a customer and checkout to update the subscription. -If multiple [business entities](/docs/api/advanced-features?prod_cat_ver=2#mbe) are created for the site, the lookup and creation of the gifter customer resource happen within the [context](/docs/api/advanced-features#mbe-context) of the business entity specified in this API call. If no business entity is [specified](/docs/api/advanced-features#mbe-header-main), the customer resource lookup is performed within the [site context](/docs/api/advanced-features#mbe-context), and if not found, the resource is created for the [default business entity](/docs/api/advanced-features#mbe-default-be) of the site. +The following steps describe how best to use this API: -#### Gift receiver customer resource lookup and creation {#receiver_lookup} +1. Provide [item prices](./item_prices?prod_cat_ver=2), [coupons](./coupons?prod_cat_ver=2) and a host of other details such as billing and shipping addresses to be prefilled for the customer on the checkout page. +2. Send the customer to the Checkout `url` received in the response. They can now add a payment method or use an existing one, to complete the checkout. +3. The subscription is updated and the customer is redirected to the `redirect_url` with the `id` and `state` attributes passed as query string parameters. + Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons. Chargebee recommends listening to appropriate webhooks such as [subscription_created](./events#subscription_created) or [invoice_generated](./events#invoice_generated) to verify a successful checkout. +4. [Retrieve the hosted page](./hosted_pages?prod_cat_ver=2#retrieve_a_hosted_page) at this stage to get the subscription and invoice details. -Once the gifter checks out using the hosted page returned by this endpoint, Chargebee checks if a customer resource with the receiver's email address exists. The first such customer record is considered the receiver's customer resource. A new customer resource is created for the receiver if none are found. -##### Multiple business entities -If multiple [business entities](/docs/api/advanced-features?prod_cat_ver=2#mbe) are created for the site, the lookup and creation of the gift receiver's customer resource happen within the [context](/docs/api/advanced-features#mbe-context) of the business entity of the gifter */ - checkout_gift_for_items(input?:CheckoutGiftForItemsInputParam):ChargebeeRequest; + checkout_existing_for_items(input?:CheckoutExistingForItemsInputParam):ChargebeeRequest; /** - * @description This API retrieves the list of hosted page resources. + * @description **Note:** If you're using [In-App Checkout](https://www.chargebee.com/docs/2.0/checkout.html), use [Manage Payment Sources API](/docs/api/hosted_pages#manage_payment_sources) to request your customers to update their payment method details or change their payment method. + +Using this API, you can request your customers to update their payment method details or change their payment method. This is used in scenarios like customers updating their payment methods before the end of trial or customers switching among payment methods. + +When this API is invoked, it returns a hosted page URL. When the customers are directed to this URL, they will be able to change/update their payment methods. + +Depending on the payment methods (Card, PayPal Express Checkout, Amazon Payments) that you offer your customers, they will find options to switch among the various methods of payment. +**Note:** + +* If the card\[gateway\] parameter is passed, and the customer chooses Card as a payment method, then the card details are stored in the gateway which is passed. However, if the card\[gateway\] parameter is passed and the customer chooses PayPal Express Checkout/Amazon Payments as a payment method, the gateway passed will be ignored. +* The option of embedding into an iframe is not supported for PayPal Express Checkout and Amazon Payments as customers are redirected to the respective website pages. Hence if you have PayPal Express Checkout/Amazon Payments configured and pass the parameter embed=true, this will result in an unsuccessful API request. Also, if you have all the three payment methods (Card, Paypal Express Checkout and Amazon Payments) configured and pass the parameter embed=true, the returned hosted page URL will show only Card Payment as a payment method. */ - list(input?:ListInputParam):ChargebeeRequest; + update_payment_method(input?:UpdatePaymentMethodInputParam):ChargebeeRequest; /** - * @description Creates a `hosted_page` resource of type, `view_voucher`. When your end customers choose the Boleto payment method, you can generate a voucher for their pending invoice. Using this API, you can create a voucher_detail hosted page for your customers and email them a link to this hosted page. Your customers can review the voucher details on the page by clicking the link in the email. + * @description This API generates a hosted page URL to add new or update existing payment sources for the customer. */ - view_voucher(input?:ViewVoucherInputParam):ChargebeeRequest; + manage_payment_sources(input?:ManagePaymentSourcesInputParam):ChargebeeRequest; /** * @description This API generates a hosted page URL to collect due payments for the customer. @@ -196,29 +195,34 @@ If multiple [business entities](/docs/api/advanced-features?prod_cat_ver=2# accept_quote(input?:AcceptQuoteInputParam):ChargebeeRequest; /** - * @description Create a Chargebee hosted page to accept payment details from a customer and checkout a new subscription. + * @description This API generates a hosted page URL to extend the billing cycle of a subscription. -The following steps describe how best to use this API: + */ + + extend_subscription(input?:ExtendSubscriptionInputParam):ChargebeeRequest; + + /** + * @description Creates a hosted page for a customer (called the gifter) to gift a subscription to another customer (called the receiver). -1. Call this endpoint, providing [item prices](./item_prices?prod_cat_ver=2), [coupons](./coupons?prod_cat_ver=2) and a host of other details such as billing and shipping addresses to be prefilled for the customer on the checkout page. -2. Send the customer to the Checkout `url` received in the response. -3. Once they complete checkout, a new subscription is automatically created and the customer is redirected to the `redirect_url` with the `id` and `state` attributes passed as query string parameters. - Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons. Chargebee recommends listening to appropriate webhooks such as [subscription_created](./events#subscription_created) or [invoice_generated](./events#invoice_generated) to verify a successful checkout. -4. [Retrieve the hosted page](./hosted_pages?prod_cat_ver=2#retrieve_a_hosted_page) at this stage to get the subscription and invoice details. +#### Gifter customer resource lookup and creation {#gifter_lookup} +When [gifter[customer_id]](/docs/api/hosted_pages#checkout_gift_subscription_for_items_gifter_customer_id) is provided, it is looked up in Chargebee when the gifter completes the hosted page checkout. If not found, a new customer resource is created with this ID. +##### Multiple business entities -#### Customer resource lookup and creation {#customer_lookup2} +If multiple [business entities](/docs/api/advanced-features?prod_cat_ver=2#mbe) are created for the site, the lookup and creation of the gifter customer resource happen within the [context](/docs/api/advanced-features#mbe-context) of the business entity specified in this API call. If no business entity is [specified](/docs/api/advanced-features#mbe-header-main), the customer resource lookup is performed within the [site context](/docs/api/advanced-features#mbe-context), and if not found, the resource is created for the [default business entity](/docs/api/advanced-features#mbe-default-be) of the site. -When the [customer[id]](/docs/api/hosted_pages#create_checkout_for_a_new_subscription_customer_id) parameter is provided and if a customer resource with the ID is found to be already created in Chargebee, the subscription is created under that customer resource. If not found, then a new customer resource is created with the ID provided and the subscription is created under it. +#### Gift receiver customer resource lookup and creation {#receiver_lookup} + +Once the gifter checks out using the hosted page returned by this endpoint, Chargebee checks if a customer resource with the receiver's email address exists. The first such customer record is considered the receiver's customer resource. A new customer resource is created for the receiver if none are found. ##### Multiple business entities -If multiple [business entities](/docs/api/advanced-features?prod_cat_ver=2#mbe) are created for the site, the customer resource lookup and creation happen within the [context](/docs/api/advanced-features#mbe-context) of the business entity [specified](/docs/api/advanced-features#mbe-header-main) in this API call. If no business entity is specified, the customer resource lookup is performed within the [site context](/docs/api/advanced-features#mbe-context), and if not found, the resource is created for the [default business entity](/docs/api/advanced-features#mbe-default-be) of the site. +If multiple [business entities](/docs/api/advanced-features?prod_cat_ver=2#mbe) are created for the site, the lookup and creation of the gift receiver's customer resource happen within the [context](/docs/api/advanced-features#mbe-context) of the business entity of the gifter */ - checkout_new_for_items(input?:CheckoutNewForItemsInputParam):ChargebeeRequest; + checkout_gift_for_items(input?:CheckoutGiftForItemsInputParam):ChargebeeRequest; /** * @description This API generates a hosted page URL to claim a gifted subscription. @@ -228,30 +232,15 @@ If multiple [business entities](/docs/api/advanced-features?prod_cat_ver=2# claim_gift(input?:ClaimGiftInputParam):ChargebeeRequest; /** - * @description Create a Chargebee hosted page to accept payment details from a customer and checkout to update the subscription. - -The following steps describe how best to use this API: - -1. Provide [item prices](./item_prices?prod_cat_ver=2), [coupons](./coupons?prod_cat_ver=2) and a host of other details such as billing and shipping addresses to be prefilled for the customer on the checkout page. -2. Send the customer to the Checkout `url` received in the response. They can now add a payment method or use an existing one, to complete the checkout. -3. The subscription is updated and the customer is redirected to the `redirect_url` with the `id` and `state` attributes passed as query string parameters. - Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons. Chargebee recommends listening to appropriate webhooks such as [subscription_created](./events#subscription_created) or [invoice_generated](./events#invoice_generated) to verify a successful checkout. -4. [Retrieve the hosted page](./hosted_pages?prod_cat_ver=2#retrieve_a_hosted_page) at this stage to get the subscription and invoice details. - - + * @description This is applicable only for Direct Debit via SEPA, Bacs, Bg Autogiro, BECS (for both Australia and New Zealand) and PAD. For Direct Debit, the customer needs to accept an agreement that allows the merchant to debit their bank account. This agreement PDF allows you to easily display scheme-rules compliant Direct Debit mandates to your customers. +This API retrieves the redirect link to the corresponding agreement for customers. The agreement PDF can be your "Thank You" page or sent by email to customers. Communicating this PDF to your customers is mandatory. - */ - - checkout_existing_for_items(input?:CheckoutExistingForItemsInputParam):ChargebeeRequest; - - /** - * @description Creates a `hosted_page` resource of `type` `pre_cancel`. Route canceling users to this page to provide them a retention experience and start saving revenue. -The hosted page is created in accordance with the retention experience [configured in the Chargebee Retention app](https://help.brightback.com/article/239-steps-to-get-brightback-ready-to-launch-for-chargebee-billing-merchants), along with the data provided as input to this endpoint. Call the endpoint before your customer clicks the **Cancel** button, and when they do, route them to the [url](https://apidocs.chargebee.com/docs/api/hosted_pages#hosted_page_url) in the endpoint response. +Customer locale is used to generate the PDF in the required language. If a customer language is not supported, the PDF is generated in English. Checkout the [list of languages](https://developer.gocardless.com/api-reference/#mandate-pdfs-create-a-mandate-pdf) supported by GoCardless. */ - pre_cancel(input?:PreCancelInputParam):ChargebeeRequest; + retrieve_agreement_pdf(input:RetrieveAgreementPdfInputParam):ChargebeeRequest; /** * @description When a hosted page is successfully completed by the user and processed by Chargebee, its [`state`](hosted_pages#hosted_page_state) is automatically changed to `succeeded`. Acknowledging a hosted page confirms that you have moved the customer details from Chargebee into your system and are ready to fulfill it. This API is used to acknowledge the hosted page in `succeeded` state and change its state to `acknowledged`. @@ -262,17 +251,6 @@ The hosted page is created in accordance with the retention experience [configur acknowledge(hosted_page_id:string):ChargebeeRequest; - /** - * @description This is applicable only for Direct Debit via SEPA, Bacs, Bg Autogiro, BECS (for both Australia and New Zealand) and PAD. For Direct Debit, the customer needs to accept an agreement that allows the merchant to debit their bank account. This agreement PDF allows you to easily display scheme-rules compliant Direct Debit mandates to your customers. - -This API retrieves the redirect link to the corresponding agreement for customers. The agreement PDF can be your "Thank You" page or sent by email to customers. Communicating this PDF to your customers is mandatory. - -Customer locale is used to generate the PDF in the required language. If a customer language is not supported, the PDF is generated in English. Checkout the [list of languages](https://developer.gocardless.com/api-reference/#mandate-pdfs-create-a-mandate-pdf) supported by GoCardless. - - */ - - retrieve_agreement_pdf(input:RetrieveAgreementPdfInputParam):ChargebeeRequest; - /** * @description When you retrieve a hosted page whose `status` is `successful`, the `content` attribute has the following objects based on the `type` of the hosted page. @@ -290,11 +268,33 @@ Customer locale is used to generate the PDF in the required language. If a custo retrieve(hosted_page_id:string):ChargebeeRequest; /** - * @description This API generates a hosted page URL to add new or update existing payment sources for the customer. + * @description This API retrieves the list of hosted page resources. */ - manage_payment_sources(input?:ManagePaymentSourcesInputParam):ChargebeeRequest; + list(input?:ListInputParam):ChargebeeRequest; + + /** + * @description Creates a `hosted_page` resource of `type` `pre_cancel`. Route canceling users to this page to provide them a retention experience and start saving revenue. +The hosted page is created in accordance with the retention experience [configured in the Chargebee Retention app](https://help.brightback.com/article/239-steps-to-get-brightback-ready-to-launch-for-chargebee-billing-merchants), along with the data provided as input to this endpoint. Call the endpoint before your customer clicks the **Cancel** button, and when they do, route them to the [url](https://apidocs.chargebee.com/docs/api/hosted_pages#hosted_page_url) in the endpoint response. + + */ + + pre_cancel(input?:PreCancelInputParam):ChargebeeRequest; + + /** + * @description Use this API to notify Chargebee about important events that occur on your web pages, such as subscription cancellations. An event contains data about affected resources and additional details such as when the change occurred. + + */ + + events(input:EventsInputParam):ChargebeeRequest; + + /** + * @description Creates a `hosted_page` resource of type, `view_voucher`. When your end customers choose the Boleto payment method, you can generate a voucher for their pending invoice. Using this API, you can create a voucher_detail hosted page for your customers and email them a link to this hosted page. Your customers can review the voucher details on the page by clicking the link in the email. + + */ + + view_voucher(input?:ViewVoucherInputParam):ChargebeeRequest; } export interface CheckoutOneTimeForItemsResponse { hosted_page:HostedPage; @@ -446,10 +446,65 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade entity_identifiers?:{id?:string,operation?:Operation,scheme?:string,standard?:string,value?:string}[]; } - export interface UpdatePaymentMethodResponse { + export interface CheckoutNewForItemsResponse { hosted_page:HostedPage; } - export interface UpdatePaymentMethodInputParam { + export interface CheckoutNewForItemsInputParam { + + /** + * @description Specifies the checkout layout that overrides the default checkout layout configured in the Checkout \& Self-Serve Portal settings. . \* in_app - Indicates in-app checkout version \* full_page - Indicates full page checkout version + + */ + + layout?:Layout; + + /** + * @description Sets the [context]() for this operation to the [business entity](/docs/api/advanced-features?prod_cat_ver=2#mbe) specified. Applicable only when multiple business entities have been created for the site. When this parameter is provided, the operation is able to read/write data associated only to the business entity specified. When not provided, the operation can read/write data for the entire site. +**Note** + +An alternative way of passing this parameter is by means of a [custom HTTP header](/docs/api/advanced-features?prod_cat_ver=2#mbe-header-main). +**See also** + +[Customer resource lookup and creation.](/docs/api/hosted_pages#customer_lookup2) + + */ + + business_entity_id?:string; + + /** + * @description The number of billing cycles the subscription runs before canceling. If not provided, then the billing cycles [set for the plan-item price](https://apidocs.chargebee.com/docs/api/item_prices?prod_cat_ver=2#item_price_billing_cycles) is used. + + */ + + billing_cycles?:number; + + /** + * @description Item ids of [mandatorily attached addons](./attached_items?prod_cat_ver=2) that are to be removed from the subscription. + + */ + + mandatory_items_to_remove?:string[]; + + /** + * @description The number of subscription billing cycles (including the first one) to [invoice in advance](https://www.chargebee.com/docs/advance-invoices.html). + + */ + + terms_to_charge?:number; + + /** + * @description Override the [billing alignment mode](https://www.chargebee.com/docs/calendar-billing.html#alignment-of-billing-date) for Calendar Billing. Only applicable when using Calendar Billing. The default value is that which has been configured for the site. \* immediate - Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly.. \* delayed - Subscription period will be aligned with the configured billing date at the next renewal. + + */ + + billing_alignment_mode?:BillingAlignmentMode; + + /** + * @description List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](https://apidocs.chargebee.com/docs/api/coupon_codes). + + */ + + coupon_ids?:string[]; /** * @description The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. @@ -486,20 +541,25 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade pass_thru_content?:string; /** - * @description If true then iframe will communicate with the parent window. Applicable only for embedded(iframe) hosted pages. If you're using iframe_messaging you need to implement onSuccess \& onCancel callbacks. + * @description Allow the customer to select an offline payment method during checkout. The choice of payment methods can be configured via the Chargebee UI. -**Note** : This parameter is not applicable for [in-app](https://www.chargebee.com/docs/checkout-v3.html) checkout. + */ + + allow_offline_payment_methods?:boolean; + + /** + * @description Parameters for subscription */ - iframe_messaging?:boolean; + subscription?:object; /** * @description Parameters for customer */ - customer?:{id:string}; + customer?:object; /** * @description Parameters for card @@ -507,311 +567,253 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade */ card?:{gateway_account_id?:string}; - } - export interface ExtendSubscriptionResponse { - hosted_page:HostedPage; - } - export interface ExtendSubscriptionInputParam { /** - * @description Expiry (in days) for the link generated. No expiry will be set if this is not specified. + * @description Parameters for billing_address */ - expiry?:number; + billing_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}; /** - * @description Number of billing cycles to extend. If not specified, plan's billing cycle will be used. + * @description Parameters for shipping_address */ - billing_cycle?:number; + 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}; /** - * @description Parameters for subscription + * @description Parameters for contract_term */ - subscription?:{id:string}; - } - export interface EventsResponse { - success:boolean; - } - export interface EventsInputParam { + contract_term?:{action_at_term_end?:'cancel' | 'renew' | 'evergreen',cancellation_cutoff_period?:number}; /** - * @description null + * @description Parameters for subscription_items */ - event_name:EventName; + subscription_items?:{billing_cycles?:number,charge_on_event?:ChargeOnEvent,charge_on_option?:ChargeOnOption,charge_once?:boolean,item_price_id:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,trial_end?:number,unit_price?:number,unit_price_in_decimal?:string}[]; /** - * @description Timestamp indicating when this event had occurred. . + * @description Parameters for discounts */ - occurred_at?:number; + discounts?:{amount?:number,apply_on:ApplyOn,duration_type:DurationType,included_in_mrr?:boolean,item_price_id?:string,percentage?:number,period?:number,period_unit?:PeriodUnit}[]; /** - * @description The meta data description of the event in key-value pair. The value is a JSON object with the following keys and their values. + * @description Parameters for item_tiers -* `subscription_id`: A unique and immutable identifier for the subscription. -. + */ + + item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; + + /** + * @description Parameters for entity_identifiers */ - event_data:object; + entity_identifiers?:{id?:string,operation?:Operation,scheme?:string,standard?:string,value?:string}[]; } - export interface CheckoutGiftForItemsResponse { + export interface CheckoutExistingForItemsResponse { hosted_page:HostedPage; } - export interface CheckoutGiftForItemsInputParam { + export interface CheckoutExistingForItemsInputParam { /** - * @description Sets the [context]() for this operation to the [business entity](/docs/api/advanced-features?prod_cat_ver=2#mbe) specified. Applicable only when multiple business entities have been created for the site. When this parameter is provided, the operation is able to read/write data associated only to the business entity specified. When not provided, the operation can read/write data for the entire site. -**Note** - -An alternative way of passing this parameter is by means of a [custom HTTP header](/docs/api/advanced-features?prod_cat_ver=2#mbe-header-main). -**See also** - -Gifter customer resource lookup and creation. + * @description Specifies the checkout layout that overrides the default checkout layout configured in the Checkout \& Self-Serve Portal settings. . \* in_app - Indicates in-app checkout version \* full_page - Indicates full page checkout version */ - business_entity_id?:string; + layout?:Layout; /** - * @description The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. - -**Note** : - -* Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons such as user closing the tab, or exiting the browser, and so on. If there is any synchronization that you are doing after the redirection, you will have to have a backup. Chargebee recommends listening to appropriate webhooks such as [`subscription_created`](https://apidocs.chargebee.com/docs/api/events#subscription_created) or [`invoice_generated`](https://apidocs.chargebee.com/docs/api/events#invoice_generated)to verify a successful checkout. -* Redirect URL configured in Settings \> Hosted Pages Settings would be overriden by this redirect URL. -* *Eg :* *http://yoursite.com?id=* *\<hosted_page_id\>\&state=succeeded* -* This parameter is not applicable for iframe messaging. + * @description Item ids of [mandatorily attached addons](./attached_items?prod_cat_ver=2) that are to be removed from the subscription. */ - redirect_url?:string; + mandatory_items_to_remove?:string[]; /** - * @description List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](https://apidocs.chargebee.com/docs/api/coupon_codes). + * @description If `true` then the existing `subscription_items` list for the subscription is replaced by the one provided. If `false` then the provided `subscription_items` list gets added to the existing list. */ - coupon_ids?:string[]; + replace_items_list?:boolean; /** - * @description Parameters for gifter + * @description The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if `create_pending_invoices` is set to `true`, and if the site is configured to set invoice dates to date of closing, then upon invoice closure, this date is changed to the invoice closing date. taxes and line_item_taxes are computed based on the tax configuration as of `invoice_date`. When passing this parameter, the following prerequisites must be met: + +* `invoice_date` must be in the past. +* `invoice_date` is not more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December. +* It is not earlier than `changes_scheduled_at`, `reactivate_from`, or `trial_end`. +* `invoice_immediately` is `true`. +. */ - gifter?:{customer_id?:string,locale?:string}; + invoice_date?:number; /** - * @description Parameters for subscription_items + * @description Billing cycles set for plan-item price is used by default. */ - subscription_items?:{item_price_id?:string,quantity?:number,quantity_in_decimal?:string}[]; - } - export interface ListResponse { + billing_cycles?:number; + /** - * @description This API retrieves the list of hosted page resources. + * @description The number of subscription billing cycles to [invoice in advance](https://www.chargebee.com/docs/advance-invoices.html). If a new term is started for the subscription due to this API call, then `terms_to_charge` is inclusive of this new term. See description for the `force_term_reset` parameter to learn more about when a subscription term is reset. */ - list:{hosted_page:HostedPage}[]; + terms_to_charge?:number; /** - * @description This API retrieves the list of hosted page resources. + * @description If the subscription `status` is `cancelled` and it is being reactivated via this operation, this is the date/time at which the subscription should be reactivated. +**Note:** It is recommended not to pass this parameter along with `changed_scheduled_at`. `reactivate_from` can be backdated (set to a value in the past). Use backdating when the subscription has been reactivated already but its billing has been delayed. Backdating is allowed only when the following prerequisites are met: - */ - - next_offset?:string; - } - export interface ListInputParam { - [key : string]: any; - /** - * @description The number of resources to be returned. +* Backdating must be enabled for subscription reactivation operations. +* The current day of the month does not exceed the limit set in Chargebee for backdating subscription change. This limit is the day of the month by which the accounting for the previous month must be closed. +* The date is on or after the last date/time any of the product catalog items of the subscription were changed. +* The date is not more than duration X into the past where X is the billing period of the plan. For example, if the period of the plan in the subscription is 2 months and today is 14th April, `changes_scheduled_at` cannot be earlier than 14th February. +. */ - - limit?:number; - /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. - - */ - - offset?:string; + reactivate_from?:number; /** - * @description Unique identifier generated for each hosted page requested. + * @description Override the [billing alignment mode](https://www.chargebee.com/docs/calendar-billing.html#alignment-of-billing-date) chosen for the site for calendar billing. Only applicable when using calendar billing. \* immediate - Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly.. \* delayed - Subscription period will be aligned with the configured billing date at the next renewal. */ - - id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; - /** - * @description Type of the requested hosted page. - - */ - - type?:{in?:string,is?:'update_payment_method' | 'checkout_one_time' | 'manage_payment_sources' | 'checkout_new' | 'view_voucher' | 'collect_now' | 'checkout_existing' | 'extend_subscription' | 'pre_cancel',is_not?:'update_payment_method' | 'checkout_one_time' | 'manage_payment_sources' | 'checkout_new' | 'view_voucher' | 'collect_now' | 'checkout_existing' | 'extend_subscription' | 'pre_cancel',not_in?:string}; + billing_alignment_mode?:BillingAlignmentMode; /** - * @description Indicating the current state of the hosted page resource. + * @description List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](https://apidocs.chargebee.com/docs/api/coupon_codes). */ - - state?:{in?:string,is?:'requested' | 'acknowledged' | 'created' | 'cancelled' | 'succeeded',is_not?:'requested' | 'acknowledged' | 'created' | 'cancelled' | 'succeeded',not_in?:string}; - /** - * @description Timestamp indicating when this hosted page was last updated. - - */ - - updated_at?:{after?:string,before?:string,between?:string,on?:string}; - } - export interface ViewVoucherResponse { - hosted_page:HostedPage; - } - export interface ViewVoucherInputParam { + coupon_ids?:string[]; /** - * @description Parameters for payment_voucher + * @description Applicable only for `cancelled` subscriptions. When passed as `true`, the canceled subscription is activated; otherwise subscription changes are made without changing its `status`. If not passed, subscription will be activated only if `subscription_items` is passed. */ - payment_voucher?:{id:string}; + reactivate?:boolean; /** - * @description Parameters for customer + * @description Say the subscription has the renewal date as 28th of every month. When the plan-item price of the subscription is set to one that has the same billing period as the current plan-item price, the subscription change does not change the term. In other words, the subscription still renews on the 28th. Passing this parameter as `true` will have the subscription reset its term to the current date (provided `end_of_term` is false). +**Note**: When the new plan-item price has a billing period different from the current plan-item price of the subscription, the term is always reset, regardless of the value passed for this parameter. */ - customer?:{locale?:string}; - } - export interface CollectNowResponse { - hosted_page:HostedPage; - } - export interface CollectNowInputParam { + force_term_reset?:boolean; /** - * @description Used to specify the destination URL to which a user is redirected after invoices are paid. The [transaction ID](/docs/api/transactions#transaction_id) of the transactions made through the Pay Now hosted page will be sent as return variables along with the URL. + * @description The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. + +**Note** : + +* Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons such as user closing the tab, or exiting the browser, and so on. If there is any synchronization that you are doing after the redirection, you will have to have a backup. Chargebee recommends listening to appropriate webhooks such as [`subscription_created`](https://apidocs.chargebee.com/docs/api/events#subscription_created) or [`invoice_generated`](https://apidocs.chargebee.com/docs/api/events#invoice_generated)to verify a successful checkout. +* Redirect URL configured in Settings \> Hosted Pages Settings would be overriden by this redirect URL. +* *Eg :* *http://yoursite.com?id=* *\<hosted_page_id\>\&state=succeeded* +* This parameter is not applicable for iframe messaging. */ redirect_url?:string; /** - * @description The currency code (ISO 4217 format) of the specified *credit amount*. + * @description The customers will be redirected to this URL upon canceling checkout. The hosted page id and state will be passed as parameters to this URL. - */ - - currency_code?:string; - - /** - * @description Parameters for customer +**Note** : + +* Cancel URL configured in Settings \> Hosted Pages Settings would be overriden by this cancel URL. + *Eg : http://yoursite.com?id=\<hosted_page_id\>\&state=cancelled* +* This parameter is not applicable for iframe messaging and [in-app](https://www.chargebee.com/docs/2.0/checkout.html) checkout. */ - customer?:{id:string}; + cancel_url?:string; /** - * @description Parameters for card + * @description You can pass through any content specific to the hosted page request and get it back after user had submitted the hosted page. */ - card?:{gateway_account_id?:string}; - } - export interface AcceptQuoteResponse { - hosted_page:HostedPage; - } - export interface AcceptQuoteInputParam { + pass_thru_content?:string; /** - * @description The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. - -**Note** : - -* Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons such as user closing the tab, or exiting the browser, and so on. If there is any synchronization that you are doing after the redirection, you will have to have a backup. Chargebee recommends listening to appropriate webhooks such as [`subscription_created`](https://apidocs.chargebee.com/docs/api/events#subscription_created) or [`invoice_generated`](https://apidocs.chargebee.com/docs/api/events#invoice_generated)to verify a successful checkout. -* Redirect URL configured in Settings \> Hosted Pages Settings would be overriden by this redirect URL. -* *Eg :* *http://yoursite.com?id=* *\<hosted_page_id\>\&state=succeeded* -* This parameter is not applicable for iframe messaging. + * @description Allow the customer to select an offline payment method during checkout. The choice of payment methods can be configured via the Chargebee UI. */ - redirect_url?:string; + allow_offline_payment_methods?:boolean; /** - * @description Parameters for quote + * @description Parameters for subscription */ - quote?:{id:string}; - } - export interface CheckoutNewForItemsResponse { - hosted_page:HostedPage; - } - export interface CheckoutNewForItemsInputParam { + subscription?:object; /** - * @description Specifies the checkout layout that overrides the default checkout layout configured in the Checkout \& Self-Serve Portal settings. . \* in_app - Indicates in-app checkout version \* full_page - Indicates full page checkout version + * @description Parameters for customer */ - layout?:Layout; + customer?:object; /** - * @description Sets the [context]() for this operation to the [business entity](/docs/api/advanced-features?prod_cat_ver=2#mbe) specified. Applicable only when multiple business entities have been created for the site. When this parameter is provided, the operation is able to read/write data associated only to the business entity specified. When not provided, the operation can read/write data for the entire site. -**Note** - -An alternative way of passing this parameter is by means of a [custom HTTP header](/docs/api/advanced-features?prod_cat_ver=2#mbe-header-main). -**See also** - -[Customer resource lookup and creation.](/docs/api/hosted_pages#customer_lookup2) + * @description Parameters for card */ - business_entity_id?:string; + card?:{gateway_account_id?:string}; /** - * @description The number of billing cycles the subscription runs before canceling. If not provided, then the billing cycles [set for the plan-item price](https://apidocs.chargebee.com/docs/api/item_prices?prod_cat_ver=2#item_price_billing_cycles) is used. + * @description Parameters for contract_term */ - billing_cycles?:number; + contract_term?:{action_at_term_end?:'cancel' | 'renew' | 'evergreen',cancellation_cutoff_period?:number}; /** - * @description Item ids of [mandatorily attached addons](./attached_items?prod_cat_ver=2) that are to be removed from the subscription. + * @description Parameters for subscription_items */ - mandatory_items_to_remove?:string[]; + subscription_items?:{billing_cycles?:number,charge_on_event?:ChargeOnEvent,charge_on_option?:ChargeOnOption,charge_once?:boolean,item_price_id:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,trial_end?:number,unit_price?:number,unit_price_in_decimal?:string}[]; /** - * @description The number of subscription billing cycles (including the first one) to [invoice in advance](https://www.chargebee.com/docs/advance-invoices.html). + * @description Parameters for discounts */ - terms_to_charge?:number; + discounts?:{amount?:number,apply_on:ApplyOn,duration_type:DurationType,id?:string,included_in_mrr?:boolean,item_price_id?:string,operation_type:OperationType,percentage?:number,period?:number,period_unit?:PeriodUnit}[]; /** - * @description Override the [billing alignment mode](https://www.chargebee.com/docs/calendar-billing.html#alignment-of-billing-date) for Calendar Billing. Only applicable when using Calendar Billing. The default value is that which has been configured for the site. \* immediate - Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly.. \* delayed - Subscription period will be aligned with the configured billing date at the next renewal. + * @description Parameters for item_tiers */ - billing_alignment_mode?:BillingAlignmentMode; + item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; /** - * @description List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](https://apidocs.chargebee.com/docs/api/coupon_codes). + * @description Parameters for entity_identifiers */ - coupon_ids?:string[]; + entity_identifiers?:{id?:string,operation?:Operation,scheme?:string,standard?:string,value?:string}[]; + } + export interface UpdatePaymentMethodResponse { + hosted_page:HostedPage; + } + export interface UpdatePaymentMethodInputParam { /** * @description The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. @@ -848,25 +850,20 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade pass_thru_content?:string; /** - * @description Allow the customer to select an offline payment method during checkout. The choice of payment methods can be configured via the Chargebee UI. + * @description If true then iframe will communicate with the parent window. Applicable only for embedded(iframe) hosted pages. If you're using iframe_messaging you need to implement onSuccess \& onCancel callbacks. - */ - - allow_offline_payment_methods?:boolean; - - /** - * @description Parameters for subscription +**Note** : This parameter is not applicable for [in-app](https://www.chargebee.com/docs/checkout-v3.html) checkout. */ - subscription?:object; + iframe_messaging?:boolean; /** * @description Parameters for customer */ - customer?:object; + customer?:{id:string}; /** * @description Parameters for card @@ -874,60 +871,70 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade */ card?:{gateway_account_id?:string}; + } + export interface ManagePaymentSourcesResponse { + hosted_page:HostedPage; + } + export interface ManagePaymentSourcesInputParam { /** - * @description Parameters for billing_address + * @description URL to redirect after payment method is added. */ - billing_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}; + redirect_url?:string; /** - * @description Parameters for shipping_address + * @description Parameters for customer */ - 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}; + customer?:{id:string}; /** - * @description Parameters for contract_term + * @description Parameters for card */ - contract_term?:{action_at_term_end?:'cancel' | 'renew' | 'evergreen',cancellation_cutoff_period?:number}; + card?:{gateway_account_id?:string}; + } + export interface CollectNowResponse { + hosted_page:HostedPage; + } + export interface CollectNowInputParam { /** - * @description Parameters for subscription_items + * @description Used to specify the destination URL to which a user is redirected after invoices are paid. The [transaction ID](/docs/api/transactions#transaction_id) of the transactions made through the Pay Now hosted page will be sent as return variables along with the URL. */ - subscription_items?:{billing_cycles?:number,charge_on_event?:ChargeOnEvent,charge_on_option?:ChargeOnOption,charge_once?:boolean,item_price_id:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,trial_end?:number,unit_price?:number,unit_price_in_decimal?:string}[]; + redirect_url?:string; /** - * @description Parameters for discounts + * @description The currency code (ISO 4217 format) of the specified *credit amount*. */ - discounts?:{amount?:number,apply_on:ApplyOn,duration_type:DurationType,included_in_mrr?:boolean,item_price_id?:string,percentage?:number,period?:number,period_unit?:PeriodUnit}[]; + currency_code?:string; /** - * @description Parameters for item_tiers + * @description Parameters for customer */ - item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; + customer?:{id:string}; /** - * @description Parameters for entity_identifiers + * @description Parameters for card */ - entity_identifiers?:{id?:string,operation?:Operation,scheme?:string,standard?:string,value?:string}[]; + card?:{gateway_account_id?:string}; } - export interface ClaimGiftResponse { + export interface AcceptQuoteResponse { hosted_page:HostedPage; } - export interface ClaimGiftInputParam { + export interface AcceptQuoteInputParam { /** * @description The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. @@ -944,92 +951,69 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade redirect_url?:string; /** - * @description Parameters for gift - - */ - - gift?:{id:string}; - - /** - * @description Parameters for customer + * @description Parameters for quote */ - customer?:{locale?:string}; + quote?:{id:string}; } - export interface CheckoutExistingForItemsResponse { + export interface ExtendSubscriptionResponse { hosted_page:HostedPage; } - export interface CheckoutExistingForItemsInputParam { + export interface ExtendSubscriptionInputParam { /** - * @description Specifies the checkout layout that overrides the default checkout layout configured in the Checkout \& Self-Serve Portal settings. . \* in_app - Indicates in-app checkout version \* full_page - Indicates full page checkout version + * @description Expiry (in days) for the link generated. No expiry will be set if this is not specified. */ - layout?:Layout; + expiry?:number; /** - * @description Item ids of [mandatorily attached addons](./attached_items?prod_cat_ver=2) that are to be removed from the subscription. + * @description Number of billing cycles to extend. If not specified, plan's billing cycle will be used. */ - mandatory_items_to_remove?:string[]; + billing_cycle?:number; /** - * @description If `true` then the existing `subscription_items` list for the subscription is replaced by the one provided. If `false` then the provided `subscription_items` list gets added to the existing list. + * @description Parameters for subscription */ - replace_items_list?:boolean; + subscription?:{id:string}; + } + export interface CheckoutGiftForItemsResponse { + hosted_page:HostedPage; + } + export interface CheckoutGiftForItemsInputParam { /** - * @description The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if `create_pending_invoices` is set to `true`, and if the site is configured to set invoice dates to date of closing, then upon invoice closure, this date is changed to the invoice closing date. taxes and line_item_taxes are computed based on the tax configuration as of `invoice_date`. When passing this parameter, the following prerequisites must be met: - -* `invoice_date` must be in the past. -* `invoice_date` is not more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December. -* It is not earlier than `changes_scheduled_at`, `reactivate_from`, or `trial_end`. -* `invoice_immediately` is `true`. -. + * @description Sets the [context]() for this operation to the [business entity](/docs/api/advanced-features?prod_cat_ver=2#mbe) specified. Applicable only when multiple business entities have been created for the site. When this parameter is provided, the operation is able to read/write data associated only to the business entity specified. When not provided, the operation can read/write data for the entire site. +**Note** - */ - - invoice_date?:number; - - /** - * @description Billing cycles set for plan-item price is used by default. +An alternative way of passing this parameter is by means of a [custom HTTP header](/docs/api/advanced-features?prod_cat_ver=2#mbe-header-main). +**See also** - */ - - billing_cycles?:number; - - /** - * @description The number of subscription billing cycles to [invoice in advance](https://www.chargebee.com/docs/advance-invoices.html). If a new term is started for the subscription due to this API call, then `terms_to_charge` is inclusive of this new term. See description for the `force_term_reset` parameter to learn more about when a subscription term is reset. +Gifter customer resource lookup and creation. */ - terms_to_charge?:number; + business_entity_id?:string; /** - * @description If the subscription `status` is `cancelled` and it is being reactivated via this operation, this is the date/time at which the subscription should be reactivated. -**Note:** It is recommended not to pass this parameter along with `changed_scheduled_at`. `reactivate_from` can be backdated (set to a value in the past). Use backdating when the subscription has been reactivated already but its billing has been delayed. Backdating is allowed only when the following prerequisites are met: + * @description The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. -* Backdating must be enabled for subscription reactivation operations. -* The current day of the month does not exceed the limit set in Chargebee for backdating subscription change. This limit is the day of the month by which the accounting for the previous month must be closed. -* The date is on or after the last date/time any of the product catalog items of the subscription were changed. -* The date is not more than duration X into the past where X is the billing period of the plan. For example, if the period of the plan in the subscription is 2 months and today is 14th April, `changes_scheduled_at` cannot be earlier than 14th February. -. +**Note** : - */ - - reactivate_from?:number; - - /** - * @description Override the [billing alignment mode](https://www.chargebee.com/docs/calendar-billing.html#alignment-of-billing-date) chosen for the site for calendar billing. Only applicable when using calendar billing. \* immediate - Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly.. \* delayed - Subscription period will be aligned with the configured billing date at the next renewal. +* Although the customer will be redirected to the `redirect_url` after successful checkout, we do not recommend relying on it for completing critical post-checkout actions. This is because redirection may not happen due to unforeseen reasons such as user closing the tab, or exiting the browser, and so on. If there is any synchronization that you are doing after the redirection, you will have to have a backup. Chargebee recommends listening to appropriate webhooks such as [`subscription_created`](https://apidocs.chargebee.com/docs/api/events#subscription_created) or [`invoice_generated`](https://apidocs.chargebee.com/docs/api/events#invoice_generated)to verify a successful checkout. +* Redirect URL configured in Settings \> Hosted Pages Settings would be overriden by this redirect URL. +* *Eg :* *http://yoursite.com?id=* *\<hosted_page_id\>\&state=succeeded* +* This parameter is not applicable for iframe messaging. */ - billing_alignment_mode?:BillingAlignmentMode; + redirect_url?:string; /** * @description List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](https://apidocs.chargebee.com/docs/api/coupon_codes). @@ -1039,19 +1023,23 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade coupon_ids?:string[]; /** - * @description Applicable only for `cancelled` subscriptions. When passed as `true`, the canceled subscription is activated; otherwise subscription changes are made without changing its `status`. If not passed, subscription will be activated only if `subscription_items` is passed. + * @description Parameters for gifter */ - reactivate?:boolean; + gifter?:{customer_id?:string,locale?:string}; /** - * @description Say the subscription has the renewal date as 28th of every month. When the plan-item price of the subscription is set to one that has the same billing period as the current plan-item price, the subscription change does not change the term. In other words, the subscription still renews on the 28th. Passing this parameter as `true` will have the subscription reset its term to the current date (provided `end_of_term` is false). -**Note**: When the new plan-item price has a billing period different from the current plan-item price of the subscription, the term is always reset, regardless of the value passed for this parameter. + * @description Parameters for subscription_items */ - force_term_reset?:boolean; + subscription_items?:{item_price_id?:string,quantity?:number,quantity_in_decimal?:string}[]; + } + export interface ClaimGiftResponse { + hosted_page:HostedPage; + } + export interface ClaimGiftInputParam { /** * @description The customers will be redirected to this URL upon successful checkout. The hosted page id and state will be passed as parameters to this URL. @@ -1068,87 +1056,97 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade redirect_url?:string; /** - * @description The customers will be redirected to this URL upon canceling checkout. The hosted page id and state will be passed as parameters to this URL. - -**Note** : - -* Cancel URL configured in Settings \> Hosted Pages Settings would be overriden by this cancel URL. - *Eg : http://yoursite.com?id=\<hosted_page_id\>\&state=cancelled* -* This parameter is not applicable for iframe messaging and [in-app](https://www.chargebee.com/docs/2.0/checkout.html) checkout. + * @description Parameters for gift */ - cancel_url?:string; + gift?:{id:string}; /** - * @description You can pass through any content specific to the hosted page request and get it back after user had submitted the hosted page. + * @description Parameters for customer */ - pass_thru_content?:string; + customer?:{locale?:string}; + } + export interface RetrieveAgreementPdfResponse { + hosted_page:HostedPage; + } + export interface RetrieveAgreementPdfInputParam { /** - * @description Allow the customer to select an offline payment method during checkout. The choice of payment methods can be configured via the Chargebee UI. + * @description Payment source to be used for this payment. */ - allow_offline_payment_methods?:boolean; - + payment_source_id:string; + } + export interface AcknowledgeResponse { + hosted_page:HostedPage; + } + + export interface RetrieveResponse { + hosted_page:HostedPage; + } + + export interface ListResponse { /** - * @description Parameters for subscription + * @description This API retrieves the list of hosted page resources. */ - subscription?:object; + list:{hosted_page:HostedPage}[]; /** - * @description Parameters for customer + * @description This API retrieves the list of hosted page resources. */ - customer?:object; - + next_offset?:string; + } + export interface ListInputParam { + [key : string]: any; /** - * @description Parameters for card + * @description This API retrieves the list of hosted page resources. */ - - card?:{gateway_account_id?:string}; + + limit?:number; /** - * @description Parameters for contract_term + * @description This API retrieves the list of hosted page resources. */ - - contract_term?:{action_at_term_end?:'cancel' | 'renew' | 'evergreen',cancellation_cutoff_period?:number}; + + offset?:string; /** - * @description Parameters for subscription_items + * @description This API retrieves the list of hosted page resources. */ - - subscription_items?:{billing_cycles?:number,charge_on_event?:ChargeOnEvent,charge_on_option?:ChargeOnOption,charge_once?:boolean,item_price_id:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,trial_end?:number,unit_price?:number,unit_price_in_decimal?:string}[]; + + id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Parameters for discounts + * @description This API retrieves the list of hosted page resources. */ - - discounts?:{amount?:number,apply_on:ApplyOn,duration_type:DurationType,id?:string,included_in_mrr?:boolean,item_price_id?:string,operation_type:OperationType,percentage?:number,period?:number,period_unit?:PeriodUnit}[]; + + type?:{in?:string,is?:'update_payment_method' | 'checkout_one_time' | 'manage_payment_sources' | 'checkout_new' | 'view_voucher' | 'collect_now' | 'checkout_existing' | 'extend_subscription' | 'pre_cancel',is_not?:'update_payment_method' | 'checkout_one_time' | 'manage_payment_sources' | 'checkout_new' | 'view_voucher' | 'collect_now' | 'checkout_existing' | 'extend_subscription' | 'pre_cancel',not_in?:string}; /** - * @description Parameters for item_tiers + * @description This API retrieves the list of hosted page resources. */ - - item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; + + state?:{in?:string,is?:'requested' | 'acknowledged' | 'created' | 'cancelled' | 'succeeded',is_not?:'requested' | 'acknowledged' | 'created' | 'cancelled' | 'succeeded',not_in?:string}; /** - * @description Parameters for entity_identifiers + * @description This API retrieves the list of hosted page resources. */ - - entity_identifiers?:{id?:string,operation?:Operation,scheme?:string,standard?:string,value?:string}[]; + + updated_at?:{after?:string,before?:string,between?:string,on?:string}; } export interface PreCancelResponse { hosted_page:HostedPage; @@ -1186,51 +1184,53 @@ Although only `pass_thru_content.custom` is sent to Chargebee Retentio subscription?:{id:string}; } - export interface AcknowledgeResponse { - hosted_page:HostedPage; - } - - export interface RetrieveAgreementPdfResponse { - hosted_page:HostedPage; + export interface EventsResponse { + success:boolean; } - export interface RetrieveAgreementPdfInputParam { + export interface EventsInputParam { /** - * @description Payment source to be used for this payment. + * @description The event that need to passed to a different system. \* cancellation_page_loaded - Indicates native cancellation flow provided by the merchant is loaded rather than the retention flow. */ - payment_source_id:string; - } - export interface RetrieveResponse { - hosted_page:HostedPage; - } - - export interface ManagePaymentSourcesResponse { - hosted_page:HostedPage; - } - export interface ManagePaymentSourcesInputParam { + event_name:EventName; /** - * @description URL to redirect after payment method is added. + * @description Timestamp indicating when this event had occurred. . */ - redirect_url?:string; + occurred_at?:number; /** - * @description Parameters for customer + * @description The meta data description of the event in key-value pair. The value is a JSON object with the following keys and their values. + +* `subscription_id`: A unique and immutable identifier for the subscription. +. */ - customer?:{id:string}; + event_data:object; + } + export interface ViewVoucherResponse { + hosted_page:HostedPage; + } + export interface ViewVoucherInputParam { /** - * @description Parameters for card + * @description Parameters for payment_voucher */ - card?:{gateway_account_id?:string}; + payment_voucher?:{id:string}; + + /** + * @description Parameters for customer + + */ + + customer?:{locale?:string}; } } diff --git a/types/resources/InAppSubscription.d.ts b/types/resources/InAppSubscription.d.ts index aae08ed..be1f4a5 100644 --- a/types/resources/InAppSubscription.d.ts +++ b/types/resources/InAppSubscription.d.ts @@ -40,23 +40,80 @@ declare module 'chargebee' { export namespace InAppSubscription { export class InAppSubscriptionResource { /** - * @description This API verifies the application id `{in_app_subscription_app_id}` and `receipt` then returns the subscription details associated with the purchase. + * @description Verifies an in-app purchase made by your customer and creates a subscription in Chargebee. +**Tip** -#### Path Parameter +The recommended approach is to call this endpoint from the client-side app directly. However, if you are using this API to replace an existing direct integration with Apple or Google, then you may choose to call this API from the server-side. +**Note:** -in_app_subscription_app_id -required, string +if App Store or Play Store products have not been imported to Chargebee and this API is invoked, Chargebee will automatically create plans that correspond to the store product IDs. However, if historical subscriptions are to be imported using the [import receipt](https://apidocs.chargebee.com/docs/api/in_app_subscriptions#import_receipt) API, importing products is mandatory. [Learn more](https://www.chargebee.com/docs/mobile_subscriptions.html). -The handle is created by Chargebee for your Apple App Store or Google Play Store app. It can be obtained from the Chargebee web app. +Apple App Store {#app_store} +---------------------------- + +This section provides details of the Process Purchase Command operation when performed for the Apple App Store. This API processes only the latest in-app transaction on the receipt. Sync historical subscriptions into Chargebee using [bulk import](https://www.chargebee.com/docs/2.0/mobile-app-store-product-iap.html#import-in-app-purchase-receipts) of In-App Purchase receipts. +**Important** + +* [Integrate Chargebee](https://www.chargebee.com/docs/mobile-app-store-connect.html#connnect-with-your-chargebee-site) with your Apple App Store account using your shared secret from Apple. +* It is strongly recommended to use this endpoint to notify Chargebee of **new** purchases only. +* For updates to existing subscriptions, we recommend that you configure Apple App Store to send server notifications to Chargebee. + +Chargebee validates the `receipt` with Apple App Store and does the following once validation succeeds: + +1. Look for [item_family.id](/docs/api/item_families?prod_cat_ver=2#item_family_id) that matches the value Apple-App-Store, and create such a product family if not found. +2. Look for [item.id](/docs/api/items?prod_cat_ver=2#item_id) that matches `product[id]` and if not found, create such a plan-item under the item family described in the previous step. +3. Look for [item_price.id](/docs/api/item_prices?prod_cat_ver=2#item_price_id) that matches the concatenation of `product[id]` and `product[currency_code]`, and if not found, create such an item price under the item described in the previous step. +4. Create/update a subscription: + * If the receipt is for a new purchase, a new subscription is created for the plan-item price described in the previous step. The subscription has the following details: + * `id` set to [original_transaction_id](https://developer.apple.com/documentation/appstorereceipts/original_transaction_id?language=objc) + * `start_date` set to [responseBody.Latest_receipt_info.purchase_date_ms](https://developer.apple.com/documentation/appstorereceipts/responsebody/latest_receipt_info?language=objc) + * `current_term_end` set to `responseBody.Latest_receipt_info.expires_date_ms` + * Instead, if the receipt belongs to an existing subscription in Chargebee, it is updated to reflect the current state of the subscription at Apple. +5. The payment is recorded against the subscription invoice. The associated transaction is updated with the following details: + * The [transaction.reference_number](/docs/api/transactions?prod_cat_ver=2#transaction_reference_number) is set to the [transaction_id](https://developer.apple.com/documentation/appstorereceipts/transaction_id?language=objc) of the payment. +* The [transaction.payment_method](/docs/api/transactions#transaction_payment_method) is set to `apple_pay`. + +Google Play Store {#app_store} +------------------------------ + +This section provides details of the Process Purchase Command operation when performed for the Google Play Store. This API processes only the latest in-app transaction using the purchase token. +**Important** + +* [Integrate Chargebee](https://www.chargebee.com/docs/2.0/mobile-playstore-connect.html#chargebee-configuration) with your Google Play Store account using the service account credentials JSON. +* It is strongly recommended to use this endpoint to notify Chargebee of **new** purchases only. +* For updates to existing subscriptions, we recommend that you configure Chargebee to receive Google's server notifications through pub/sub topic. [Learn more](https://developer.android.com/google/play/billing/getting-ready#setup-pubsub). + +Chargebee validates the purchase **token** with Google Play Store and does the following once validation succeeds: + +1. Look for [item_family.id](/docs/api/item_families?prod_cat_ver=2#item_family_id) that matches the value `Google-Play-Store`, and create such a product family if not found. +2. Look for [item.id](/docs/api/items?prod_cat_ver=2#item_id) that matches `product[id]` and if not found, create such a [plan-item](/docs/api/items?prod_cat_ver=2#item_type) under the item family described in the previous step. +3. Look for [item_price.id](/docs/api/item_prices?prod_cat_ver=2#item_price_id) that matches the concatenation of `product[id]` and [priceCurrencyCode](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions?hl=en#SubscriptionPurchase.FIELDS.price_currency_code), and if not found, create such an item price under the item described in the previous step. +4. Create/update a subscription: + * If this token is for a new purchase, a new subscription is created for the plan-item price described in the previous step. The subscription has the following details: + * `id` set to unique identifier generated by Chargebee and mapped to **token** of the [SubscriptionPurchase](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions?hl=en) object from Google response. + * `start_date` set to `SubscriptionPurchase.startTimeMillis`. + * `current_term_end` set to `SubscriptionPurchase.expiryTimeMillis`. + * Instead, if the token belongs to an existing subscription in Chargebee, it is updated to reflect the current state of the subscription at Google. +5. The payment is recorded against the subscription invoice. The associated transaction is updated with the following details: + * The [transaction.reference_number](/docs/api/transactions?prod_cat_ver=2#transaction_reference_number) is set to the [orderId](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions?hl=en#SubscriptionPurchase.FIELDS.order_id) of the payment. + * The [transaction.payment_method](/docs/api/transactions#transaction_payment_method) is set to `play_store`. + +Path Parameter {#path_param_pcv2} +--------------------------------- + +`{in_app_subscription_app_id}`: The handle created by Chargebee for your Apple App Store or Google Play Store app. It can be obtained from the Chargebee web app. The following are instructions to obtain the value of the path parameter for the Apple App Store and Google Play Store. * **Apple App Store** : To obtain the value for `{in_app_subscription_app_id}`, click **View Keys** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-app-store-product-iap.html#resource-id). * **Google Play Store** : To obtain the value for `{in_app_subscription_app_id}`, click **Set up notifications** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-playstore-notifications.html#app-id). + + + */ - retrieve_store_subs(in_app_subscription_app_id:string, input:RetrieveStoreSubsInputParam):ChargebeeRequest; + process_receipt(in_app_subscription_app_id:string, input:ProcessReceiptInputParam):ChargebeeRequest; /** * @description Verifies an Apple App Store or Google Play Store in-app purchase [receipt](https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language=objc#overview) and imports [subscriptions](/docs/api/subscriptions) for all historical purchases made by the customer. @@ -64,6 +121,7 @@ The following are instructions to obtain the value of the path parameter for the An `in_app_subscription` is created for every unique `original_transaction_id`. Apple creates `original_transaction_id` for every create, upgrade, or downgrade of the subscription. A receipt hardly contains more than 100 `original_transaction_id`s. If a receipt contains more than 100 `original_transaction_id`s, Chargebee creates all subscription records but this endpoint returns the first 100 records in the response. CSV upload has a file size [limitation](https://www.chargebee.com/docs/mobile-app-store-product-iap.html#upload-in-app-receipts) that increases the processing time and the number of receipts. This API removes such limitations and allows you to import historical in-app subscription receipts. +**Note** : This API verifies receipt or token through Apple or Google and then processes them via Chargebee. For bulk imports, limit API calls to **6** per minute (**10** seconds apart) to ensure successful subscription imports. Apple App Store {#app_store} ---------------------------- @@ -175,7 +233,10 @@ The following are instructions to obtain the value of the path parameter for the * @description The Import Subscriptions endpoint is a Chargebee API that allows you to import historic In-App Subscriptions without using a valid Apple App Store receipt. This endpoint is useful if you do not have access to the receipt data which is required for the [Import Receipt](https://apidocs.chargebee.com/docs/api/in_app_subscriptions#import_receipt) API. With this API, you can import subscriptions and corresponding invoices for historic In-App purchases. The API returns the [in-app-subscriptions object](https://apidocs.chargebee.com/docs/api/in_app_subscriptions#in_app_subscription_attributes) once the historic subscription is successfully imported into Chargebee. -**Note**: Subscription cannot be imported from Google Play Store without a receipt or token. Therefore; Chargebee does not allow you to use this API for Google Play Store. +**Note** : + +* Subscriptions cannot be imported from the Google Play Store without a receipt or token. Therefore; Chargebee does not allow you to use this API for the Google Play Store. +* Enable V1 notifications in the Apple App Store for subscriptions created without receipts. Chargebee depends on receipt data to update subscription statuses. Apple's V2 notifications do not have receipt information; therefore, Chargebee cannot process V2 notifications for subscriptions imported without receipts. Learn more about [++app store notifications++](https://apidocs.chargebee.com/docs/api/in_app_purchase_events?prod_cat_ver=2#app_store_notifications) and [++notification URL configuration++](https://www.chargebee.com/docs/mobile-app-store-product-iap.html#connection-keys_notification-url). ### Apple App Store @@ -239,85 +300,28 @@ To obtain the value of `in_app_subscription_app_id `for the Apple App import_subscription(in_app_subscription_app_id:string, input?:ImportSubscriptionInputParam):ChargebeeRequest; /** - * @description Verifies an in-app purchase made by your customer and creates a subscription in Chargebee. -**Tip** - -The recommended approach is to call this endpoint from the client-side app directly. However, if you are using this API to replace an existing direct integration with Apple or Google, then you may choose to call this API from the server-side. -**Note:** - -if App Store or Play Store products have not been imported to Chargebee and this API is invoked, Chargebee will automatically create plans that correspond to the store product IDs. However, if historical subscriptions are to be imported using the [import receipt](https://apidocs.chargebee.com/docs/api/in_app_subscriptions#import_receipt) API, importing products is mandatory. [Learn more](https://www.chargebee.com/docs/mobile_subscriptions.html). - -Apple App Store {#app_store} ----------------------------- - -This section provides details of the Process Purchase Command operation when performed for the Apple App Store. This API processes only the latest in-app transaction on the receipt. Sync historical subscriptions into Chargebee using [bulk import](https://www.chargebee.com/docs/2.0/mobile-app-store-product-iap.html#import-in-app-purchase-receipts) of In-App Purchase receipts. -**Important** - -* [Integrate Chargebee](https://www.chargebee.com/docs/mobile-app-store-connect.html#connnect-with-your-chargebee-site) with your Apple App Store account using your shared secret from Apple. -* It is strongly recommended to use this endpoint to notify Chargebee of **new** purchases only. -* For updates to existing subscriptions, we recommend that you configure Apple App Store to send server notifications to Chargebee. - -Chargebee validates the `receipt` with Apple App Store and does the following once validation succeeds: - -1. Look for [item_family.id](/docs/api/item_families?prod_cat_ver=2#item_family_id) that matches the value Apple-App-Store, and create such a product family if not found. -2. Look for [item.id](/docs/api/items?prod_cat_ver=2#item_id) that matches `product[id]` and if not found, create such a plan-item under the item family described in the previous step. -3. Look for [item_price.id](/docs/api/item_prices?prod_cat_ver=2#item_price_id) that matches the concatenation of `product[id]` and `product[currency_code]`, and if not found, create such an item price under the item described in the previous step. -4. Create/update a subscription: - * If the receipt is for a new purchase, a new subscription is created for the plan-item price described in the previous step. The subscription has the following details: - * `id` set to [original_transaction_id](https://developer.apple.com/documentation/appstorereceipts/original_transaction_id?language=objc) - * `start_date` set to [responseBody.Latest_receipt_info.purchase_date_ms](https://developer.apple.com/documentation/appstorereceipts/responsebody/latest_receipt_info?language=objc) - * `current_term_end` set to `responseBody.Latest_receipt_info.expires_date_ms` - * Instead, if the receipt belongs to an existing subscription in Chargebee, it is updated to reflect the current state of the subscription at Apple. -5. The payment is recorded against the subscription invoice. The associated transaction is updated with the following details: - * The [transaction.reference_number](/docs/api/transactions?prod_cat_ver=2#transaction_reference_number) is set to the [transaction_id](https://developer.apple.com/documentation/appstorereceipts/transaction_id?language=objc) of the payment. -* The [transaction.payment_method](/docs/api/transactions#transaction_payment_method) is set to `apple_pay`. - -Google Play Store {#app_store} ------------------------------- - -This section provides details of the Process Purchase Command operation when performed for the Google Play Store. This API processes only the latest in-app transaction using the purchase token. -**Important** - -* [Integrate Chargebee](https://www.chargebee.com/docs/2.0/mobile-playstore-connect.html#chargebee-configuration) with your Google Play Store account using the service account credentials JSON. -* It is strongly recommended to use this endpoint to notify Chargebee of **new** purchases only. -* For updates to existing subscriptions, we recommend that you configure Chargebee to receive Google's server notifications through pub/sub topic. [Learn more](https://developer.android.com/google/play/billing/getting-ready#setup-pubsub). - -Chargebee validates the purchase **token** with Google Play Store and does the following once validation succeeds: + * @description This API verifies the application id `{in_app_subscription_app_id}` and `receipt` then returns the subscription details associated with the purchase. -1. Look for [item_family.id](/docs/api/item_families?prod_cat_ver=2#item_family_id) that matches the value `Google-Play-Store`, and create such a product family if not found. -2. Look for [item.id](/docs/api/items?prod_cat_ver=2#item_id) that matches `product[id]` and if not found, create such a [plan-item](/docs/api/items?prod_cat_ver=2#item_type) under the item family described in the previous step. -3. Look for [item_price.id](/docs/api/item_prices?prod_cat_ver=2#item_price_id) that matches the concatenation of `product[id]` and [priceCurrencyCode](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions?hl=en#SubscriptionPurchase.FIELDS.price_currency_code), and if not found, create such an item price under the item described in the previous step. -4. Create/update a subscription: - * If this token is for a new purchase, a new subscription is created for the plan-item price described in the previous step. The subscription has the following details: - * `id` set to unique identifier generated by Chargebee and mapped to **token** of the [SubscriptionPurchase](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions?hl=en) object from Google response. - * `start_date` set to `SubscriptionPurchase.startTimeMillis`. - * `current_term_end` set to `SubscriptionPurchase.expiryTimeMillis`. - * Instead, if the token belongs to an existing subscription in Chargebee, it is updated to reflect the current state of the subscription at Google. -5. The payment is recorded against the subscription invoice. The associated transaction is updated with the following details: - * The [transaction.reference_number](/docs/api/transactions?prod_cat_ver=2#transaction_reference_number) is set to the [orderId](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions?hl=en#SubscriptionPurchase.FIELDS.order_id) of the payment. - * The [transaction.payment_method](/docs/api/transactions#transaction_payment_method) is set to `play_store`. +#### Path Parameter -Path Parameter {#path_param_pcv2} ---------------------------------- +in_app_subscription_app_id +required, string -`{in_app_subscription_app_id}`: The handle created by Chargebee for your Apple App Store or Google Play Store app. It can be obtained from the Chargebee web app. +The handle is created by Chargebee for your Apple App Store or Google Play Store app. It can be obtained from the Chargebee web app. The following are instructions to obtain the value of the path parameter for the Apple App Store and Google Play Store. * **Apple App Store** : To obtain the value for `{in_app_subscription_app_id}`, click **View Keys** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-app-store-product-iap.html#resource-id). * **Google Play Store** : To obtain the value for `{in_app_subscription_app_id}`, click **Set up notifications** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-playstore-notifications.html#app-id). - - - */ - process_receipt(in_app_subscription_app_id:string, input:ProcessReceiptInputParam):ChargebeeRequest; + retrieve_store_subs(in_app_subscription_app_id:string, input:RetrieveStoreSubsInputParam):ChargebeeRequest; } - export interface RetrieveStoreSubsResponse { - in_app_subscriptions:InAppSubscription[]; + export interface ProcessReceiptResponse { + in_app_subscription:InAppSubscription; } - export interface RetrieveStoreSubsInputParam { + export interface ProcessReceiptInputParam { /** * @description **Apple App Store** : The Base64 encoded [App Store in-app purchase receipt](https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language=objc#overview) taken from the Apple device after successful creation of the in-app purchase subscription. @@ -327,6 +331,20 @@ The following are instructions to obtain the value of the path parameter for the */ receipt:string; + + /** + * @description Parameters for product + + */ + + product?:{currency_code:string,id:string,name?:string,period?:string,period_unit?:string,price:number,price_in_decimal?:string}; + + /** + * @description Parameters for customer + + */ + + customer?:{email?:string,first_name?:string,id?:string,last_name?:string}; } export interface ImportReceiptResponse { in_app_subscriptions:InAppSubscription[]; @@ -375,10 +393,10 @@ The following are instructions to obtain the value of the path parameter for the customer?:{email?:string,id?:string}; } - export interface ProcessReceiptResponse { - in_app_subscription:InAppSubscription; + export interface RetrieveStoreSubsResponse { + in_app_subscriptions:InAppSubscription[]; } - export interface ProcessReceiptInputParam { + export interface RetrieveStoreSubsInputParam { /** * @description **Apple App Store** : The Base64 encoded [App Store in-app purchase receipt](https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language=objc#overview) taken from the Apple device after successful creation of the in-app purchase subscription. @@ -388,20 +406,6 @@ The following are instructions to obtain the value of the path parameter for the */ receipt:string; - - /** - * @description Parameters for product - - */ - - product?:{currency_code:string,id:string,name?:string,period?:string,period_unit?:string,price:number,price_in_decimal?:string}; - - /** - * @description Parameters for customer - - */ - - customer?:{email?:string,first_name?:string,id?:string,last_name?:string}; } } diff --git a/types/resources/Invoice.d.ts b/types/resources/Invoice.d.ts index eaa1c52..2fdaa9f 100644 --- a/types/resources/Invoice.d.ts +++ b/types/resources/Invoice.d.ts @@ -447,6 +447,8 @@ In-App Subscriptions is currently in early access. Contact [eap@chargebee.com](m shipping_address?:Invoice.ShippingAddress; + statement_descriptor?:Invoice.StatementDescriptor; + /** * @description Billing address for the invoice. @@ -471,34 +473,25 @@ In-App Subscriptions is currently in early access. Contact [eap@chargebee.com](m export namespace Invoice { export class InvoiceResource { /** - * @description This endpoint is used to delete line items from "Pending" invoice. - - */ - - delete_line_items(invoice_id:string, input?:DeleteLineItemsInputParam):ChargebeeRequest; - - /** - * @description This API removes a credit note attached to an invoice. When you remove a credit note from an invoice, the invoice status returns to `not_paid`. - -**Note:** You cannot remove a credit note from an invoice if it has already been refunded. + * @description Creates an invoice for [charge-items](./items?prod_cat_ver=2) and [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices must belong to items of `type` `charge`. */ - remove_credit_note(invoice_id:string, input?:RemoveCreditNoteInputParam):ChargebeeRequest; + create_for_charge_items_and_charges(input?:CreateForChargeItemsAndChargesInputParam):ChargebeeRequest; /** - * @description This API [removes payments](https://www.chargebee.com/docs/2.0/invoice-operations.html#actions-for-paid-invoices_remove-payment) applied to an invoice. Once the applied payment is removed, the invoice status returns to `not_paid` or `payment_due`. The removed payment is then added to the customer's excess payment balance. + * @description This API is used to stop dunning for "Payment Due" invoices that have been enabled for Auto Collection. When dunning is stopped, the status of the invoice will be changed to "Not Paid". */ - remove_payment(invoice_id:string, input?:RemovePaymentInputParam):ChargebeeRequest; + stop_dunning(invoice_id:string, input?:StopDunningInputParam):ChargebeeRequest; /** - * @description This API is used to stop dunning for "Payment Due" invoices that have been enabled for Auto Collection. When dunning is stopped, the status of the invoice will be changed to "Not Paid". + * @description Use this endpoint to import invoices that are created outside of Chargebee; for example, import invoices created with a commercial accounting software to Chargebee. This allows you to conveniently manage invoices in one place. */ - stop_dunning(invoice_id:string, input?:StopDunningInputParam):ChargebeeRequest; + import_invoice(input:ImportInvoiceInputParam):ChargebeeRequest; /** * @description The API applies [excess payments](https://apidocs.chargebee.com/docs/api/customers#customer_excess_payments) to an invoice. Once an excess payment is applied, the [invoice.amount_due](invoices#invoice_amount_due) is recalculated. The invoice `status` changes to either `paid` or `payment_due` depending on how much excess payment is applied to the invoice amount. @@ -510,137 +503,117 @@ For example, if you have an excess payment of $25.00, and the invoice to which y apply_payments(invoice_id:string, input?:ApplyPaymentsInputParam):ChargebeeRequest; /** - * @description Voids the specified invoice. Any payments must be [removed](/docs/api/invoices?prod_cat_ver=2#remove_payment_from_an_invoice) from the invoice before voiding it. - -* Any [promotional credits](/docs/api/promotional_credits?prod_cat_ver=2) or [credit notes](/docs/api/credit_notes?prod_cat_ver=2) applied to the invoice are removed. -* If an invoice for the current term of a subscription is voided and the subscription is changed later with `proration` enabled, no prorated credits are issued. -* Any [usages](/docs/api/usages?prod_cat_ver=2) associated with item prices in the invoice are delinked from the invoice. This is done by clearing the `invoice_id` field of said usages. However, before this is done, a [usage PDF](/docs/api/usages?prod_cat_ver=2#retrieve_usages_for_an_invoice_as_pdf) is generated and saved to the invoice as an [attachment](https://www.chargebee.com/docs/2.0/file-attachment.html). + * @description Updates the [`quantity`](/docs/api/invoices#invoice_line_items_quantity) for `metered` [`line_items`](/docs/api/invoices#invoice_line_items) of an invoice to reflect the latest [usage](https://apidocs.chargebee.com/docs/api/usages) data. - */ - - void_invoice(invoice_id:string, input?:VoidInvoiceInputParam):ChargebeeRequest; - - /** - * @description Adds a one-time charge to a [pending](https://apidocs.chargebee.com/docs/api/invoices#invoice_status) invoice. A one-time charge is a charge that is added ad hoc to the invoice and does not represent a predefined [item price](https:/apidocs.chargebee.com/docs/api/item_prices). It appears in the invoice as a [line_item](https://apidocs.chargebee.com/docs/api/invoices?prod_cat_ver=2&lang=curl#invoice_line_items) of [entity_type](https://apidocs.chargebee.com/docs/api/invoices?prod_cat_ver=2&lang=curl#invoice_line_items_entity_type) `adhoc`. +**Note:** This operation is done automatically while [closing](https://apidocs.chargebee.com/docs/api/invoices#close_a_pending_invoice) the invoice. */ - add_charge(invoice_id:string, input:AddChargeInputParam):ChargebeeRequest; + sync_usages(invoice_id:string):ChargebeeRequest; /** - * @description This endpoint is used to send an e-invoice for invoice. - -To support cases like TDS and invoice edits, we need to stop auto e-invoice sending and be able to send e-invoices manually. - -This endpoint schedules e-invoices manually. This operation is not allowed when any of the following condition matches: - -* If e-invoicing is not enabled at the site and customer level. - -* If there is an e-invoice generated already for the invoice. - -* If the "**Use automatic e-invoicing**" option is selected. - -* If there are no generated e-invoices with the `failed` or `skipped` status. - -* If the invoice status is `voided` or `pending`. - + * @description This endpoint is used to delete line items from "Pending" invoice. */ - send_einvoice(invoice_id:string):ChargebeeRequest; + delete_line_items(invoice_id:string, input?:DeleteLineItemsInputParam):ChargebeeRequest; /** - * @description This API writes off an Invoice. + * @description This API applies [available credits](customers#customer_balances) to an invoice. After credits are applied, [invoice.amount_due](invoices#invoice_amount_due) is recalculated. The invoice status changes to either `paid` or `payment_due` depending on how much credit is applied to the invoice amount. */ - write_off(invoice_id:string, input?:WriteOffInputParam):ChargebeeRequest; + apply_credits(invoice_id:string, input?:ApplyCreditsInputParam):ChargebeeRequest; /** - * @description This endpoint is used when [metered billing](https://www.chargebee.com/docs/2.0/metered_billing.html) is enabled and it adds a [charge-item price](./item_prices?prod_cat_ver=2) to a `pending` invoice. To collect the accumulated charges by closing the invoice, call [Close a pending invoice](./invoices?prod_cat_ver=2#close_a_pending_invoice). + * @description Lists all the Invoices. */ - add_charge_item(invoice_id:string, input?:AddChargeItemInputParam):ChargebeeRequest; + list(input?:ListInputParam):ChargebeeRequest; /** - * @description Lists all the Invoices. + * @description Retrieve the invoice for the specified invoice id. */ - list(input?:ListInputParam):ChargebeeRequest; + retrieve(invoice_id:string):ChargebeeRequest; /** - * @description Invoices for a subscription are created with a `pending` `status` when the subscription has `create_pending_invoices` attribute set to `true`. This API call finalizes a `pending` invoice. Any `refundable_credits` and `excess_payments` for the customer are applied to the invoice, and any payment due is collected automatically if `auto_collection` is `on` for the customer. + * @description Gets the invoice as PDF. The returned URL is secure and allows download. The URL will expire in 60 minutes. -#### Automation +#### Related Tutorial -This operation can be automated by using a [site setting](https://www.chargebee.com/docs/2.0/metered_billing.html#configuring-metered-billing). Moreover, the automation can be overridden at the [customer](/docs/api/customers?prod_cat_ver=2#customer_auto_close_invoices) and [subscription](/docs/api/subscriptions?prod_cat_ver=2#subscription_auto_close_invoices) level. +* [Check out customer portal tutorial on how to download invoice as PDF.](//www.chargebee.com/tutorials/customer-portal-sample.html#downloading_invoices_as_pdf) */ - close(invoice_id:string, input?:CloseInputParam):ChargebeeRequest; + pdf(invoice_id:string, input?:PdfInputParam):ChargebeeRequest; /** - * @description This API applies [available credits](customers#customer_balances) to an invoice. After credits are applied, [invoice.amount_due](invoices#invoice_amount_due) is recalculated. The invoice status changes to either `paid` or `payment_due` depending on how much credit is applied to the invoice amount. + * @description Download the e-invoice in both XML and PDF formats. The response consists of a `download` object for each format. The XML format follows the [structure as per Peppol BIS Billing v3.0](https://docs.peppol.eu/poacc/billing/3.0/syntax/ubl-invoice/tree/). +**Note** + +* You can only download e-invoices when their `status` is `success`. +* There are some cases in which the PDF is not available for download. In such cases, you can obtain it from the XML by decoding the value for [cbc:EmbeddedDocumentBinaryObject](https://docs.peppol.eu/poacc/billing/3.0/syntax/ubl-invoice/cac-AdditionalDocumentReference/cac-Attachment/cbc-EmbeddedDocumentBinaryObject/), which is the Base64-encoded version of the PDF. */ - apply_credits(invoice_id:string, input?:ApplyCreditsInputParam):ChargebeeRequest; + download_einvoice(invoice_id:string):ChargebeeRequest; /** - * @description Retrieve the invoice for the specified invoice id. + * @description This API endpoint allows users to retrieve the payment reference numbers (PRNs) associated with an invoice. Only one PRN is allowed per payment type. You can use the `invoice_id` or the `payment_reference_number[number]` to retrieve the PRN. */ - retrieve(invoice_id:string):ChargebeeRequest; + list_payment_reference_numbers(input?:ListPaymentReferenceNumbersInputParam):ChargebeeRequest; /** - * @description Creates an invoice for [charge-items](./items?prod_cat_ver=2) and [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices must belong to items of `type` `charge`. + * @description Adds a one-time charge to a [pending](https://apidocs.chargebee.com/docs/api/invoices#invoice_status) invoice. A one-time charge is a charge that is added ad hoc to the invoice and does not represent a predefined [item price](https:/apidocs.chargebee.com/docs/api/item_prices). It appears in the invoice as a [line_item](https://apidocs.chargebee.com/docs/api/invoices?prod_cat_ver=2&lang=curl#invoice_line_items) of [entity_type](https://apidocs.chargebee.com/docs/api/invoices?prod_cat_ver=2&lang=curl#invoice_line_items_entity_type) `adhoc`. */ - create_for_charge_items_and_charges(input?:CreateForChargeItemsAndChargesInputParam):ChargebeeRequest; + add_charge(invoice_id:string, input:AddChargeInputParam):ChargebeeRequest; /** - * @description This API allows you to update the invoice Billing/Shipping address, VAT and PO number. During this operation if Billing Info (Billing Address, vat_number), Shipping info and PO number are not already present in the system the data will be added. If data is already present, the existing values will be replaced. If info is present in the system, but not passed as part of the request, the info will not be removed from the system. - -**Note:** Incase, tax is already applied will now vary due to address change, you cannot update the address. You cannot update the VAT Number if the billing address is not present in the API request.This will update the invoice only, it won't change the corresponding customer/subscription details. + * @description This endpoint is used when [metered billing](https://www.chargebee.com/docs/2.0/metered_billing.html) is enabled and it adds a [charge-item price](./item_prices?prod_cat_ver=2) to a `pending` invoice. To collect the accumulated charges by closing the invoice, call [Close a pending invoice](./invoices?prod_cat_ver=2#close_a_pending_invoice). */ - update_details(invoice_id:string, input?:UpdateDetailsInputParam):ChargebeeRequest; + add_charge_item(invoice_id:string, input?:AddChargeItemInputParam):ChargebeeRequest; /** - * @description To record a [offline payment](https://www.chargebee.com/docs/offline_payments.html) for an invoice. + * @description Invoices for a subscription are created with a `pending` `status` when the subscription has `create_pending_invoices` attribute set to `true`. This API call finalizes a `pending` invoice. Any `refundable_credits` and `excess_payments` for the customer are applied to the invoice, and any payment due is collected automatically if `auto_collection` is `on` for the customer. -The invoice status will be marked as 'paid' if its amount due becomes 0 because of this recorded payment. +#### Automation -**Note:** If the payment transaction amount is more than the invoice due amount, the remaining transaction amount will be added to the customer's Excess Payments balance to be used against other invoices. +This operation can be automated by using a [site setting](https://www.chargebee.com/docs/2.0/metered_billing.html#configuring-metered-billing). Moreover, the automation can be overridden at the [customer](/docs/api/customers?prod_cat_ver=2#customer_auto_close_invoices) and [subscription](/docs/api/subscriptions?prod_cat_ver=2#subscription_auto_close_invoices) level. */ - record_payment(invoice_id:string, input?:RecordPaymentInputParam):ChargebeeRequest; + close(invoice_id:string, input?:CloseInputParam):ChargebeeRequest; /** - * @description Deletes the specified invoice. Any payments must be [removed](/docs/api/invoices?prod_cat_ver=2#remove_payment_from_an_invoice) from the invoice before deleting it. -**Caution** + * @description Storing card after successful 3DS completion is not supported in this API. Use [create using Payment Intent API](/docs/api/payment_sources#create_using_payment_intent) under Payment source to store the card after successful 3DS flow completion. -All associated [usages](/docs/api/usages?prod_cat_ver=2) are permanently deleted on deleting an invoice. If you want to regenerate such an invoice, [add](/docs/api/usages?prod_cat_ver=2#create_a_usage) or [bulk import](https://www.chargebee.com/docs/2.0/bulk-operations.html#overview_available-bulk-operations) usages before invoice regeneration. +This API is used to collect payments for `payment_due` and `not_paid` invoices. If no payment methods are present for the customer or if the payment is unsuccessful, the corresponding error will be thrown. -* Any [promotional credits](/docs/api/promotional_credits?prod_cat_ver=2) or [credit notes](/docs/api/credit_notes?prod_cat_ver=2) applied to the invoice are removed. -* If an invoice for the current term of a subscription is deleted and the subscription is changed later with `proration` enabled, no prorated credits are issued. +Pass `authorization_transaction_id` to capture the already blocked funds to collect payments. Note that if the invoice due amount is greater than the authorized amount, the invoice status is returned as `payment_due`. */ - delete(invoice_id:string, input?:DeleteInputParam):ChargebeeRequest; + collect_payment(invoice_id:string, input?:CollectPaymentInputParam):ChargebeeRequest; /** - * @description Use this endpoint to import invoices that are created outside of Chargebee; for example, import invoices created with a commercial accounting software to Chargebee. This allows you to conveniently manage invoices in one place. + * @description To record a [offline payment](https://www.chargebee.com/docs/offline_payments.html) for an invoice. + +The invoice status will be marked as 'paid' if its amount due becomes 0 because of this recorded payment. + +**Note:** If the payment transaction amount is more than the invoice due amount, the remaining transaction amount will be added to the customer's Excess Payments balance to be used against other invoices. */ - import_invoice(input:ImportInvoiceInputParam):ChargebeeRequest; + record_payment(invoice_id:string, input?:RecordPaymentInputParam):ChargebeeRequest; /** * @description Records [tax_withheld](/docs/api/tax_withheld) by the customer against the invoice specified. This operation is allowed only when all of the following conditions are true: @@ -654,13 +627,6 @@ All associated [usages](/docs/api/usages?prod_cat_ver=2) are permanently de record_tax_withheld(invoice_id:string, input?:RecordTaxWithheldInputParam):ChargebeeRequest; - /** - * @description Resend failed einvoice of an invoice to the customer using this API. - - */ - - resend_einvoice(invoice_id:string):ChargebeeRequest; - /** * @description Removes a [linked_taxes_withheld](/docs/api/invoices#invoice_linked_taxes_withheld) record from the `invoice` specified. This operation is allowed only when all of the following conditions are true: @@ -672,33 +638,6 @@ All associated [usages](/docs/api/usages?prod_cat_ver=2) are permanently de remove_tax_withheld(invoice_id:string, input?:RemoveTaxWithheldInputParam):ChargebeeRequest; - /** - * @description This API endpoint allows users to retrieve the payment reference numbers (PRNs) associated with an invoice. Only one PRN is allowed per payment type. You can use the `invoice_id` or the `payment_reference_number[number]` to retrieve the PRN. - - */ - - list_payment_reference_numbers(input?:ListPaymentReferenceNumbersInputParam):ChargebeeRequest; - - /** - * @description Storing card after successful 3DS completion is not supported in this API. Use [create using Payment Intent API](/docs/api/payment_sources#create_using_payment_intent) under Payment source to store the card after successful 3DS flow completion. - -This API is used to collect payments for `payment_due` and `not_paid` invoices. If no payment methods are present for the customer or if the payment is unsuccessful, the corresponding error will be thrown. - -Pass `authorization_transaction_id` to capture the already blocked funds to collect payments. Note that if the invoice due amount is greater than the authorized amount, the invoice status is returned as `payment_due`. - - */ - - collect_payment(invoice_id:string, input?:CollectPaymentInputParam):ChargebeeRequest; - - /** - * @description Updates the [`quantity`](/docs/api/invoices#invoice_line_items_quantity) for `metered` [`line_items`](/docs/api/invoices#invoice_line_items) of an invoice to reflect the latest [usage](https://apidocs.chargebee.com/docs/api/usages) data. - -**Note:** This operation is done automatically while [closing](https://apidocs.chargebee.com/docs/api/invoices#close_a_pending_invoice) the invoice. - - */ - - sync_usages(invoice_id:string):ChargebeeRequest; - /** * @description Refunds the invoice. The [refund](https://www.chargebee.com/docs/refunds.html) request is processed via the payment gateway originally used to charge the customer. You can choose to either make a full refund for the entire amount or make many partial refunds until you reach the total amount charged for the invoice. The API returns an error if an attempt is made to: @@ -742,1111 +681,1078 @@ If the order of precendence described above does not work for your use case, and record_refund(invoice_id:string, input?:RecordRefundInputParam):ChargebeeRequest; /** - * @description Gets the invoice as PDF. The returned URL is secure and allows download. The URL will expire in 60 minutes. - -#### Related Tutorial - -* [Check out customer portal tutorial on how to download invoice as PDF.](//www.chargebee.com/tutorials/customer-portal-sample.html#downloading_invoices_as_pdf) + * @description This API [removes payments](https://www.chargebee.com/docs/2.0/invoice-operations.html#actions-for-paid-invoices_remove-payment) applied to an invoice. Once the applied payment is removed, the invoice status returns to `not_paid` or `payment_due`. The removed payment is then added to the customer's excess payment balance. */ - pdf(invoice_id:string, input?:PdfInputParam):ChargebeeRequest; + remove_payment(invoice_id:string, input?:RemovePaymentInputParam):ChargebeeRequest; /** - * @description Download the e-invoice in both XML and PDF formats. The response consists of a `download` object for each format. The XML format follows the [structure as per Peppol BIS Billing v3.0](https://docs.peppol.eu/poacc/billing/3.0/syntax/ubl-invoice/tree/). -**Note** + * @description This API removes a credit note attached to an invoice. When you remove a credit note from an invoice, the invoice status returns to `not_paid`. -* You can only download e-invoices when their `status` is `success`. -* There are some cases in which the PDF is not available for download. In such cases, you can obtain it from the XML by decoding the value for [cbc:EmbeddedDocumentBinaryObject](https://docs.peppol.eu/poacc/billing/3.0/syntax/ubl-invoice/cac-AdditionalDocumentReference/cac-Attachment/cbc-EmbeddedDocumentBinaryObject/), which is the Base64-encoded version of the PDF. +**Note:** You cannot remove a credit note from an invoice if it has already been refunded. */ - download_einvoice(invoice_id:string):ChargebeeRequest; - } - export interface DeleteLineItemsResponse { - invoice:Invoice; - } - export interface DeleteLineItemsInputParam { + remove_credit_note(invoice_id:string, input?:RemoveCreditNoteInputParam):ChargebeeRequest; /** - * @description The list of line items which have to be deleted. + * @description Voids the specified invoice. Any payments must be [removed](/docs/api/invoices?prod_cat_ver=2#remove_payment_from_an_invoice) from the invoice before voiding it. + +* Any [promotional credits](/docs/api/promotional_credits?prod_cat_ver=2) or [credit notes](/docs/api/credit_notes?prod_cat_ver=2) applied to the invoice are removed. +* If an invoice for the current term of a subscription is voided and the subscription is changed later with `proration` enabled, no prorated credits are issued. +* Any [usages](/docs/api/usages?prod_cat_ver=2) associated with item prices in the invoice are delinked from the invoice. This is done by clearing the `invoice_id` field of said usages. However, before this is done, a [usage PDF](/docs/api/usages?prod_cat_ver=2#retrieve_usages_for_an_invoice_as_pdf) is generated and saved to the invoice as an [attachment](https://www.chargebee.com/docs/2.0/file-attachment.html). */ - - line_items?:{id?:string}[]; - } - export interface RemoveCreditNoteResponse { - invoice:Invoice; - - credit_note:CreditNote; - } - export interface RemoveCreditNoteInputParam { + + void_invoice(invoice_id:string, input?:VoidInvoiceInputParam):ChargebeeRequest; /** - * @description Parameters for credit_note + * @description This API writes off an Invoice. */ - - credit_note?:{id:string}; - } - export interface RemovePaymentResponse { - invoice:Invoice; - - transaction:Transaction; - } - export interface RemovePaymentInputParam { + + write_off(invoice_id:string, input?:WriteOffInputParam):ChargebeeRequest; /** - * @description Parameters for transaction + * @description Deletes the specified invoice. Any payments must be [removed](/docs/api/invoices?prod_cat_ver=2#remove_payment_from_an_invoice) from the invoice before deleting it. +**Caution** + +All associated [usages](/docs/api/usages?prod_cat_ver=2) are permanently deleted on deleting an invoice. If you want to regenerate such an invoice, [add](/docs/api/usages?prod_cat_ver=2#create_a_usage) or [bulk import](https://www.chargebee.com/docs/2.0/bulk-operations.html#overview_available-bulk-operations) usages before invoice regeneration. + +* Any [promotional credits](/docs/api/promotional_credits?prod_cat_ver=2) or [credit notes](/docs/api/credit_notes?prod_cat_ver=2) applied to the invoice are removed. +* If an invoice for the current term of a subscription is deleted and the subscription is changed later with `proration` enabled, no prorated credits are issued. */ - - transaction?:{id:string}; - } - export interface StopDunningResponse { - invoice:Invoice; - } - export interface StopDunningInputParam { + + delete(invoice_id:string, input?:DeleteInputParam):ChargebeeRequest; /** - * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). + * @description This API allows you to update the invoice Billing/Shipping address, VAT and PO number. During this operation if Billing Info (Billing Address, vat_number), Shipping info and PO number are not already present in the system the data will be added. If data is already present, the existing values will be replaced. If info is present in the system, but not passed as part of the request, the info will not be removed from the system. + +**Note:** Incase, tax is already applied will now vary due to address change, you cannot update the address. You cannot update the VAT Number if the billing address is not present in the API request.This will update the invoice only, it won't change the corresponding customer/subscription details. */ - - comment?:string; - } - export interface ApplyPaymentsResponse { - invoice:Invoice; - } - export interface ApplyPaymentsInputParam { + + update_details(invoice_id:string, input?:UpdateDetailsInputParam):ChargebeeRequest; /** - * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). + * @description Resend failed einvoice of an invoice to the customer using this API. */ - - comment?:string; + + resend_einvoice(invoice_id:string):ChargebeeRequest; /** - * @description Parameters for transactions + * @description This endpoint is used to send an e-invoice for invoice. - */ - - transactions?:{id?:string}[]; - } - export interface VoidInvoiceResponse { - invoice:Invoice; - - credit_note?:CreditNote; - } - export interface VoidInvoiceInputParam { - - /** - * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). +To support cases like TDS and invoice edits, we need to stop auto e-invoice sending and be able to send e-invoices manually. + +This endpoint schedules e-invoices manually. This operation is not allowed when any of the following condition matches: + +* If e-invoicing is not enabled at the site and customer level. + +* If there is an e-invoice generated already for the invoice. + +* If the "**Use automatic e-invoicing**" option is selected. + +* If there are no generated e-invoices with the `failed` or `skipped` status. + +* If the invoice status is `voided` or `pending`. - */ - - comment?:string; - - /** - * @description Reason code for voiding the invoice. Select from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Invoices \> Void invoice**. Must be passed if set as mandatory in the app. The codes are case-sensitive. */ - - void_reason_code?:string; + + send_einvoice(invoice_id:string):ChargebeeRequest; } - export interface AddChargeResponse { + export interface CreateForChargeItemsAndChargesResponse { invoice:Invoice; } - export interface AddChargeInputParam { + export interface CreateForChargeItemsAndChargesInputParam { /** - * @description The amount to be charged. The unit depends on the [type of currency](/docs/api#md_disabled). + * @description Unique ID of the customer this invoice should be created for. Either this or `subscription_id` must be provided. +**Note** + +The invoice is [linked](/docs/api?prod_cat_ver=2#mbe-linked-be) to the same [business entity](/docs/api?prod_cat_ver=2#mbe) as this customer. +. */ - amount:number; + customer_id?:string; /** - * @description Detailed description about this lineitem. + * @description Unique ID of the subscription this invoice should be created for. Either this or `customer_id` must be provided. +**Note** + +The invoice is [linked](/docs/api?prod_cat_ver=2#mbe-linked-be) to the same [business entity](/docs/api?prod_cat_ver=2#mbe) as this subscription. +. */ - description:string; + subscription_id?:string; /** - * @description Indicates the type of sale carried out. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. \* retail - Transaction is a sale to an end user \* wholesale - Transaction is a sale to another company that will resell your product or service to another consumer \* vendor_use - Transaction is for an item that is subject to vendor use tax \* consumed - Transaction is for an item that is consumed directly + * @description The currency code (ISO 4217 format) of the invoice amount. */ - avalara_sale_type?:AvalaraSaleType; + currency_code?:string; /** - * @description Indicates the type of product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. + * @description A note for this particular invoice. This, and [all other notes](/docs/api/invoices#invoice_notes) for the invoice are displayed on the PDF invoice sent to the customer. */ - avalara_transaction_type?:number; + invoice_note?:string; /** - * @description Indicates the type of service for the product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. + * @description Set as `true` to remove the **[general note](https://www.chargebee.com/docs/invoice_notes.html#adding-general-notes)** from this invoice. */ - avalara_service_type?:number; + remove_general_note?:boolean; /** - * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). + * @description Purchase Order Number for this invoice. */ - comment?:string; + po_number?:string; /** - * @description Identifier of the subscription for which this charge needs to be created. Applicable for consolidated invoice. + * @description List of Coupons to be added. */ - subscription_id?:string; + coupon_ids?:string[]; /** - * @description Parameters for line_item + * @description Authorization transaction to be captured. */ - line_item?:{date_from?:number,date_to?:number}; - } - export interface SendEinvoiceResponse { - invoice:Invoice; - } - - export interface WriteOffResponse { - invoice:Invoice; - - credit_note:CreditNote; - } - export interface WriteOffInputParam { + authorization_transaction_id?:string; /** - * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). + * @description Payment source to be used for this payment. */ - comment?:string; - } - export interface AddChargeItemResponse { - invoice:Invoice; - } - export interface AddChargeItemInputParam { + payment_source_id?:string; /** - * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). + * @description The customer level auto collection will be override if specified. \* on - Whenever an invoice is created, an automatic attempt will be made to charge. \* off - Whenever an invoice is created as payment due. */ - comment?:string; + auto_collection?:AutoCollection; /** - * @description Identifier of the subscription for which this addon needs to be created. Applicable for consolidated invoice. + * @description The document date displayed on the invoice PDF. By default, it is the date of creation of the invoice or, when Metered Billing is enabled, it can be the date of closing the invoice. Provide this value to backdate the invoice (set the invoice date to a value in the past). Backdating an invoice is done for reasons such as booking revenue for a previous date or when the non-recurring charge is effective as of a past date. `taxes` and `line_item_taxes` are computed based on the tax configuration as of this date. The date should not be more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December. */ - subscription_id?:string; + invoice_date?:number; /** - * @description Parameters for item_price + * @description Token generated by Chargebee JS representing payment method details. */ - item_price?:{date_from?:number,date_to?:number,item_price_id:string,quantity?:number,quantity_in_decimal?:string,unit_price?:number,unit_price_in_decimal?:string}; + token_id?:string; /** - * @description Parameters for item_tiers + * @description Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False. */ - item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; - } - export interface ListResponse { + replace_primary_payment_source?:boolean; + /** - * @description Lists all the Invoices. + * @description Indicates whether the payment source should be retained for the customer. */ - list:{invoice:Invoice}[]; + retain_payment_source?:boolean; /** - * @description Lists all the Invoices. + * @description Parameters for shipping_address */ - next_offset?:string; - } - export interface ListInputParam { - [key : string]: any; + 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}; + /** - * @description The number of resources to be returned. + * @description Creates an invoice for [charge-items](./items?prod_cat_ver=2) and [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). The item prices must belong to items of `type` `charge`. */ - - limit?:number; + + statement_descriptor?:{additional_info?:string,descriptor?:string}; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Parameters for card */ - - offset?:string; + + card?:{additional_information?:object,billing_addr1?:string,billing_addr2?:string,billing_city?:string,billing_country?:string,billing_state?:string,billing_state_code?:string,billing_zip?:string,cvv?:string,expiry_month?:number,expiry_year?:number,first_name?:string,gateway_account_id?:string,last_name?:string,number?:string}; /** - * @description Indicates whether to include deleted objects in the list. The deleted objects have the attribute \`deleted\` as \`true\`. + * @description Parameters for bank_account */ - - include_deleted?:boolean; + + bank_account?:{account_holder_type?:AccountHolderType,account_number?:string,account_type?:AccountType,bank_code?:string,bank_name?:string,billing_address?:object,company?:string,echeck_type?:EcheckType,email?:string,first_name?:string,gateway_account_id?:string,iban?:string,issuing_country?:string,last_name?:string,phone?:string,routing_number?:string,swedish_identity_number?:string}; /** - * @description The invoice number. Acts as a identifier for invoice and typically generated sequentially. + * @description Parameters for payment_method */ - - id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + + payment_method?:{additional_information?:object,gateway_account_id?:string,issuing_country?:string,reference_id?:string,tmp_token?:string,type?:Type}; /** - * @description To filter based on subscription_id. -NOTE: Not to be used if *consolidated invoicing* is enabled. + * @description Parameters for payment_intent */ - - subscription_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string}; + + payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'faster_payments' | 'sofort' | 'upi' | 'venmo' | 'amazon_payments' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'pay_to' | 'card',reference_id?:string}; /** - * @description The identifier of the customer this invoice belongs to. + * @description Parameters for item_prices */ - - customer_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + + item_prices?:{date_from?:number,date_to?:number,item_price_id?:string,quantity?:number,quantity_in_decimal?:string,unit_price?:number,unit_price_in_decimal?:string}[]; /** - * @description Boolean indicating whether this invoice belongs to a subscription + * @description Parameters for item_tiers */ - - recurring?:{is?:'true' | 'false'}; + + item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; /** - * @description Current status of this invoice. + * @description Parameters for charges */ - - status?:{in?:string,is?:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due',is_not?:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due',not_in?:string}; + + charges?:{amount?:number,amount_in_decimal?:string,avalara_sale_type?:AvalaraSaleType,avalara_service_type?:number,avalara_tax_code?:string,avalara_transaction_type?:number,date_from?:number,date_to?:number,description?:string,hsn_code?:string,tax_profile_id?:string,taxable?:boolean,taxjar_product_code?:string}[]; /** - * @description The price type of the invoice. + * @description Parameters for notes_to_remove */ - - price_type?:{in?:string,is?:'tax_exclusive' | 'tax_inclusive',is_not?:'tax_exclusive' | 'tax_inclusive',not_in?:string}; + + notes_to_remove?:{entity_id?:string,entity_type?:EntityType}[]; /** - * @description The document date displayed on the invoice PDF. + * @description Parameters for discounts */ - - date?:{after?:string,before?:string,between?:string,on?:string}; + + discounts?:{amount?:number,apply_on:ApplyOn,item_price_id?:string,percentage?:number}[]; + } + export interface StopDunningResponse { + invoice:Invoice; + } + export interface StopDunningInputParam { /** - * @description Timestamp indicating the date \& time this invoice got paid. + * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). */ - - paid_at?:{after?:string,before?:string,between?:string,on?:string}; + + comment?:string; + } + export interface ImportInvoiceResponse { + invoice:Invoice; + + credit_note?:CreditNote; + } + export interface ImportInvoiceInputParam { /** - * @description Invoiced amount displayed in cents; that is, a decimal point is not present between the whole number and the decimal part. For example, $499.99 is displayed as 49999, and so on. + * @description Invoice Number. */ - - total?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; + + id:string; /** - * @description Payments collected successfully for the invoice. This is the sum of [linked_payments[]](invoices#invoice_linked_payments)`.txn_amount` for all `linked_payments[]` that have `txn_status` as `success`. + * @description The currency code (ISO 4217 format) for the invoice. */ - - amount_paid?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; + + currency_code?:string; /** - * @description Total adjustments made against this invoice. + * @description Identifier of the customer for which this invoice needs to be created. */ - - amount_adjusted?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; + + customer_id?:string; /** - * @description Total credits applied against this invoice. + * @description If recurring items are present in line items then subscription id is required. */ - - credits_applied?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; + + subscription_id?:string; /** - * @description The unpaid amount that is due on the invoice. This is calculated as: [total](invoices#invoice_total) - [amount_paid](invoices#invoice_amount_paid) - sum of [applied_credits](invoices#invoice_applied_credits)`.applied_amount` - sum of [adjustment_credit_notes](invoices#invoice_adjustment_credit_notes)`.cn_total` - sum of [linked_taxes_withheld](invoices#invoice_linked_taxes_withheld)`.amount`. + * @description Purchase Order Number for this invoice. */ - - amount_due?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; + + po_number?:string; /** - * @description Current dunning status of the invoice. + * @description The price type of the invoice. \* tax_inclusive - All amounts in the document are inclusive of tax. \* tax_exclusive - All amounts in the document are exclusive of tax. */ - - dunning_status?:{in?:string,is?:'in_progress' | 'stopped' | 'success' | 'exhausted',is_not?:'in_progress' | 'stopped' | 'success' | 'exhausted',is_present?:'true' | 'false',not_in?:string}; + + price_type?:PriceType; /** - * @description Payment owner of an invoice + * @description The reason for exempting the invoice from tax. (Applicable only for exempted invoices.). \* export - The customer is from a non-taxable region or the billing address and shipping address are unavailable. \* customer_exempt - The customer is [exempted](customers#customer_taxability) from tax. \* id_exempt - The customer is from a different country than your business and they have a valid VAT number or, the customer is a business entity. (This reason is only applicable when [EU VAT](https://www.chargebee.com/docs/eu-vat.html) or [UK VAT](https://www.chargebee.com/docs/uk-vat.html) is enabled.) */ - - payment_owner?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + + tax_override_reason?:TaxOverrideReason; /** - * @description To filter based on `updated_at`. This attribute will be present only if the resource has been updated after 2016-09-28. It is advisable when using this filter, to pass the `sort_by` input parameter as `updated_at` for a faster response. + * @description Vat Number. Required if this invoice is VAT exempted. */ - - updated_at?:{after?:string,before?:string,between?:string,on?:string}; + + vat_number?:string; /** - * @description The subscription channel this object originated from and is maintained in. + * @description An overridden value for the first two characters of the [full VAT +number](https://en.wikipedia.org/wiki/VAT_identification_number). Only applicable specifically for customers with [billing_address](customers#customer_billing_address) `country` as `XI` (which is **United Kingdom - Northern Ireland** ). + +When you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or have [manually +enabled](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, you have the option of setting [billing_address](customers#customer_billing_address) `country` as `XI`. That's the code for **United Kingdom - Northern +Ireland** . The first two characters of the VAT number in such a case is `XI` by default. However, if the VAT number was registered in UK, the value should be `GB`. Set `vat_number_prefix` to `GB` for such cases. */ - - channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string}; + + vat_number_prefix?:string; /** - * @description Timestamp indicating the date \& time this invoice got voided. + * @description Date when invoice raised. */ - - voided_at?:{after?:string,before?:string,between?:string,on?:string}; + + date:number; /** - * @description Reason code for voiding the invoice. Select from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Invoices \> Void invoice**. Must be passed if set as mandatory in the app. The codes are case-sensitive + * @description Invoice total amount. */ - - void_reason_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + + total:number; /** - * @description Lists all the Invoices. + * @description Round off amount. */ - - sort_by?:{asc?:'date' | 'updated_at',desc?:'date' | 'updated_at'}; + + round_off?:number; /** - * @description Parameters for einvoice + * @description Current status of this invoice. \* not_paid - Indicates the payment is not made and all attempts to collect is failed. \* voided - Indicates a voided invoice. \* paid - Indicates a paid invoice. \* posted - Indicates the payment is not yet collected and will be in this state till the due date to indicate the due period \* pending - +The [invoice](/docs/api/invoices?prod_cat_ver=2#invoice_status) is yet to be closed (sent for payment collection). An invoice is generated with this `status` when it has line items that belong to items that are `metered` or when the `subscription.create_pending_invoices`attribute is set to `true`. +The [invoice](/docs/api/invoices?prod_cat_ver=1#invoice_status) is yet to be closed (sent for payment collection). All invoices are generated with this `status` when [Metered Billing](https://www.chargebee.com/docs/1.0/metered_billing.html) is enabled for the site. \* payment_due - Indicates the payment is not yet collected and is being retried as per retry settings. */ - - einvoice?:{status?:{in?:string,is?:'in_progress' | 'scheduled' | 'success' | 'registered' | 'failed' | 'skipped',is_not?:'in_progress' | 'scheduled' | 'success' | 'registered' | 'failed' | 'skipped',not_in?:string}}; - } - export interface CloseResponse { - invoice:Invoice; - } - export interface CloseInputParam { + + status?:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due'; /** - * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). + * @description Timestamp indicating the date \& time this invoice got voided. */ - comment?:string; + voided_at?:number; /** - * @description A note for this particular invoice. This, and [all other notes](/docs/api/invoices#invoice_notes) for the invoice are displayed on the PDF invoice sent to the customer. + * @description Reason code for voiding the invoice. Select from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Invoices \> Void invoice**. Must be passed if set as mandatory in the app. The codes are case-sensitive. */ - invoice_note?:string; + void_reason_code?:string; /** - * @description Set as `true` to remove the **[general note](https://www.chargebee.com/docs/invoice_notes.html#adding-general-notes)** from this invoice. + * @description If is_written_off is true then the invoice is written off. */ - remove_general_note?:boolean; + is_written_off?:boolean; /** - * @description Set the [invoice date](https://apidocs.chargebee.com/docs/api/invoices#invoice_date). Must lie between the date when the invoice was generated and current date. Can only be passed when the site setting to allow overriding is enabled. If not passed, then the default value [set at the site level](https://www.chargebee.com/docs/metered_billing.html#overview) is used. + * @description Amount written off against this invoice. If this value is not present then the due amount of the invoice will be written off. */ - invoice_date?:number; + write_off_amount?:number; /** - * @description Parameters for notes_to_remove + * @description The date on which the write_off invoice has occurred. This is a mandatory field if is_written_off is true. The same date reflects on the created credit note. */ - notes_to_remove?:{entity_id?:string,entity_type?:EntityType}[]; - } - export interface ApplyCreditsResponse { - invoice:Invoice; - } - export interface ApplyCreditsInputParam { + write_off_date?:number; /** - * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). + * @description Invoice Due Date. */ - comment?:string; + due_date?:number; /** - * @description Parameters for credit_notes + * @description Invoice net term days. */ - credit_notes?:{id?:string}[]; - } - export interface RetrieveResponse { - invoice:Invoice; - } - - export interface CreateForChargeItemsAndChargesResponse { - invoice:Invoice; - } - export interface CreateForChargeItemsAndChargesInputParam { + net_term_days?:number; /** - * @description Unique ID of the customer this invoice should be created for. Either this or `subscription_id` must be provided. -**Note** - -The invoice is [linked](/docs/api?prod_cat_ver=2#mbe-linked-be) to the same [business entity](/docs/api?prod_cat_ver=2#mbe) as this customer. -. + * @description Boolean indicating any advance charge is present in this invoice. */ - customer_id?:string; + has_advance_charges?:boolean; /** - * @description Unique ID of the subscription this invoice should be created for. Either this or `customer_id` must be provided. -**Note** - -The invoice is [linked](/docs/api?prod_cat_ver=2#mbe-linked-be) to the same [business entity](/docs/api?prod_cat_ver=2#mbe) as this subscription. -. + * @description If the invoice falls within the subscription current term will be used for proration. */ - subscription_id?:string; + use_for_proration?:boolean; /** - * @description The currency code (ISO 4217 format) of the invoice amount. + * @description Parameters for credit_note */ - currency_code?:string; + credit_note?:{id?:string}; /** - * @description A note for this particular invoice. This, and [all other notes](/docs/api/invoices#invoice_notes) for the invoice are displayed on the PDF invoice sent to the customer. + * @description Parameters for billing_address */ - invoice_note?:string; + billing_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}; /** - * @description Set as `true` to remove the **[general note](https://www.chargebee.com/docs/invoice_notes.html#adding-general-notes)** from this invoice. + * @description Parameters for shipping_address */ - remove_general_note?:boolean; + 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}; /** - * @description Purchase Order Number for this invoice. + * @description Parameters for line_items */ - po_number?:string; + line_items?:{amount?:number,amount_in_decimal?:string,date_from?:number,date_to?:number,description:string,entity_id?:string,entity_type?:'addon_item_price' | 'plan_item_price' | 'charge_item_price' | 'adhoc',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}[]; /** - * @description List of Coupons to be added. + * @description Parameters for payment_reference_numbers */ - coupon_ids?:string[]; + payment_reference_numbers?:{id?:string,number:string,type:'frn' | 'kid' | 'fik' | 'ocr'}[]; /** - * @description Authorization transaction to be captured. + * @description Parameters for line_item_tiers */ - authorization_transaction_id?:string; + line_item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,line_item_id:string,quantity_used?:number,quantity_used_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string,unit_amount?:number,unit_amount_in_decimal?:string}[]; /** - * @description Payment source to be used for this payment. + * @description Parameters for discounts */ - payment_source_id?:string; + discounts?:{amount:number,description?:string,entity_id?:string,entity_type:'item_level_coupon' | 'promotional_credits' | 'item_level_discount' | 'document_level_discount' | 'document_level_coupon',line_item_id?:string}[]; /** - * @description The customer level auto collection will be override if specified. \* on - Whenever an invoice is created, an automatic attempt will be made to charge. \* off - Whenever an invoice is created as payment due. + * @description Parameters for taxes */ - auto_collection?:AutoCollection; + taxes?:{amount?:number,description?:string,juris_code?:string,juris_name?:string,juris_type?:'special' | 'country' | 'unincorporated' | 'other' | 'city' | 'federal' | 'county' | 'state',name:string,rate:number}[]; /** - * @description The document date displayed on the invoice PDF. By default, it is the date of creation of the invoice or, when Metered Billing is enabled, it can be the date of closing the invoice. Provide this value to backdate the invoice (set the invoice date to a value in the past). Backdating an invoice is done for reasons such as booking revenue for a previous date or when the non-recurring charge is effective as of a past date. `taxes` and `line_item_taxes` are computed based on the tax configuration as of this date. The date should not be more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December. + * @description Parameters for payments */ - invoice_date?:number; + payments?:{amount:number,date?:number,payment_method:PaymentMethod,reference_number?:string}[]; /** - * @description Token generated by Chargebee JS representing payment method details. + * @description Parameters for notes */ - token_id?:string; + notes?:{entity_id?:string,entity_type?:'addon_item_price' | 'coupon' | 'plan_item_price' | 'charge_item_price',note?:string}[]; + } + export interface ApplyPaymentsResponse { + invoice:Invoice; + } + export interface ApplyPaymentsInputParam { /** - * @description Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False. + * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). */ - replace_primary_payment_source?:boolean; + comment?:string; /** - * @description Indicates whether the payment source should be retained for the customer. + * @description Parameters for transactions */ - retain_payment_source?:boolean; + transactions?:{id?:string}[]; + } + export interface SyncUsagesResponse { + invoice:Invoice; + } + + export interface DeleteLineItemsResponse { + invoice:Invoice; + } + export interface DeleteLineItemsInputParam { /** - * @description Parameters for shipping_address + * @description The list of line items which have to be deleted. */ - 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}; + line_items?:{id?:string}[]; + } + export interface ApplyCreditsResponse { + invoice:Invoice; + } + export interface ApplyCreditsInputParam { /** - * @description Parameters for card + * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). */ - card?:{additional_information?:object,billing_addr1?:string,billing_addr2?:string,billing_city?:string,billing_country?:string,billing_state?:string,billing_state_code?:string,billing_zip?:string,cvv?:string,expiry_month?:number,expiry_year?:number,first_name?:string,gateway_account_id?:string,last_name?:string,number?:string}; + comment?:string; /** - * @description Parameters for bank_account + * @description Parameters for credit_notes */ - bank_account?:{account_holder_type?:AccountHolderType,account_number?:string,account_type?:AccountType,bank_code?:string,bank_name?:string,billing_address?:object,company?:string,echeck_type?:EcheckType,email?:string,first_name?:string,gateway_account_id?:string,iban?:string,issuing_country?:string,last_name?:string,phone?:string,routing_number?:string,swedish_identity_number?:string}; - + credit_notes?:{id?:string}[]; + } + export interface ListResponse { /** - * @description Parameters for payment_method + * @description Lists all the Invoices. */ - payment_method?:{additional_information?:object,gateway_account_id?:string,issuing_country?:string,reference_id?:string,tmp_token?:string,type?:Type}; + list:{invoice:Invoice}[]; /** - * @description Parameters for payment_intent + * @description Lists all the Invoices. */ - payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'sofort' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'card',reference_id?:string}; - + next_offset?:string; + } + export interface ListInputParam { + [key : string]: any; /** - * @description Parameters for item_prices + * @description Lists all the Invoices. */ - - item_prices?:{date_from?:number,date_to?:number,item_price_id?:string,quantity?:number,quantity_in_decimal?:string,unit_price?:number,unit_price_in_decimal?:string}[]; + + limit?:number; /** - * @description Parameters for item_tiers + * @description Lists all the Invoices. */ - - item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; + + offset?:string; /** - * @description Parameters for charges + * @description Lists all the Invoices. */ - - charges?:{amount?:number,amount_in_decimal?:string,avalara_sale_type?:AvalaraSaleType,avalara_service_type?:number,avalara_tax_code?:string,avalara_transaction_type?:number,date_from?:number,date_to?:number,description?:string,hsn_code?:string,tax_profile_id?:string,taxable?:boolean,taxjar_product_code?:string}[]; + + include_deleted?:boolean; /** - * @description Parameters for notes_to_remove + * @description Lists all the Invoices. */ - - notes_to_remove?:{entity_id?:string,entity_type?:EntityType}[]; + + id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Parameters for discounts + * @description Lists all the Invoices. */ - - discounts?:{amount?:number,apply_on:ApplyOn,item_price_id?:string,percentage?:number}[]; - } - export interface UpdateDetailsResponse { - invoice:Invoice; - } - export interface UpdateDetailsInputParam { + + subscription_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string}; /** - * @description VAT/ Tax registration number of the customer. [Learn more](https://www.chargebee.com/docs/tax.html#capture-tax-registration-number). + * @description Lists all the Invoices. */ - - vat_number?:string; + + customer_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description An overridden value for the first two characters of the [full VAT -number](https://en.wikipedia.org/wiki/VAT_identification_number). Only applicable specifically for customers with [billing_address](customers#customer_billing_address) `country` as `XI` (which is **United Kingdom - Northern Ireland** ). - -When you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or have [manually -enabled](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, you have the option of setting [billing_address](customers#customer_billing_address) `country` as `XI`. That's the code for **United Kingdom - Northern -Ireland** . The first two characters of the VAT number in such a case is `XI` by default. However, if the VAT number was registered in UK, the value should be `GB`. Set `vat_number_prefix` to `GB` for such cases. + * @description Lists all the Invoices. */ - - vat_number_prefix?:string; + + recurring?:{is?:'true' | 'false'}; /** - * @description Purchase Order Number for this invoice. + * @description Lists all the Invoices. */ - - po_number?:string; + + status?:{in?:string,is?:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due',is_not?:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due',not_in?:string}; /** - * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). + * @description Lists all the Invoices. */ - - comment?:string; + + price_type?:{in?:string,is?:'tax_exclusive' | 'tax_inclusive',is_not?:'tax_exclusive' | 'tax_inclusive',not_in?:string}; /** - * @description Parameters for billing_address + * @description Lists all the Invoices. */ - - billing_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}; + + date?:{after?:string,before?:string,between?:string,on?:string}; /** - * @description Parameters for shipping_address + * @description Lists all the Invoices. */ - - 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}; - } - export interface RecordPaymentResponse { - invoice:Invoice; - - transaction:Transaction; - } - export interface RecordPaymentInputParam { + + paid_at?:{after?:string,before?:string,between?:string,on?:string}; /** - * @description Remarks, if any, on the payment. + * @description Lists all the Invoices. */ - - comment?:string; + + total?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; /** - * @description Parameters for transaction + * @description Lists all the Invoices. */ - - transaction?:{amount?:number,date?:number,error_code?:string,error_text?:string,id_at_gateway?:string,payment_method:PaymentMethod,reference_number?:string,status?:'success' | 'failure'}; - } - export interface DeleteResponse { - invoice:Invoice; - } - export interface DeleteInputParam { + + amount_paid?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; /** - * @description Reason for deleting the invoice. This comment will be added to the subscription entity if the invoice belongs to a subscription. It is added to the customer entity if the invoice is associated only with a customer. + * @description Lists all the Invoices. */ - - comment?:string; + + amount_adjusted?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; /** - * @description Indicates whether to put prorated credits back to the subscription or ignore while deleting the invoice. + * @description Lists all the Invoices. */ - - claim_credits?:boolean; - } - export interface ImportInvoiceResponse { - invoice:Invoice; - - credit_note?:CreditNote; - } - export interface ImportInvoiceInputParam { + + credits_applied?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; /** - * @description Invoice Number. + * @description Lists all the Invoices. */ - - id:string; + + amount_due?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; /** - * @description The currency code (ISO 4217 format) for the invoice. + * @description Lists all the Invoices. */ - - currency_code?:string; + + dunning_status?:{in?:string,is?:'in_progress' | 'stopped' | 'success' | 'exhausted',is_not?:'in_progress' | 'stopped' | 'success' | 'exhausted',is_present?:'true' | 'false',not_in?:string}; /** - * @description Identifier of the customer for which this invoice needs to be created. + * @description Lists all the Invoices. */ - - customer_id?:string; + + payment_owner?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description If recurring items are present in line items then subscription id is required. + * @description Lists all the Invoices. */ - - subscription_id?:string; + + updated_at?:{after?:string,before?:string,between?:string,on?:string}; /** - * @description Purchase Order Number for this invoice. + * @description Lists all the Invoices. */ - - po_number?:string; + + channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string}; /** - * @description The price type of the invoice. \* tax_inclusive - All amounts in the document are inclusive of tax. \* tax_exclusive - All amounts in the document are exclusive of tax. + * @description Lists all the Invoices. */ - - price_type?:PriceType; + + voided_at?:{after?:string,before?:string,between?:string,on?:string}; /** - * @description The reason for exempting the invoice from tax. (Applicable only for exempted invoices.). \* export - The customer is from a non-taxable region or the billing address and shipping address are unavailable. \* customer_exempt - The customer is [exempted](customers#customer_taxability) from tax. \* id_exempt - The customer is from a different country than your business and they have a valid VAT number or, the customer is a business entity. (This reason is only applicable when [EU VAT](https://www.chargebee.com/docs/eu-vat.html) or [UK VAT](https://www.chargebee.com/docs/uk-vat.html) is enabled.) + * @description Lists all the Invoices. */ - - tax_override_reason?:TaxOverrideReason; + + void_reason_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Vat Number. Required if this invoice is VAT exempted. + * @description Lists all the Invoices. */ - - vat_number?:string; + + sort_by?:{asc?:'date' | 'updated_at',desc?:'date' | 'updated_at'}; /** - * @description An overridden value for the first two characters of the [full VAT -number](https://en.wikipedia.org/wiki/VAT_identification_number). Only applicable specifically for customers with [billing_address](customers#customer_billing_address) `country` as `XI` (which is **United Kingdom - Northern Ireland** ). - -When you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or have [manually -enabled](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, you have the option of setting [billing_address](customers#customer_billing_address) `country` as `XI`. That's the code for **United Kingdom - Northern -Ireland** . The first two characters of the VAT number in such a case is `XI` by default. However, if the VAT number was registered in UK, the value should be `GB`. Set `vat_number_prefix` to `GB` for such cases. + * @description Lists all the Invoices. */ + + einvoice?:{status?:{in?:string,is?:'in_progress' | 'scheduled' | 'success' | 'registered' | 'failed' | 'skipped',is_not?:'in_progress' | 'scheduled' | 'success' | 'registered' | 'failed' | 'skipped',not_in?:string}}; + } + export interface RetrieveResponse { + invoice:Invoice; + } + + export interface PdfResponse { + download:Download; + } + export interface PdfInputParam { - vat_number_prefix?:string; + /** + * @description Determines the pdf should be rendered as inline or attachment in the browser. \* attachment - PDF is rendered as attachment in the browser \* inline - PDF is rendered as inline in the browser + + */ + disposition_type?:DispositionType; + } + export interface DownloadEinvoiceResponse { + downloads:Download[]; + } + + export interface ListPaymentReferenceNumbersResponse { /** - * @description Date when invoice raised. + * @description This API endpoint allows users to retrieve the payment reference numbers (PRNs) associated with an invoice. Only one PRN is allowed per payment type. You can use the `invoice_id` or the `payment_reference_number[number]` to retrieve the PRN. */ - date:number; + list:{payment_reference_number:PaymentReferenceNumber}[]; /** - * @description Invoice total amount. + * @description This API endpoint allows users to retrieve the payment reference numbers (PRNs) associated with an invoice. Only one PRN is allowed per payment type. You can use the `invoice_id` or the `payment_reference_number[number]` to retrieve the PRN. */ - total:number; - + next_offset?:string; + } + export interface ListPaymentReferenceNumbersInputParam { + [key : string]: any; /** - * @description Round off amount. + * @description This API endpoint allows users to retrieve the payment reference numbers (PRNs) associated with an invoice. Only one PRN is allowed per payment type. You can use the `invoice_id` or the `payment_reference_number[number]` to retrieve the PRN. */ + + limit?:number; - round_off?:number; + /** + * @description This API endpoint allows users to retrieve the payment reference numbers (PRNs) associated with an invoice. Only one PRN is allowed per payment type. You can use the `invoice_id` or the `payment_reference_number[number]` to retrieve the PRN. + + */ + + offset?:string; /** - * @description Current status of this invoice. \* pending - -The [invoice](/docs/api/invoices?prod_cat_ver=2#invoice_status) is yet to be closed (sent for payment collection). An invoice is generated with this `status` when it has line items that belong to items that are `metered` or when the `subscription.create_pending_invoices`attribute is set to `true`. -The [invoice](/docs/api/invoices?prod_cat_ver=1#invoice_status) is yet to be closed (sent for payment collection). All invoices are generated with this `status` when [Metered Billing](https://www.chargebee.com/docs/1.0/metered_billing.html) is enabled for the site. \* not_paid - Indicates the payment is not made and all attempts to collect is failed. \* payment_due - Indicates the payment is not yet collected and is being retried as per retry settings. \* voided - Indicates a voided invoice. \* paid - Indicates a paid invoice. \* posted - Indicates the payment is not yet collected and will be in this state till the due date to indicate the due period + * @description This API endpoint allows users to retrieve the payment reference numbers (PRNs) associated with an invoice. Only one PRN is allowed per payment type. You can use the `invoice_id` or the `payment_reference_number[number]` to retrieve the PRN. */ + + id?:{in?:string,is?:string}; - status?:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due'; + /** + * @description This API endpoint allows users to retrieve the payment reference numbers (PRNs) associated with an invoice. Only one PRN is allowed per payment type. You can use the `invoice_id` or the `payment_reference_number[number]` to retrieve the PRN. + + */ + + payment_reference_number?:{number?:{in?:string,is?:string}}; + } + export interface AddChargeResponse { + invoice:Invoice; + } + export interface AddChargeInputParam { /** - * @description Timestamp indicating the date \& time this invoice got voided. + * @description The amount to be charged. The unit depends on the [type of currency](/docs/api#md_disabled). */ - voided_at?:number; + amount:number; /** - * @description Reason code for voiding the invoice. Select from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Invoices \> Void invoice**. Must be passed if set as mandatory in the app. The codes are case-sensitive. + * @description Detailed description about this lineitem. */ - void_reason_code?:string; + description:string; /** - * @description Use this endpoint to import invoices that are created outside of Chargebee; for example, import invoices created with a commercial accounting software to Chargebee. This allows you to conveniently manage invoices in one place. + * @description Indicates the type of sale carried out. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. \* retail - Transaction is a sale to an end user \* wholesale - Transaction is a sale to another company that will resell your product or service to another consumer \* vendor_use - Transaction is for an item that is subject to vendor use tax \* consumed - Transaction is for an item that is consumed directly */ - is_written_off?:boolean; + avalara_sale_type?:AvalaraSaleType; /** - * @description Use this endpoint to import invoices that are created outside of Chargebee; for example, import invoices created with a commercial accounting software to Chargebee. This allows you to conveniently manage invoices in one place. + * @description Indicates the type of product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. */ - write_off_amount?:number; + avalara_transaction_type?:number; /** - * @description Use this endpoint to import invoices that are created outside of Chargebee; for example, import invoices created with a commercial accounting software to Chargebee. This allows you to conveniently manage invoices in one place. + * @description Indicates the type of service for the product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. */ - write_off_date?:number; + avalara_service_type?:number; /** - * @description Invoice Due Date. + * @description This represents the Avalara tax code to which the one-time charge is mapped. Applicable only if you use Chargebee's [AvaTax for Sales integration](https://www.chargebee.com/docs/avatax-for-sales.html). */ - due_date?:number; + avalara_tax_code?:string; /** - * @description Invoice net term days. + * @description The [HSN code](https://cbic-gst.gov.in/gst-goods-services-rates.html) to which the one-time charge is mapped for calculating the customer's tax in India. Applicable when both the conditions are true: + +* **[India](https://www.chargebee.com/docs/indian-gst.html#configuring-indian-gst)** has been enabled as a **Tax Region**. (An error is returned when this condition is not true.) +* The [**AvaTax for Sales** integration](https://www.chargebee.com/docs/avalara.html) has been enabled in Chargebee. +. */ - net_term_days?:number; + hsn_code?:string; /** - * @description Use this endpoint to import invoices that are created outside of Chargebee; for example, import invoices created with a commercial accounting software to Chargebee. This allows you to conveniently manage invoices in one place. + * @description This represents the TaxJar product code to which the one-time charge is mapped. Applicable only if you use Chargebee's [TaxJar integration](https://www.chargebee.com/docs/taxjar.html). */ - has_advance_charges?:boolean; + taxjar_product_code?:string; /** - * @description If the invoice falls within the subscription current term will be used for proration. + * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). */ - use_for_proration?:boolean; + comment?:string; /** - * @description Use this endpoint to import invoices that are created outside of Chargebee; for example, import invoices created with a commercial accounting software to Chargebee. This allows you to conveniently manage invoices in one place. + * @description Identifier of the subscription for which this charge needs to be created. Applicable for consolidated invoice. */ - credit_note?:{id?:string}; + subscription_id?:string; /** - * @description Parameters for billing_address + * @description Parameters for line_item */ - billing_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}; + line_item?:{date_from?:number,date_to?:number}; + } + export interface AddChargeItemResponse { + invoice:Invoice; + } + export interface AddChargeItemInputParam { /** - * @description Parameters for shipping_address + * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). */ - 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}; + comment?:string; /** - * @description Parameters for line_items + * @description Identifier of the subscription for which this addon needs to be created. Applicable for consolidated invoice. */ - line_items?:{amount?:number,amount_in_decimal?:string,date_from?:number,date_to?:number,description:string,entity_id?:string,entity_type?:'addon_item_price' | 'plan_item_price' | 'charge_item_price' | 'adhoc',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}[]; + subscription_id?:string; /** - * @description Use this endpoint to import invoices that are created outside of Chargebee; for example, import invoices created with a commercial accounting software to Chargebee. This allows you to conveniently manage invoices in one place. + * @description Parameters for item_price */ - payment_reference_numbers?:{id?:string,number:string,type:'frn' | 'kid' | 'fik' | 'ocr'}[]; + item_price?:{date_from?:number,date_to?:number,item_price_id:string,quantity?:number,quantity_in_decimal?:string,unit_price?:number,unit_price_in_decimal?:string}; /** - * @description Parameters for line_item_tiers + * @description Parameters for item_tiers */ - line_item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,line_item_id:string,quantity_used?:number,quantity_used_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string,unit_amount?:number,unit_amount_in_decimal?:string}[]; + item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; + } + export interface CloseResponse { + invoice:Invoice; + } + export interface CloseInputParam { /** - * @description Parameters for discounts + * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). */ - discounts?:{amount:number,description?:string,entity_id?:string,entity_type:'item_level_coupon' | 'promotional_credits' | 'item_level_discount' | 'document_level_discount' | 'document_level_coupon',line_item_id?:string}[]; + comment?:string; /** - * @description Parameters for taxes + * @description A note for this particular invoice. This, and [all other notes](/docs/api/invoices#invoice_notes) for the invoice are displayed on the PDF invoice sent to the customer. */ - taxes?:{amount?:number,description?:string,juris_code?:string,juris_name?:string,juris_type?:'special' | 'country' | 'unincorporated' | 'other' | 'city' | 'federal' | 'county' | 'state',name:string,rate:number}[]; + invoice_note?:string; /** - * @description Parameters for payments + * @description Set as `true` to remove the **[general note](https://www.chargebee.com/docs/invoice_notes.html#adding-general-notes)** from this invoice. */ - payments?:{amount:number,date?:number,payment_method:PaymentMethod,reference_number?:string}[]; + remove_general_note?:boolean; /** - * @description Parameters for notes + * @description Set the [invoice date](https://apidocs.chargebee.com/docs/api/invoices#invoice_date). Must lie between the date when the invoice was generated and current date. Can only be passed when the site setting to allow overriding is enabled. If not passed, then the default value [set at the site level](https://www.chargebee.com/docs/metered_billing.html#overview) is used. */ - notes?:{entity_id?:string,entity_type?:'addon_item_price' | 'coupon' | 'plan_item_price' | 'charge_item_price',note?:string}[]; - } - export interface RecordTaxWithheldResponse { - invoice:Invoice; - } - export interface RecordTaxWithheldInputParam { + invoice_date?:number; /** - * @description Parameters for tax_withheld + * @description Parameters for notes_to_remove */ - tax_withheld?:{amount:number,date?:number,description?:string,reference_number?:string}; - } - export interface ResendEinvoiceResponse { - invoice:Invoice; + notes_to_remove?:{entity_id?:string,entity_type?:EntityType}[]; } - - export interface RemoveTaxWithheldResponse { + export interface CollectPaymentResponse { invoice:Invoice; + + transaction:Transaction; } - export interface RemoveTaxWithheldInputParam { + export interface CollectPaymentInputParam { /** - * @description Parameters for tax_withheld + * @description Amount to be collected. If this parameter is not passed then the entire amount due will be collected. */ - tax_withheld?:{id:string}; - } - export interface ListPaymentReferenceNumbersResponse { + amount?:number; + /** - * @description This API endpoint allows users to retrieve the payment reference numbers (PRNs) associated with an invoice. Only one PRN is allowed per payment type. You can use the `invoice_id` or the `payment_reference_number[number]` to retrieve the PRN. + * @description Authorization transaction to be captured. */ - list:{payment_reference_number:PaymentReferenceNumber}[]; + authorization_transaction_id?:string; /** - * @description This API endpoint allows users to retrieve the payment reference numbers (PRNs) associated with an invoice. Only one PRN is allowed per payment type. You can use the `invoice_id` or the `payment_reference_number[number]` to retrieve the PRN. + * @description Payment source to be used for this payment. */ - next_offset?:string; - } - export interface ListPaymentReferenceNumbersInputParam { - [key : string]: any; + payment_source_id?:string; + /** - * @description The number of resources to be returned. + * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). */ - - limit?:number; - /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. - - */ - - offset?:string; + comment?:string; /** - * @description An unique identifier for the invoice serves that links the invoice to the corresponding payment reference number (PRN). -**Note**: To retrieve the PRN, the API requires either the invoice ID or the payment reference number to be provided by the user. If both values are missing, an error will be returned by the API. + * @description The type of initiator to be used for the payment request triggered by this operation. \* merchant - Pass this value to indicate that the request is initiated by the merchant \* customer - Pass this value to indicate that the request is initiated by the customer */ - - id?:{in?:string,is?:string}; - /** - * @description Parameters for payment_reference_number - - */ - - payment_reference_number?:{number?:{in?:string,is?:string}}; + payment_initiator?:PaymentInitiator; } - export interface CollectPaymentResponse { + export interface RecordPaymentResponse { invoice:Invoice; transaction:Transaction; } - export interface CollectPaymentInputParam { - - /** - * @description Amount to be collected. If this parameter is not passed then the entire amount due will be collected. - - */ - - amount?:number; + export interface RecordPaymentInputParam { /** - * @description Authorization transaction to be captured. + * @description Remarks, if any, on the payment. */ - authorization_transaction_id?:string; + comment?:string; /** - * @description Payment source to be used for this payment. + * @description Parameters for transaction */ - payment_source_id?:string; + transaction?:{amount?:number,date?:number,error_code?:string,error_text?:string,id_at_gateway?:string,payment_method:PaymentMethod,reference_number?:string,status?:'success' | 'failure'}; + } + export interface RecordTaxWithheldResponse { + invoice:Invoice; + } + export interface RecordTaxWithheldInputParam { /** - * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). + * @description Parameters for tax_withheld */ - comment?:string; + tax_withheld?:{amount:number,date?:number,description?:string,reference_number?:string}; + } + export interface RemoveTaxWithheldResponse { + invoice:Invoice; + } + export interface RemoveTaxWithheldInputParam { /** - * @description null + * @description Parameters for tax_withheld */ - payment_initiator?:PaymentInitiator; - } - export interface SyncUsagesResponse { - invoice:Invoice; + tax_withheld?:{id:string}; } - export interface RefundResponse { invoice:Invoice; @@ -1921,234 +1827,878 @@ The [invoice](/docs/api/invoices?prod_cat_ver=1#invoice_status) is yet to b credit_note?:{create_reason_code?:string,reason_code?:'order_cancellation' | 'service_unsatisfactory' | 'other' | 'product_unsatisfactory' | 'chargeback' | 'order_change' | 'waiver'}; } - export interface PdfResponse { - download:Download; + export interface RemovePaymentResponse { + invoice:Invoice; + + transaction:Transaction; } - export interface PdfInputParam { + export interface RemovePaymentInputParam { /** - * @description Determines the pdf should be rendered as inline or attachment in the browser. \* attachment - PDF is rendered as attachment in the browser \* inline - PDF is rendered as inline in the browser + * @description Parameters for transaction */ - disposition_type?:DispositionType; + transaction?:{id:string}; } - export interface DownloadEinvoiceResponse { - downloads:Download[]; + export interface RemoveCreditNoteResponse { + invoice:Invoice; + + credit_note:CreditNote; + } + export interface RemoveCreditNoteInputParam { + + /** + * @description Parameters for credit_note + + */ + + credit_note?:{id:string}; + } + export interface VoidInvoiceResponse { + invoice:Invoice; + + credit_note?:CreditNote; + } + export interface VoidInvoiceInputParam { + + /** + * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). + + */ + + comment?:string; + + /** + * @description Reason code for voiding the invoice. Select from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Invoices \> Void invoice**. Must be passed if set as mandatory in the app. The codes are case-sensitive. + + */ + + void_reason_code?:string; + } + export interface WriteOffResponse { + invoice:Invoice; + + credit_note:CreditNote; + } + export interface WriteOffInputParam { + + /** + * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). + + */ + + comment?:string; + } + export interface DeleteResponse { + invoice:Invoice; + } + export interface DeleteInputParam { + + /** + * @description Reason for deleting the invoice. This comment will be added to the subscription entity if the invoice belongs to a subscription. It is added to the customer entity if the invoice is associated only with a customer. + + */ + + comment?:string; + + /** + * @description Indicates whether to put prorated credits back to the subscription or ignore while deleting the invoice. + + */ + + claim_credits?:boolean; + } + export interface UpdateDetailsResponse { + invoice:Invoice; + } + export interface UpdateDetailsInputParam { + + /** + * @description VAT/ Tax registration number of the customer. [Learn more](https://www.chargebee.com/docs/tax.html#capture-tax-registration-number). + + */ + + vat_number?:string; + + /** + * @description An overridden value for the first two characters of the [full VAT +number](https://en.wikipedia.org/wiki/VAT_identification_number). Only applicable specifically for customers with [billing_address](customers#customer_billing_address) `country` as `XI` (which is **United Kingdom - Northern Ireland** ). + +When you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or have [manually +enabled](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, you have the option of setting [billing_address](customers#customer_billing_address) `country` as `XI`. That's the code for **United Kingdom - Northern +Ireland** . The first two characters of the VAT number in such a case is `XI` by default. However, if the VAT number was registered in UK, the value should be `GB`. Set `vat_number_prefix` to `GB` for such cases. + + */ + + vat_number_prefix?:string; + + /** + * @description Purchase Order Number for this invoice. + + */ + + po_number?:string; + + /** + * @description An internal [comment](./comments) to be added for this operation, to the invoice. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Invoice PDF](./invoices#retrieve_invoice_as_pdf). + + */ + + comment?:string; + + /** + * @description Parameters for billing_address + + */ + + billing_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}; + + /** + * @description Parameters for shipping_address + + */ + + 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}; + + /** + * @description This API allows you to update the invoice Billing/Shipping address, VAT and PO number. During this operation if Billing Info (Billing Address, vat_number), Shipping info and PO number are not already present in the system the data will be added. If data is already present, the existing values will be replaced. If info is present in the system, but not passed as part of the request, the info will not be removed from the system. + +**Note:** Incase, tax is already applied will now vary due to address change, you cannot update the address. You cannot update the VAT Number if the billing address is not present in the API request.This will update the invoice only, it won't change the corresponding customer/subscription details. + + */ + + statement_descriptor?:{additional_info?:string,descriptor?:string}; + } + export interface ResendEinvoiceResponse { + invoice:Invoice; + } + + export interface SendEinvoiceResponse { + invoice:Invoice; } export interface LineItem { + /** + * @description Uniquely identifies a line_item + + */ + id?:string; + /** + * @description A unique identifier for the subscription this line item belongs to. + + */ + subscription_id?:string; - date_from?:number; + /** + * @description Start date of this line item. + + */ + + date_from:number; + + /** + * @description End date of this line item. + + */ + + date_to:number; + + /** + * @description Unit amount of the line item. + + */ - date_to?:number; + unit_amount:number; - unit_amount?:number; + /** + * @description [Quantity of the recurring item](https://apidocs.chargebee.com/docs/api/invoices?prod_cat_ver=2#invoice_line_items_quantity) represented by this line item. + +For metered line items, this value is updated from [usages](https://apidocs.chargebee.com/docs/api/usages) when: + +* the invoice is generated as pending + +* the invoice is [closed](https://apidocs.chargebee.com/docs/api/invoices#close_a_pending_invoice) + +* the sync usages API is called + + + */ quantity?:number; + /** + * @description Total amount of this line item. Typically equals to unit amount x quantity + + */ + amount?:number; + /** + * @description The [pricing scheme](https://www.chargebee.com/docs/2.0/plans.html#pricing-models) for this item price. \* stairstep - A quantity-based pricing scheme. The item is charged a fixed price based on the tier that the total quantity falls in. \* flat_fee - A fixed price that is not quantity-based. \* tiered - The per unit price is based on the tier that the total quantity falls in. \* per_unit - A fixed price per unit quantity. \* volume - There are quantity tiers for which per unit prices are set. Quantities are purchased from successive tiers. + + */ + pricing_model?:'volume' | 'per_unit' | 'tiered' | 'flat_fee' | 'stairstep'; - is_taxed?:boolean; + /** + * @description Specifies whether this line item is taxed or not + + */ + + is_taxed:boolean; + + /** + * @description The tax amount charged for this item + + */ tax_amount?:number; + /** + * @description Rate of tax used to calculate tax for this lineitem + + */ + tax_rate?:number; + /** + * @description The decimal representation of the unit amount of the `line_item`. The value is in major units of the currency. Returned when the `line_item` is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + unit_amount_in_decimal?:string; + /** + * @description The decimal representation of the quantity of this line_item. Returned when the `line_item` is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + quantity_in_decimal?:string; + /** + * @description The decimal representation of the amount for the `line_item`, in major units of the currency. Typically equals to `unit_amount_in_decimal` x `quantity_in_decimal`. Returned when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + amount_in_decimal?:string; + /** + * @description Total discounts for this line + + */ + discount_amount?:number; + /** + * @description Line Item-level discounts for this line. + + */ + item_level_discount_amount?:number; + /** + * @description The unique identifier of the invoice line item to which this credit note line item is related. This is the same as [invoice.line_items.id](https://apidocs.chargebee.com/docs/api/invoices#invoice_line_items_id ). + + */ + reference_line_item_id?:string; - description?:string; + /** + * @description Detailed description about this line item. + + */ + + description:string; + + /** + * @description Detailed description about this item. + + */ entity_description?:string; - entity_type?:'addon_item_price' | 'plan_item_price' | 'charge_item_price' | 'adhoc'; + /** + * @description Specifies the modelled entity this line item is based on. \* addon - Indicates that this lineitem is based on 'Addon' entity. The 'entity_id' attribute specifies the [addon](/docs/api/addons#addon_attributes) id \* plan - Indicates that this lineitem is based on 'Plan' entity. The 'entity_id' attribute specifies the [plan](/docs/api/plans#plan_attributes) id \* plan_item_price - Indicates that this line item is based on plan Item Price \* addon_item_price - Indicates that this line item is based on addon Item Price \* charge_item_price - Indicates that this line item is based on charge Item Price \* adhoc - Indicates that this lineitem is not modelled. i.e created adhoc. So the 'entity_id' attribute will be null in this case \* plan_setup - Indicates that this lineitem is based on 'Plan Setup' charge. The 'entity_id' attribute specifies the [plan](/docs/api/plans#plan_attributes) id + + */ + + entity_type:'addon_item_price' | 'plan_item_price' | 'charge_item_price' | 'adhoc'; + + /** + * @description The reason due to which the line item price/amount is exempted from tax. \* zero_value_item - If the total invoice value/amount is equal to zero. E.g., If the total order value is $10 and a $10 coupon has been applied against that order, the total order value becomes $0. Hence the invoice value also becomes $0. \* reverse_charge - If the Customer is identified as B2B customer (when VAT Number is entered), applicable for EU only \* tax_not_configured - If tax is not enabled for the site \* high_value_physical_goods - If physical goods are sold from outside Australia to customers in Australia, and the price of all the physical good line items is greater than AUD 1000, then tax will not be applied \* customer_exempt - If the Customer is marked as Tax exempt \* region_non_taxable - If the product sold is not taxable in this region, but it is taxable in other regions, hence this region is not part of the Taxable jurisdiction \* product_exempt - If the Plan or Addon is marked as Tax exempt \* zero_rated - If the rate of tax is 0% and no Sales/ GST tax is collectable for that line item \* export - You are not registered for tax in the customer's region. This is also the reason code when both `billing_address` and `shipping_address` have not been provided for the customer and subscription respectively + + */ tax_exempt_reason?:'high_value_physical_goods' | 'tax_not_configured' | 'reverse_charge' | 'zero_rated' | 'customer_exempt' | 'region_non_taxable' | 'zero_value_item' | 'export' | 'product_exempt'; + /** + * @description The identifier of the modelled entity this line item is based on. Will be null for 'adhoc' entity type + + */ + entity_id?:string; + /** + * @description A unique identifier for the customer this line item belongs to + + */ + customer_id?:string; } export interface Discount { - amount?:number; + /** + * @description The amount deducted. The format of this value depends on the [kind of currency](/docs/api?prod_cat_ver=2#currencies). + + */ + + amount:number; + + /** + * @description Description for this deduction. + + */ description?:string; + /** + * @description The unique id of the line item that this deduction is for. Is required when `discounts[entity_type]` is `item_level_coupon` or `document_level_coupon`. + + */ + line_item_id?:string; - entity_type?:'item_level_coupon' | 'promotional_credits' | 'item_level_discount' | 'prorated_credits' | 'document_level_discount' | 'document_level_coupon'; + /** + * @description The type of deduction and the amount to which it is applied. \* prorated_credits - The deduction is due to a legacy adjustment credit applied to the invoice. The `entity_id` is `null` in this case. The legacy credits feature is superseded by [adjustment_credit_notes](/docs/api/invoices?prod_cat_ver=2#invoice_adjustment_credit_notes). \* item_level_coupon - The deduction is due to a coupon applied to line item. The coupon `id` is passed as `entity_id`. \* item_level_discount - The deduction is due to a [discount](/docs/api/discounts?prod_cat_ver=2) applied to a line item of the invoice. The discount `id` is available as the `entity_id`. \* document_level_coupon - The deduction is due to a coupon applied to the invoice `sub_total`. The coupon id is passed as `entity_id`. \* promotional_credits - The deduction is due to a [promotional credit](/docs/api/promotional_credits?prod_cat_ver=2) applied to the invoice. \* document_level_discount - The deduction is due to a [discount](/docs/api/discounts?prod_cat_ver=2) applied to the invoice `sub_total`. The discount `id` is available as the `entity_id`. + + */ + + entity_type:'item_level_coupon' | 'promotional_credits' | 'item_level_discount' | 'prorated_credits' | 'document_level_discount' | 'document_level_coupon'; + + /** + * @description The type of discount that is applied to the line item. Relevant only when `discounts[entity_type]` is one of `item_level_discount` , `item_level_coupon`, `document_level_discount`, or `document_level_coupon` \* percentage - when percentage is applied as discount \* fixed_amount - when amount is applied as discount + + */ discount_type?:'fixed_amount' | 'percentage'; + /** + * @description When the deduction is due to a `coupon` or a [discount](discounts), then this is the `id` of the coupon or discount. + + */ + entity_id?:string; + /** + * @description The [coupon code](/docs/api/coupon_codes#coupon_code_code), if applicable, used to provide the discount. The [coupon.id](/docs/api/coupons#coupon_id) is available in `entity_id`. + + */ + coupon_set_code?:string; } export interface LineItemDiscount { - line_item_id?:string; + /** + * @description The unique id of the line item that this deduction is for. + + */ + + line_item_id:string; + + /** + * @description The type of deduction and the amount to which it is applied. \* prorated_credits - The deduction is due to a legacy adjustment credit applied to the invoice. The `entity_id` is `null` in this case. The legacy credits feature is superseded by [adjustment_credit_notes](/docs/api/invoices?prod_cat_ver=2#invoice_adjustment_credit_notes). \* document_level_coupon - The deduction is due to a coupon applied to the invoice `sub_total`. The coupon `id` is available as `entity_id`. \* promotional_credits - The deduction is due to a [promotional credit](/docs/api/promotional_credits) applied to the invoice. The `entity_id` is `null` in this case. \* item_level_coupon - The deduction is due to a coupon applied to a line item of the invoice. The coupon `id` is available as `entity_id`. \* document_level_discount - The deduction is due to a [discount](/docs/api/discounts?prod_cat_ver=2) applied to the invoice `sub_total`. The discount `id` is available as the `entity_id`. \* item_level_discount - The deduction is due to a [discount](/docs/api/discounts?prod_cat_ver=2) applied to a line item of the invoice. The discount `id` is available as the `entity_id`. + + */ - discount_type?:'item_level_coupon' | 'promotional_credits' | 'item_level_discount' | 'prorated_credits' | 'document_level_discount' | 'document_level_coupon'; + discount_type:'item_level_coupon' | 'promotional_credits' | 'item_level_discount' | 'prorated_credits' | 'document_level_discount' | 'document_level_coupon'; coupon_id?:string; + /** + * @description When the deduction is due to a `coupon` or a [discount](discounts), then this is the `id` of the coupon or discount. + + */ + entity_id?:string; - discount_amount?:number; + /** + * @description The amount deducted. The format of this value depends on the [kind of currency](/docs/api#currencies). + + */ + + discount_amount:number; } export interface Tax { - name?:string; + /** + * @description The name of the tax applied. E.g. GST. + + */ - amount?:number; + name:string; + + /** + * @description The tax amount. + + */ + + amount:number; + + /** + * @description Description of the tax item. + + */ description?:string; } export interface LineItemTax { + /** + * @description The unique reference id of the line item for which the tax is applicable + + */ + line_item_id?:string; - tax_name?:string; + /** + * @description The name of the tax applied + + */ - tax_rate?:number; + tax_name:string; + + /** + * @description The rate of tax used to calculate tax amount + + */ + + tax_rate:number; + + /** + * @description Indicates if tax is applied only on a portion of the line item amount. + + */ is_partial_tax_applied?:boolean; + /** + * @description Indicates the non-compliance tax that should not be reported to the jurisdiction. + + */ + is_non_compliance_tax?:boolean; - taxable_amount?:number; + /** + * @description Indicates the actual portion of the line item amount that is taxable. + + */ + + taxable_amount:number; + + /** + * @description The tax amount + + */ + + tax_amount:number; - tax_amount?:number; + /** + * @description The type of tax jurisdiction \* federal - The tax jurisdiction is a federal \* state - The tax jurisdiction is a state \* county - The tax jurisdiction is a county \* country - The tax jurisdiction is a country \* city - The tax jurisdiction is a city \* special - Special tax jurisdiction. \* unincorporated - Combined tax of state and county. \* other - Jurisdictions other than the ones listed above. + + */ tax_juris_type?:'special' | 'country' | 'unincorporated' | 'other' | 'city' | 'federal' | 'county' | 'state'; + /** + * @description The name of the tax jurisdiction + + */ + tax_juris_name?:string; + /** + * @description The tax jurisdiction code + + */ + tax_juris_code?:string; + /** + * @description Total tax amount in the currency of the place of supply. This is applicable only for Invoice and Credit Notes API. + + */ + tax_amount_in_local_currency?:number; + /** + * @description The currency code (ISO 4217 format) of the place of supply in which VAT needs to be converted and displayed. This is applicable only for Invoice and Credit Notes API. + + */ + local_currency_code?:string; } export interface LineItemTier { + /** + * @description Uniquely identifies a line_item + + */ + line_item_id?:string; - starting_unit?:number; + /** + * @description The lower limit of a range of units for the tier + + */ + + starting_unit:number; + + /** + * @description The upper limit of a range of units for the tier + + */ ending_unit?:number; - quantity_used?:number; + /** + * @description The number of units purchased in a range. + + */ + + quantity_used:number; + + /** + * @description The price of the tier if the charge model is a `stairtstep` pricing , or the price of each unit in the tier if the charge model is `tiered`/`volume` pricing. + + */ + + unit_amount:number; - unit_amount?:number; + /** + * @description The decimal representation of the the lowest value of quantity in this tier. This is zero for the lowest tier. For all other tiers, it is the same as `ending_unit_in_decimal` of the next lower tier. Returned only when the `line_items.pricing_model` is `tiered`, `volume` or `stairstep` and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ starting_unit_in_decimal?:string; + /** + * @description The decimal representation of the highest value of quantity in this tier. This attribute is not applicable for the highest tier. For all other tiers, it must be equal to the `starting_unit_in_decimal` of the next higher tier. Returned only when the `line_items.pricing_model` is `tiered`, `volume` or stairstep and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + ending_unit_in_decimal?:string; + /** + * @description The decimal representation of the quantity purchased from this tier. Returned when the `line_item` is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + quantity_used_in_decimal?:string; + /** + * @description The decimal representation of the per-unit price for the tier when the `pricing_model` is `tiered` or `volume`. When the `pricing_model` is `stairstep`, it is the decimal representation of the total price for `line_item`. The value is in major units of the currency. Returned when the `line_item` is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + unit_amount_in_decimal?:string; } export interface InvoiceTransaction { - txn_id?:string; + /** + * @description Uniquely identifies the transaction. + + */ + + txn_id:string; + + /** + * @description The transaction amount applied to this invoice + + */ + + applied_amount:number; + + /** + * @description Timestamp at which the transaction is applied. + + */ - applied_amount?:number; + applied_at:number; - applied_at?:number; + /** + * @description The status of this transaction. \* timeout - Transaction failed because of Gateway not accepting the connection. \* voided - The transaction got voided or authorization expired at gateway. \* needs_attention - Connection with Gateway got terminated abruptly. So, status of this transaction needs to be resolved manually \* failure - Transaction failed. Refer the 'error_code' and 'error_text' fields to know the reason for failure \* in_progress - Transaction is being processed by the gateway. This typically happens for [direct debit transactions](https://www.chargebee.com/docs/direct-debit-payments.html) or, in case of cards, refund transactions. Such transactions can take 2-7 days to complete, depending on the gateway and payment method. \* success - The transaction is successful. + + */ txn_status?:'in_progress' | 'success' | 'failure' | 'voided' | 'timeout' | 'needs_attention'; + /** + * @description Indicates when this transaction occurred. + + */ + txn_date?:number; + /** + * @description Total amount of the transaction + + */ + txn_amount?:number; } export interface DunningAttempt { - attempt?:number; + /** + * @description Dunning attempt number. + + */ + + attempt:number; + + /** + * @description Transaction associated with attempt. + + */ transaction_id?:string; - dunning_type?:'offline' | 'auto_collect' | 'direct_debit'; + /** + * @description Types of dunning \* offline - Dunning type is offline. \* direct_debit - Dunning type is direct debit. \* auto_collect - Dunning type is auto collection. + + */ + + dunning_type:'offline' | 'auto_collect' | 'direct_debit'; + + /** + * @description Timestamp at which the attempt was made. + + */ created_at?:number; + /** + * @description The status of this transaction. \* success - The transaction is successful. \* voided - The transaction got voided or authorization expired at gateway. \* needs_attention - Connection with Gateway got terminated abruptly. So, status of this transaction needs to be resolved manually \* failure - Transaction failed. Refer the 'error_code' and 'error_text' fields to know the reason for failure \* in_progress - Transaction is being processed by the gateway. This typically happens for [direct debit transactions](https://www.chargebee.com/docs/direct-debit-payments.html) or, in case of cards, refund transactions. Such transactions can take 2-7 days to complete, depending on the gateway and payment method. \* timeout - Transaction failed because of Gateway not accepting the connection. + + */ + txn_status?:'in_progress' | 'success' | 'failure' | 'voided' | 'timeout' | 'needs_attention'; + /** + * @description Total amount of the transaction + + */ + txn_amount?:number; } export interface AppliedCredit { - cn_id?:string; + /** + * @description Credit applied on the credit note ID. + + */ + + cn_id:string; + + /** + * @description Total credit amount applied to this invoice. + + */ + + applied_amount:number; + + /** + * @description Timestamp when the credit amount was applied to this invoice. + + */ - applied_amount?:number; + applied_at:number; - applied_at?:number; + /** + * @description Credit note reason code. Deprecated; use the cn_create_reason_code parameter instead \* subscription_change - This reason will be set automatically for Credit Notes created during Change Subscription operation when [proration](https://www.chargebee.com/docs/proration.html) is enabled \* write_off - This reason will be set automatically for the Credit Notes created during invoice [Write Off](https://www.chargebee.com/docs/invoice-operations.html#write-off) operation. \* other - Can be set when none of the above reason codes are applicable \* order_cancellation - Order Cancellation \* order_change - Order Change \* product_unsatisfactory - Product Unsatisfactory \* waiver - Waiver \* chargeback - Can be set when you are recording your customer Chargebacks \* subscription_cancellation - This reason will be set automatically for Credit Notes created during cancel subscription operation \* fraudulent - FRAUDULENT \* subscription_pause - This reason will be automatically set to credit notes created during pause/resume subscription operation. \* service_unsatisfactory - Service Unsatisfactory + + */ cn_reason_code?:'other' | 'product_unsatisfactory' | 'subscription_pause' | 'order_cancellation' | 'service_unsatisfactory' | 'subscription_cancellation' | 'chargeback' | 'order_change' | 'write_off' | 'waiver' | 'subscription_change' | 'fraudulent'; + /** + * @description Credit note reason code + + */ + cn_create_reason_code?:string; + /** + * @description Indicates the date at which this credit note is created + + */ + cn_date?:number; - cn_status?:'refund_due' | 'adjusted' | 'refunded' | 'voided'; + /** + * @description Credit note status. \* refunded - When the entire credits (Credit Note amount) have been used (i.e either allocated to invoices or refunded). \* voided - When the Credit Note has been cancelled. \* adjusted - When the Credit Note has been adjusted against an invoice. \* refund_due - When the credits are yet to be used, or have been partially used. + + */ + + cn_status:'refund_due' | 'adjusted' | 'refunded' | 'voided'; } export interface CreatedCreditNote { - cn_id?:string; + /** + * @description Credit-note id + + */ + + cn_id:string; + + /** + * @description Credit note reason code. Deprecated; use the cn_create_reason_code parameter instead \* subscription_cancellation - This reason will be set automatically for Credit Notes created during cancel subscription operation \* waiver - Waiver \* subscription_change - This reason will be set automatically for Credit Notes created during Change Subscription operation when [proration](https://www.chargebee.com/docs/proration.html) is enabled \* write_off - This reason will be set automatically for the Credit Notes created during invoice [Write Off](https://www.chargebee.com/docs/invoice-operations.html#write-off) operation. \* service_unsatisfactory - Service Unsatisfactory \* order_cancellation - Order Cancellation \* fraudulent - FRAUDULENT \* product_unsatisfactory - Product Unsatisfactory \* other - Can be set when none of the above reason codes are applicable \* chargeback - Can be set when you are recording your customer Chargebacks \* order_change - Order Change \* subscription_pause - This reason will be automatically set to credit notes created during pause/resume subscription operation. + + */ cn_reason_code?:'other' | 'product_unsatisfactory' | 'subscription_pause' | 'order_cancellation' | 'service_unsatisfactory' | 'subscription_cancellation' | 'chargeback' | 'order_change' | 'write_off' | 'waiver' | 'subscription_change' | 'fraudulent'; + /** + * @description Credit note reason code + + */ + cn_create_reason_code?:string; + /** + * @description Indicates the date at which this credit note is created + + */ + cn_date?:number; + /** + * @description Total amount of the credit note. + + */ + cn_total?:number; - cn_status?:'refund_due' | 'adjusted' | 'refunded' | 'voided'; + /** + * @description Credit note status. \* voided - When the Credit Note has been cancelled. \* refund_due - When the credits are yet to be used, or have been partially used. \* refunded - When the entire credits (Credit Note amount) have been used (i.e either allocated to invoices or refunded). \* adjusted - When the Credit Note has been adjusted against an invoice. + + */ + + cn_status:'refund_due' | 'adjusted' | 'refunded' | 'voided'; } export interface CreatedCreditNote { - cn_id?:string; + /** + * @description Credit-note id + + */ + + cn_id:string; + + /** + * @description Credit note reason code. Deprecated; use the cn_create_reason_code parameter instead \* fraudulent - FRAUDULENT \* product_unsatisfactory - Product Unsatisfactory \* write_off - This reason will be set automatically for the Credit Notes created during invoice [Write Off](https://www.chargebee.com/docs/invoice-operations.html#write-off) operation. \* subscription_cancellation - This reason will be set automatically for Credit Notes created during cancel subscription operation \* service_unsatisfactory - Service Unsatisfactory \* chargeback - Can be set when you are recording your customer Chargebacks \* subscription_pause - This reason will be automatically set to credit notes created during pause/resume subscription operation. \* waiver - Waiver \* order_change - Order Change \* subscription_change - This reason will be set automatically for Credit Notes created during Change Subscription operation when [proration](https://www.chargebee.com/docs/proration.html) is enabled \* order_cancellation - Order Cancellation \* other - Can be set when none of the above reason codes are applicable + + */ cn_reason_code?:'other' | 'product_unsatisfactory' | 'subscription_pause' | 'order_cancellation' | 'service_unsatisfactory' | 'subscription_cancellation' | 'chargeback' | 'order_change' | 'write_off' | 'waiver' | 'subscription_change' | 'fraudulent'; + /** + * @description Credit note reason code + + */ + cn_create_reason_code?:string; + /** + * @description Indicates the date at which this credit note is created + + */ + cn_date?:number; + /** + * @description Total amount of the credit note. + + */ + cn_total?:number; - cn_status?:'refund_due' | 'adjusted' | 'refunded' | 'voided'; + /** + * @description Credit note status. \* refund_due - When the credits are yet to be used, or have been partially used. \* adjusted - When the Credit Note has been adjusted against an invoice. \* refunded - When the entire credits (Credit Note amount) have been used (i.e either allocated to invoices or refunded). \* voided - When the Credit Note has been cancelled. + + */ + + cn_status:'refund_due' | 'adjusted' | 'refunded' | 'voided'; } export interface LinkedOrder { - id?:string; + /** + * @description Uniquely identifies the order. It is the api identifier for the order + + */ + + id:string; + + /** + * @description The order's serial number + + */ document_number?:string; + /** + * @description The status of this order. \* awaiting_shipment - The order has been picked up by an integration system, and synced to a shipping management platform \* new - Order has been created. Applicable only if you are using Chargebee's legacy order management system. \* shipped - The order has moved from order management system to a shipping system. \* on_hold - The order is paused from being processed. \* queued - Order is yet to be processed by any system, these are scheduled orders created by Chargebee \* returned - The order has been returned after delivery. \* complete - Order has been processed successfully. Applicable only if you are using Chargebee's legacy order management system \* cancelled - Order has been cancelled. Applicable only if you are using Chargebee's legacy order management system \* delivered - The order has been delivered to the customer. \* partially_delivered - The order has been partially delivered to the customer. \* voided - Order has been voided. Applicable only if you are using Chargebee's legacy order management system \* processing - Order is being processed. Applicable only if you are using Chargebee's legacy order management system + + */ + status?:'new' | 'partially_delivered' | 'queued' | 'delivered' | 'on_hold' | 'shipped' | 'processing' | 'cancelled' | 'voided' | 'complete' | 'awaiting_shipment' | 'returned'; + /** + * @description Order type \* manual - The order has been created by the the user using Chargebee's legacy order management system. \* system_generated - The order has been created by Chargebee automatically based on the preferences set by the user. + + */ + order_type?:'system_generated' | 'manual'; + /** + * @description Reference id can be used to map the orders in the shipping/order management application to the orders in ChargeBee. The reference_id generally is same as the order id in the third party application. + + */ + reference_id?:string; + /** + * @description The fulfillment status of an order as reflected in the shipping/order management application. Typical statuses include Shipped,Awaiting Shipment,Not fulfilled etc; + + */ + fulfillment_status?:string; + /** + * @description Unique id to identify a group of orders. + + */ + batch_id?:string; - created_at?:number; + /** + * @description The time at which the order was created + + */ + + created_at:number; } export interface Note { - entity_type?:'addon_item_price' | 'coupon' | 'plan_item_price' | 'charge_item_price' | 'tax' | 'subscription' | 'customer'; + /** + * @description Type of entity to which the note belongs. \* subscription - Entity that represents a subscription of customer. \* plan_item_price - Indicates that this line item is based on plan Item Price \* customer - Entity that represents a customer. \* plan - Entity that represents a plan. \* coupon - Entity that represents a coupon. \* tax - The note is configured as part of the [tax configuration](https://www.chargebee.com/docs/tax.html) in Chargebee Billing. \* addon_item_price - Indicates that this line item is based on addon Item Price \* charge_item_price - Indicates that this line item is based on charge Item Price \* addon - Entity that represents an addon. + + */ + + entity_type:'addon_item_price' | 'coupon' | 'plan_item_price' | 'charge_item_price' | 'tax' | 'subscription' | 'customer'; + + /** + * @description Actual note. + + */ - note?:string; + note:string; + + /** + * @description Unique identifier of the entity. + + */ entity_id?:string; } @@ -2263,7 +2813,14 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - index?:number; + index:number; + } + export interface StatementDescriptor { + id:string; + + descriptor?:string; + + additional_info?:string; } export interface BillingAddress { /** @@ -2377,7 +2934,7 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - id?:string; + id:string; /** * @description This attribute is used to populate the unique reference number assigned to an invoice on the Invoice Registration Portal (IRP) network. It is essential for identifying and tracking invoices that are processed through the IRP network. In the future, this field may be used to store similar reference numbers for other networks. @@ -2391,7 +2948,7 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - status?:'in_progress' | 'scheduled' | 'success' | 'registered' | 'failed' | 'skipped'; + status:'in_progress' | 'scheduled' | 'success' | 'registered' | 'failed' | 'skipped'; /** * @description Detailed information about the status of the e-invoice. When `status` is `skipped` or `failed`, this contains the reason or error details. The following are some valid examples: @@ -2404,14 +2961,39 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 message?:string; } export interface LinkedTaxWithheld { - id?:string; + /** + * @description An auto-generated unique identifier for the tax withheld. The value starts with the prefix `tax_wh_`. For example, `tax_wh_16BdDXSlbu4uV1Ee6`. + + */ + + id:string; + + /** + * @description The amount withheld by the customer as tax from the invoice. The unit depends on the [type of currency](/docs/api#md_disabled). + + */ amount?:number; + /** + * @description The description for this tax withheld. + + */ + description?:string; + /** + * @description Date or time associated with the tax withheld. + + */ + date?:number; + /** + * @description A unique external reference number for the tax withheld. Typically, this is the reference number used by the system you are integrating the API with. Depending on your integration, this could be the reference number issued by the taxation authority to identify the customer or the specific tax transaction. + + */ + reference_number?:string; } } diff --git a/types/resources/Item.d.ts b/types/resources/Item.d.ts index 2a63ffc..bf37c36 100644 --- a/types/resources/Item.d.ts +++ b/types/resources/Item.d.ts @@ -166,7 +166,7 @@ In-App Subscriptions is currently in early access. Contact [eap@chargebee.com](m channel?:Channel; /** - * @description A set of key-value pairs stored as additional information for the item. [Learn more](./#meta_data). + * @description A collection of key-value pairs that provides extra information about the item. [Learn more](advanced-features#metadata). */ @@ -183,13 +183,6 @@ Other details of attaching items can be specified using the [Create](./attached_ } export namespace Item { export class ItemResource { - /** - * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. - - */ - - list(input?:ListInputParam):ChargebeeRequest; - /** * @description Creates a new item. @@ -197,13 +190,6 @@ Other details of attaching items can be specified using the [Create](./attached_ create(input:CreateInputParam):ChargebeeRequest; - /** - * @description Deletes an item, marking its `status` as deleted. This is not allowed if there are `active` or `archived` item prices under the item. Once deleted, the id and name of the item can be reused. - - */ - - delete(item_id:string):ChargebeeRequest; - /** * @description Retrieve an item resource. @@ -217,136 +203,20 @@ Other details of attaching items can be specified using the [Create](./attached_ */ update(item_id:string, input?:UpdateInputParam):ChargebeeRequest; - } - export interface ListResponse { - /** - * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. - - */ - - list:{item:Item}[]; /** * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. */ - - next_offset?:string; - } - export interface ListInputParam { - [key : string]: any; - /** - * @description The number of resources to be returned. - - */ - - limit?:number; - - /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. - - */ - - offset?:string; - - /** - * @description Filter items based on item id. - - */ - - id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; - - /** - * @description Filter items based on `item_family_id`. - - */ - - item_family_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; - - /** - * @description Filter items based on item `type`. - - */ - - type?:{in?:string,is?:'charge' | 'addon' | 'plan',is_not?:'charge' | 'addon' | 'plan',not_in?:string}; - - /** - * @description Filter items based on item `name`. - - */ - - name?:{is?:string,is_not?:string,starts_with?:string}; - - /** - * @description Filter items based on `item_applicability`. - - */ - - item_applicability?:{in?:string,is?:'all' | 'restricted',is_not?:'all' | 'restricted',not_in?:string}; - - /** - * @description Filter items based on item `status`. - - */ - - status?:{in?:string,is?:'archived' | 'deleted' | 'active',is_not?:'archived' | 'deleted' | 'active',not_in?:string}; - - /** - * @description Specifies if gift subscriptions can be created for this item. - - */ - - is_giftable?:{is?:'true' | 'false'}; - - /** - * @description Filter items based on when the items were last updated. - - */ - - updated_at?:{after?:string,before?:string,between?:string,on?:string}; - - /** - * @description Allow the plan to subscribed to via Checkout. Applies only for plan-items. -**Note:** Only the in-app version of Checkout is supported for Product Catalog v2. - - */ - - enabled_for_checkout?:{is?:'true' | 'false'}; - - /** - * @description Allow customers to change their subscription to this plan via the [Self-Serve Portal](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html). Applies only for plan-items. This requires the Portal configuration to [allow changing subscriptions](https://www.chargebee.com/docs/2.0/inapp-self-serve-portal.html#allow-change-subscription). - - */ - - enabled_in_portal?:{is?:'true' | 'false'}; - - /** - * @description Specifies whether the item undergoes metered billing. When `true`, the quantity is calculated from [usage records](/docs/api/usages?prod_cat_ver=2). When `false`, the `quantity` is as determined while adding an item price to the subscription. Applicable only for items of `type` `plan` or `addon` and when [Metered Billing](https://www.chargebee.com/docs/2.0/metered_billing.html) is enabled. The value of this attribute cannot be changed. - - */ - - metered?:{is?:'true' | 'false'}; - - /** - * @description How the quantity is calculated from usage data for the item prices belonging to this item. Only applicable when the item is `metered`. This value overrides the one [set at the site level](https://www.chargebee.com/docs/2.0/metered_billing.html#configuring-metered-billing). - - */ - - usage_calculation?:{in?:string,is?:'max_usage' | 'sum_of_usages' | 'last_usage',is_not?:'max_usage' | 'sum_of_usages' | 'last_usage',not_in?:string}; - - /** - * @description The subscription channel this object originated from and is maintained in. - - */ - - channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string}; + + list(input?:ListInputParam):ChargebeeRequest; /** - * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + * @description Deletes an item, marking its `status` as deleted. This is not allowed if there are `active` or `archived` item prices under the item. Once deleted, the id and name of the item can be reused. */ - - sort_by?:{asc?:'updated_at' | 'name' | 'id',desc?:'updated_at' | 'name' | 'id'}; + + delete(item_id:string):ChargebeeRequest; } export interface CreateResponse { item:Item; @@ -487,16 +357,14 @@ Other details of attaching items can be specified using the [Create](./attached_ usage_calculation?:'max_usage' | 'sum_of_usages' | 'last_usage'; /** - * @description A set of key-value pairs stored as additional information for the item. [Learn more](./#meta_data). + * @description A collection of key-value pairs that provides extra information about the item. +**Note:** There's a character limit of 65,535. +[Learn more](advanced-features#metadata). */ metadata?:object; } - export interface DeleteResponse { - item:Item; - } - export interface RetrieveResponse { item:Item; } @@ -598,7 +466,7 @@ Other details of attaching items can be specified using the [Create](./attached_ gift_claim_redirect_url?:string; /** - * @description A set of key-value pairs stored as additional information for the item. [Learn more](./#meta_data). + * @description A collection of key-value pairs that provides extra information about the item. [Learn more](advanced-features#metadata). */ @@ -618,7 +486,145 @@ Other details of attaching items can be specified using the [Create](./attached_ status?:'archived' | 'active'; } + export interface ListResponse { + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + list:{item:Item}[]; + + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + next_offset?:string; + } + export interface ListInputParam { + [key : string]: any; + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + limit?:number; + + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + offset?:string; + + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + item_family_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + type?:{in?:string,is?:'charge' | 'addon' | 'plan',is_not?:'charge' | 'addon' | 'plan',not_in?:string}; + + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + name?:{is?:string,is_not?:string,starts_with?:string}; + + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + item_applicability?:{in?:string,is?:'all' | 'restricted',is_not?:'all' | 'restricted',not_in?:string}; + + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + status?:{in?:string,is?:'archived' | 'deleted' | 'active',is_not?:'archived' | 'deleted' | 'active',not_in?:string}; + + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + is_giftable?:{is?:'true' | 'false'}; + + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + updated_at?:{after?:string,before?:string,between?:string,on?:string}; + + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + enabled_for_checkout?:{is?:'true' | 'false'}; + + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + enabled_in_portal?:{is?:'true' | 'false'}; + + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + metered?:{is?:'true' | 'false'}; + + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + usage_calculation?:{in?:string,is?:'max_usage' | 'sum_of_usages' | 'last_usage',is_not?:'max_usage' | 'sum_of_usages' | 'last_usage',not_in?:string}; + + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string}; + + /** + * @description Returns a list of items satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. + + */ + + sort_by?:{asc?:'updated_at' | 'name' | 'id',desc?:'updated_at' | 'name' | 'id'}; + } + export interface DeleteResponse { + item:Item; + } + export interface ApplicableItem { + /** + * @description Id of the addon-item or plan-item that can be applied to the plan-item. + + */ + id?:string; } } diff --git a/types/resources/ItemEntitlement.d.ts b/types/resources/ItemEntitlement.d.ts index 8d9b2b3..1e846b4 100644 --- a/types/resources/ItemEntitlement.d.ts +++ b/types/resources/ItemEntitlement.d.ts @@ -70,25 +70,25 @@ declare module 'chargebee' { export namespace ItemEntitlement { export class ItemEntitlementResource { /** - * @description Retrieves a list of all the `item_entitlement`s for the `feature` specified. + * @description Retrieves a list of all the `item_entitlements` for the `item` specified. */ - item_entitlements_for_feature(feature_id:string, input?:ItemEntitlementsForFeatureInputParam):ChargebeeRequest; + item_entitlements_for_item(item_id:string, input?:ItemEntitlementsForItemInputParam):ChargebeeRequest; /** - * @description Upserts or removes a set of `item_entitlement`s for an `feature` depending on the `action` specified. The API returns the upserted or deleted `item_entitlements` after successfully completing the operation. The operation returns an error when the first `item_entitlement` fails to be processed. Either all the `item_entitlement`s provided in the request are processed or none. + * @description Retrieves a list of all the `item_entitlement`s for the `feature` specified. */ - add_item_entitlements(feature_id:string, input:AddItemEntitlementsInputParam):ChargebeeRequest; + item_entitlements_for_feature(feature_id:string, input?:ItemEntitlementsForFeatureInputParam):ChargebeeRequest; /** - * @description Retrieves a list of all the `item_entitlements` for the `item` specified. + * @description Upserts or removes a set of `item_entitlement`s for an `feature` depending on the `action` specified. The API returns the upserted or deleted `item_entitlements` after successfully completing the operation. The operation returns an error when the first `item_entitlement` fails to be processed. Either all the `item_entitlement`s provided in the request are processed or none. */ - item_entitlements_for_item(item_id:string, input?:ItemEntitlementsForItemInputParam):ChargebeeRequest; + add_item_entitlements(feature_id:string, input:AddItemEntitlementsInputParam):ChargebeeRequest; /** * @description Upserts or removes a set of `item_entitlements` for an [item](items?prod_cat_ver=2) depending on the `action` specified. The API returns the upserted or deleted `item_entitlements` after successfully completing the operation. The operation returns an error when the first `item_entitlement` fails to be processed. Either all the `item_entitlement`s provided in the request are processed or none. @@ -97,86 +97,86 @@ declare module 'chargebee' { upsert_or_remove_item_entitlements_for_item(item_id:string, input:UpsertOrRemoveItemEntitlementsForItemInputParam):ChargebeeRequest; } - export interface ItemEntitlementsForFeatureResponse { + export interface ItemEntitlementsForItemResponse { /** - * @description Retrieves a list of all the `item_entitlement`s for the `feature` specified. + * @description Retrieves a list of all the `item_entitlements` for the `item` specified. */ list:{item_entitlement:ItemEntitlement}[]; /** - * @description Retrieves a list of all the `item_entitlement`s for the `feature` specified. + * @description Retrieves a list of all the `item_entitlements` for the `item` specified. */ next_offset?:string; } - export interface ItemEntitlementsForFeatureInputParam { + export interface ItemEntitlementsForItemInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description Retrieves a list of all the `item_entitlements` for the `item` specified. */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Retrieves a list of all the `item_entitlements` for the `item` specified. */ offset?:string; } - export interface AddItemEntitlementsResponse { - item_entitlement:ItemEntitlement; - } - export interface AddItemEntitlementsInputParam { - + export interface ItemEntitlementsForFeatureResponse { /** - * @description The specific action to be performed for each `item_entitlement` specified. \* remove - Deletes the `item_entitlement` for the `feature_id` and `item_id` combination, if it exists. \* upsert - If the `item_entitlement` already exists for the `feature_id` and `item_id` combination, the `value` of the `item_entitlement` is updated. If it doesn't exist, a new `item_entitelment` is created. + * @description Retrieves a list of all the `item_entitlement`s for the `feature` specified. */ - action:Action; + list:{item_entitlement:ItemEntitlement}[]; /** - * @description Parameters for item_entitlements + * @description Retrieves a list of all the `item_entitlement`s for the `feature` specified. */ - item_entitlements?:{item_id:string,item_type?:'item' | 'charge' | 'addon' | 'subscription' | 'plan',value?:string}[]; + next_offset?:string; } - export interface ItemEntitlementsForItemResponse { + export interface ItemEntitlementsForFeatureInputParam { + [key : string]: any; /** - * @description Retrieves a list of all the `item_entitlements` for the `item` specified. + * @description Retrieves a list of all the `item_entitlement`s for the `feature` specified. */ - - list:{item_entitlement:ItemEntitlement}[]; + + limit?:number; /** - * @description Retrieves a list of all the `item_entitlements` for the `item` specified. + * @description Retrieves a list of all the `item_entitlement`s for the `feature` specified. */ - - next_offset?:string; + + offset?:string; } - export interface ItemEntitlementsForItemInputParam { - [key : string]: any; + export interface AddItemEntitlementsResponse { + item_entitlement:ItemEntitlement; + } + export interface AddItemEntitlementsInputParam { + /** - * @description The number of resources to be returned. + * @description The specific action to be performed for each `item_entitlement` specified. \* remove - Deletes the `item_entitlement` for the `feature_id` and `item_id` combination, if it exists. \* upsert - If the `item_entitlement` already exists for the `feature_id` and `item_id` combination, the `value` of the `item_entitlement` is updated. If it doesn't exist, a new `item_entitelment` is created. */ - - limit?:number; + + action:Action; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Parameters for item_entitlements */ - - offset?:string; + + item_entitlements?:{item_id:string,item_type?:'item' | 'charge' | 'addon' | 'subscription' | 'plan',value?:string}[]; } export interface UpsertOrRemoveItemEntitlementsForItemResponse { item_entitlement:ItemEntitlement; diff --git a/types/resources/ItemFamily.d.ts b/types/resources/ItemFamily.d.ts index 5df70ef..286fbee 100644 --- a/types/resources/ItemFamily.d.ts +++ b/types/resources/ItemFamily.d.ts @@ -54,11 +54,18 @@ declare module 'chargebee' { export namespace ItemFamily { export class ItemFamilyResource { /** - * @description Deletes an item family, marking its `status` as `deleted`. This is not allowed if there are `active` items under the item family. Once deleted, the `id` and `name` of the item family can be reused to create a new item family. + * @description This endpoint creates an item family for your product line or service. */ - delete(item_family_id:string):ChargebeeRequest; + create(input:CreateInputParam):ChargebeeRequest; + + /** + * @description This endpoint retrieves an item family based on the item family id. + + */ + + retrieve(item_family_id:string):ChargebeeRequest; /** * @description Returns a list of item families satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. @@ -68,27 +75,46 @@ declare module 'chargebee' { list(input?:ListInputParam):ChargebeeRequest; /** - * @description This endpoint creates an item family for your product line or service. + * @description This endpoint updates the name and/or description of the item family. */ - create(input:CreateInputParam):ChargebeeRequest; + update(item_family_id:string, input?:UpdateInputParam):ChargebeeRequest; /** - * @description This endpoint retrieves an item family based on the item family id. + * @description Deletes an item family, marking its `status` as `deleted`. This is not allowed if there are `active` items under the item family. Once deleted, the `id` and `name` of the item family can be reused to create a new item family. */ - retrieve(item_family_id:string):ChargebeeRequest; + delete(item_family_id:string):ChargebeeRequest; + } + export interface CreateResponse { + item_family:ItemFamily; + } + export interface CreateInputParam { + [key : string] : any; + /** + * @description The identifier for the item family. Must be unique and is immutable. + + */ + + id:string; /** - * @description This endpoint updates the name and/or description of the item family. + * @description The display name for the item family. Must be unique. This is visible only in Chargebee and not to customers. */ - - update(item_family_id:string, input?:UpdateInputParam):ChargebeeRequest; + + name:string; + + /** + * @description Description of the item family. This is visible only in Chargebee and not to customers. + + */ + + description?:string; } - export interface DeleteResponse { + export interface RetrieveResponse { item_family:ItemFamily; } @@ -110,70 +136,40 @@ declare module 'chargebee' { export interface ListInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description Returns a list of item families satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Returns a list of item families satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. */ offset?:string; /** - * @description The identifier for the item family. It is unique and immutable. + * @description Returns a list of item families satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. */ id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description A unique display name for the item family. This is visible only in Chargebee and not to customers. + * @description Returns a list of item families satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. */ name?:{is?:string,is_not?:string,starts_with?:string}; /** - * @description When the item family was last updated. + * @description Returns a list of item families satisfying **all** the conditions specified in the filter parameters below. The list is sorted by date of creation, in descending order. */ updated_at?:{after?:string,before?:string,between?:string,on?:string}; } - export interface CreateResponse { - item_family:ItemFamily; - } - export interface CreateInputParam { - [key : string] : any; - /** - * @description The identifier for the item family. Must be unique and is immutable. - - */ - - id:string; - - /** - * @description The display name for the item family. Must be unique. This is visible only in Chargebee and not to customers. - - */ - - name:string; - - /** - * @description Description of the item family. This is visible only in Chargebee and not to customers. - - */ - - description?:string; - } - export interface RetrieveResponse { - item_family:ItemFamily; - } - export interface UpdateResponse { item_family:ItemFamily; } @@ -193,6 +189,10 @@ declare module 'chargebee' { description?:string; } + export interface DeleteResponse { + item_family:ItemFamily; + } + } } \ No newline at end of file diff --git a/types/resources/ItemPrice.d.ts b/types/resources/ItemPrice.d.ts index 4e68316..bc078ef 100644 --- a/types/resources/ItemPrice.d.ts +++ b/types/resources/ItemPrice.d.ts @@ -23,6 +23,11 @@ declare module 'chargebee' { item_family_id?:string; + /** + * @description Identifier of the product + + */ + product_id?:string; /** @@ -33,7 +38,9 @@ declare module 'chargebee' { item_id?:string; /** - * @description Description of the item price. + * @description Description of the item price. +**Note:** +If your input contains characters that are subjected to sanitization (like incomplete HTML tags), the sanitization process might increase the length of your input. If the sanitized input exceeds the limit, your request will be rejected. */ @@ -218,7 +225,7 @@ In-App Subscriptions is currently in early access. Contact [eap@chargebee.com](m is_taxable?:boolean; /** - * @description A set of key-value pairs stored as additional information for the item price. [Learn more](./#meta_data). + * @description A collection of key-value pairs that provides extra information about the item price. [Learn more](advanced-features#metadata). */ @@ -269,11 +276,11 @@ In-App Subscriptions is currently in early access. Contact [eap@chargebee.com](m export namespace ItemPrice { export class ItemPriceResource { /** - * @description Returns the set of all applicable [addon-items](items?prod_cat_ver=2#addon-items) for a specific [plan-item price](item_prices?prod_cat_ver=2#types). This set consists of all addon-items whose item prices can be applied to a subscription having the plan-item price in it. When determining this set, Chargebee considers the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price. + * @description This API creates an item price (a price point) for an [item](./items?prod_cat_ver=2). */ - find_applicable_items(item_price_id:string, input?:FindApplicableItemsInputParam):ChargebeeRequest; + create(input:CreateInputParam):ChargebeeRequest; /** * @description This API retrieves a specific item price using the id. @@ -289,6 +296,13 @@ In-App Subscriptions is currently in early access. Contact [eap@chargebee.com](m update(item_price_id:string, input?:UpdateInputParam):ChargebeeRequest; + /** + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. + + */ + + list(input?:ListInputParam):ChargebeeRequest; + /** * @description Deletes an item price, marking its `status` as `deleted`. If it is part of a subscription or invoice, the item price `status` is marked `archived` instead. Once deleted, the `id` and `name` of the item price can be reused to create a new item price. @@ -296,6 +310,13 @@ In-App Subscriptions is currently in early access. Contact [eap@chargebee.com](m delete(item_price_id:string):ChargebeeRequest; + /** + * @description Returns the set of all applicable [addon-items](items?prod_cat_ver=2#addon-items) for a specific [plan-item price](item_prices?prod_cat_ver=2#types). This set consists of all addon-items whose item prices can be applied to a subscription having the plan-item price in it. When determining this set, Chargebee considers the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price. + + */ + + find_applicable_items(item_price_id:string, input?:FindApplicableItemsInputParam):ChargebeeRequest; + /** * @description Returns the set of all applicable [addon-item](item_prices?prod_cat_ver=2#types) prices for a specific plan-item price. This set consists of all the addon-item prices that can be applied to a subscription having the plan-item price. When determining this set, Chargebee considers the following: @@ -309,58 +330,219 @@ If an addon-item price has [differential pricing](differential_prices?prod_cat_v */ find_applicable_item_prices(item_price_id:string, input?:FindApplicableItemPricesInputParam):ChargebeeRequest; + } + export interface CreateResponse { + item_price:ItemPrice; + } + export interface CreateInputParam { + [key : string] : any; + /** + * @description The identifier for the item price. It is unique and immutable. + + */ + + id:string; /** - * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. + * @description A unique display name for the item price in the Chargebee UI. If `external_name` is not provided, this is also used in customer-facing pages and documents such as [invoices](./invoices?prod_cat_ver=2) and [hosted pages](hosted_pages?prod_cat_ver=2). */ - - list(input?:ListInputParam):ChargebeeRequest; + + name:string; /** - * @description This API creates an item price (a price point) for an [item](./items?prod_cat_ver=2). + * @description Description of the item price. +**Note:** +If your input contains characters that are subjected to sanitization (like incomplete HTML tags), the sanitization process might increase the length of your input. If the sanitized input exceeds the limit, your request will be rejected. */ - - create(input:CreateInputParam):ChargebeeRequest; - } - export interface FindApplicableItemsResponse { + + description?:string; + /** - * @description Returns the set of all applicable [addon-items](items?prod_cat_ver=2#addon-items) for a specific [plan-item price](item_prices?prod_cat_ver=2#types). This set consists of all addon-items whose item prices can be applied to a subscription having the plan-item price in it. When determining this set, Chargebee considers the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price. + * @description The id of the item that the item price belongs to. */ - list:{item:Item}[]; + item_id:string; /** - * @description Returns the set of all applicable [addon-items](items?prod_cat_ver=2#addon-items) for a specific [plan-item price](item_prices?prod_cat_ver=2#types). This set consists of all addon-items whose item prices can be applied to a subscription having the plan-item price in it. When determining this set, Chargebee considers the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price. + * @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. */ - next_offset?:string; - } - export interface FindApplicableItemsInputParam { - [key : string]: any; + invoice_notes?:string; + /** - * @description The number of resources to be returned. + * @description The name of the item price used in customer-facing pages and documents. These include [invoices](./invoices?prod_cat_ver=2) and [hosted pages](hosted_pages?prod_cat_ver=2). If not provided, then `name` is used. */ - - limit?:number; + + external_name?:string; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description The currency code ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html)) for the item price. Is required when multiple currencies have been enabled. */ - - offset?:string; + + currency_code?:string; /** - * @description Returns the set of all applicable [addon-items](items?prod_cat_ver=2#addon-items) for a specific [plan-item price](item_prices?prod_cat_ver=2#types). This set consists of all addon-items whose item prices can be applied to a subscription having the plan-item price in it. When determining this set, Chargebee considers the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price. + * @description Specifies whether taxes apply to this item price. This value is set and returned even if [Taxes](https://www.chargebee.com/docs/tax.html) have been disabled in Chargebee. However, the value is effective only while Taxes are enabled. */ - - sort_by?:{asc?:'updated_at' | 'name' | 'id',desc?:'updated_at' | 'name' | 'id'}; + + is_taxable?:boolean; + + /** + * @description Free quantity the subscriptions of this item_price will have. Only the quantity more than this will be charged for the subscription. + + */ + + free_quantity?:number; + + /** + * @description The quantity of the item that is available free-of-charge, represented in decimal. When a subscription is created for this plan or when the plan of a subscription is changed to this one, only the quantity above this number is charged for. Applicable for quantity-based plans and only when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + + free_quantity_in_decimal?:string; + + /** + * @description A collection of key-value pairs that provides extra information about the item price. +**Note:** There's a character limit of 65,535. +[Learn more](advanced-features#metadata). + + */ + + metadata?:object; + + /** + * @description Whether the item price's description should be shown on [invoice PDFs](/docs/api/invoices#retrieve_invoice_as_pdf). If this Boolean is changed, only invoices generated (or [regenerated](https://www.chargebee.com/docs/invoice-operations.html#actions-for-payment-due-not-paid-invoices_regenerate-invoice)) after the change are affected; past invoices are not. + + */ + + show_description_in_invoices?:boolean; + + /** + * @description Whether the item price's description should be shown on [quote PDFs](/docs/api/quotes#retrieve_quote_as_pdf). If this Boolean is changed, only quotes created after the change are affected; past quotes are not. + + */ + + show_description_in_quotes?:boolean; + + /** + * @description The [pricing scheme](https://www.chargebee.com/docs/2.0/plans.html#pricing-models) for this item price. If subscriptions, invoices or [differential prices](./differential_prices?prod_cat_ver=2) exist for this item price, `pricing_model` cannot be changed. +\* tiered - The per unit price is based on the tier that the total quantity falls in. +\* per_unit - A fixed price per unit quantity. +\* flat_fee - A fixed price that is not quantity-based. +\* volume - There are quantity tiers for which per unit prices are set. Quantities are purchased from successive tiers. +\* stairstep - A quantity-based pricing scheme. The item is charged a fixed price based on the tier that the total quantity falls in. + + */ + + pricing_model?:PricingModel; + + /** + * @description The cost of the item price when the pricing model is `flat_fee`. When the pricing model is `per_unit`, it is the price per unit quantity of the item. Not applicable for the other pricing models. The value is in the [minor unit of the currency](https://apidocs.chargebee.com/docs/api#handling_currency_units). + + */ + + price?:number; + + /** + * @description The price of the item when the pricing_model is `flat_fee`. When the pricing model is `per_unit`, it is the price per unit quantity of the item. Not applicable for the other pricing models. The value is in decimal and in major units of the currency. Also, this is only applicable when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + + price_in_decimal?:string; + + /** + * @description The unit of time for `period`. If subscriptions or invoices exist for this item price, `period_unit` cannot be changed. The `period_unit` is mandatory when the item `type` is `plan` or `addon`. \* 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. + + */ + + period_unit?:'week' | 'month' | 'year' | 'day'; + + /** + * @description + +* When the item `type` is `plan`: The billing period of the plan in `period_unit`s. For example, create a 6 month plan by providing `period` as 6 and `period_unit` as month. +* When item `type` is `addon`: The period of the addon in `period_unit`s. For example, create an addon with a 2 month `period` by providing period as 2 and `period_unit` as `month`. The period of an addon is the duration for which its `price` applies. When attached to a plan, the addon is billed for the billing period of the plan. [Learn more.](https://www.chargebee.com/docs/2.0/addons-billingcycle.html) + + + +If subscriptions or invoices exist for this item price, `period` cannot be changed. The `period` is mandatory when the item `type` is `plan` or `addon`. + + */ + + period?:number; + + /** + * @description The unit of time for `trial_period`. \* month - A period of 1 calendar month. \* day - A period of 24 hours. + + */ + + trial_period_unit?:'month' | 'day'; + + /** + * @description The trial period of the plan in `trial_period_unit`s. You can also set [trial periods for addons](https://www.chargebee.com/docs/2.0/addons-trial.html); contact [Support](https://chargebee.freshdesk.com/support/home) to enable that feature. + + */ + + trial_period?:number; + + /** + * @description Defines the shipping frequency. Example: to bill customer every 2 weeks, provide "2" here. + + */ + + shipping_period?:number; + + /** + * @description Defines the shipping frequency in association with shipping period. \* day - A period of 24 hours. \* week - A period of 7 days. \* year - A period of 1 calendar year. \* month - A period of 1 calendar month. + + */ + + shipping_period_unit?:'week' | 'month' | 'year' | 'day'; + + /** + * @description The default number of billing cycles a subscription to the plan must run. Can be [overridden](./subscriptions?prod_cat_ver=2) for a subscription. + +Addons can also [have billing cycles](https://www.chargebee.com/docs/2.0/addons-billingcycle.html). However, you must contact [Support](https://chargebee.freshdesk.com/support/home) to enable that. Also, for addons, you can [override this](./attached_items?prod_cat_ver=2) while attaching it to a plan. However, if you provide the value while [applying the addon to a subscription](./subscriptions?prod_cat_ver=2#subscription_subscription_items_item_type), then that value takes still higher precedence. +If subscriptions, invoices or [differential prices](./differential_prices?prod_cat_ver=2) exist for this item price, `billing_cycles` cannot be changed. + + */ + + billing_cycles?:number; + + /** + * @description Applicable only when [End-of-trial Action](https://www.chargebee.com/docs/trial_periods.html#how-to-define-the-end-of-trial-actions-for-subscriptions) has been enabled for the site. Specifies the operation to be carried out for the subscription once the trial ends. Whenever the `item.type` is `plan` and a trial period is defined for this item price, this attribute (parameter) is returned (required). This can be overridden at the [subscription-level](subscriptions?prod_cat_ver=2#subscription_trial_end_action). \* cancel_subscription - The subscription cancels. \* activate_subscription - The subscription activates and charges are raised for non-metered items. \* site_default - The action [configured for the site](https://www.chargebee.com/docs/trial_periods.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect. + + */ + + trial_end_action?:'activate_subscription' | 'cancel_subscription' | 'site_default'; + + /** + * @description Parameters for tax_detail + + */ + + tax_detail?:{avalara_sale_type?:AvalaraSaleType,avalara_service_type?:number,avalara_tax_code?:string,avalara_transaction_type?:number,hsn_code?:string,tax_profile_id?:string,taxjar_product_code?:string}; + + /** + * @description Parameters for accounting_detail + + */ + + accounting_detail?:{accounting_category1?:string,accounting_category2?:string,accounting_category3?:string,accounting_category4?:string,accounting_code?:string,sku?:string}; + + /** + * @description Parameters for tiers + + */ + + tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; } export interface RetrieveResponse { item_price:ItemPrice; @@ -379,7 +561,9 @@ If an addon-item price has [differential pricing](differential_prices?prod_cat_v name?:string; /** - * @description Description of the item price. + * @description Description of the item price. +**Note:** +If your input contains characters that are subjected to sanitization (like incomplete HTML tags), the sanitization process might increase the length of your input. If the sanitized input exceeds the limit, your request will be rejected. */ @@ -435,7 +619,9 @@ If an addon-item price has [differential pricing](differential_prices?prod_cat_v free_quantity_in_decimal?:string; /** - * @description A set of key-value pairs stored as additional information for the item price. [Learn more](./#meta_data). + * @description A collection of key-value pairs that provides extra information about the item price. +**Note:** There's a character limit of 65,535. +[Learn more](advanced-features#metadata). */ @@ -568,207 +754,130 @@ If subscriptions, invoices or [differential prices](./differential_prices?prod_c tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; } - export interface DeleteResponse { - item_price:ItemPrice; - } - - export interface FindApplicableItemPricesResponse { + export interface ListResponse { /** - * @description Returns the set of all applicable [addon-item](item_prices?prod_cat_ver=2#types) prices for a specific plan-item price. This set consists of all the addon-item prices that can be applied to a subscription having the plan-item price. When determining this set, Chargebee considers the following: - -* the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price -* the [compatibility](subscriptions?prod_cat_ver=2#compatibility) of the addon-item prices to the plan-item price - -**Note** - -If an addon-item price has [differential pricing](differential_prices?prod_cat_ver=2) defined against the parent item of the plan-item price, then the pricing information in the addon-item price object returned, reflects the differential pricing. + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ list:{item_price:ItemPrice}[]; /** - * @description Returns the set of all applicable [addon-item](item_prices?prod_cat_ver=2#types) prices for a specific plan-item price. This set consists of all the addon-item prices that can be applied to a subscription having the plan-item price. When determining this set, Chargebee considers the following: - -* the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price -* the [compatibility](subscriptions?prod_cat_ver=2#compatibility) of the addon-item prices to the plan-item price - -**Note** - -If an addon-item price has [differential pricing](differential_prices?prod_cat_ver=2) defined against the parent item of the plan-item price, then the pricing information in the addon-item price object returned, reflects the differential pricing. + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ next_offset?:string; } - export interface FindApplicableItemPricesInputParam { + export interface ListInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ offset?:string; /** - * @description Returns the set of all applicable [addon-item](item_prices?prod_cat_ver=2#types) prices for a specific plan-item price. This set consists of all the addon-item prices that can be applied to a subscription having the plan-item price. When determining this set, Chargebee considers the following: - -* the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price -* the [compatibility](subscriptions?prod_cat_ver=2#compatibility) of the addon-item prices to the plan-item price - -**Note** - -If an addon-item price has [differential pricing](differential_prices?prod_cat_ver=2) defined against the parent item of the plan-item price, then the pricing information in the addon-item price object returned, reflects the differential pricing. - - */ - - item_id?:string; - - /** - * @description Returns the set of all applicable [addon-item](item_prices?prod_cat_ver=2#types) prices for a specific plan-item price. This set consists of all the addon-item prices that can be applied to a subscription having the plan-item price. When determining this set, Chargebee considers the following: - -* the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price -* the [compatibility](subscriptions?prod_cat_ver=2#compatibility) of the addon-item prices to the plan-item price - -**Note** - -If an addon-item price has [differential pricing](differential_prices?prod_cat_ver=2) defined against the parent item of the plan-item price, then the pricing information in the addon-item price object returned, reflects the differential pricing. - - */ - - sort_by?:{asc?:'updated_at' | 'name' | 'id',desc?:'updated_at' | 'name' | 'id'}; - } - export interface ListResponse { - /** - * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. - - */ - - list:{item_price:ItemPrice}[]; - - /** - * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. - - */ - - next_offset?:string; - } - export interface ListInputParam { - [key : string]: any; - /** - * @description The number of resources to be returned. - - */ - - limit?:number; - - /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. - - */ - - offset?:string; - - /** - * @description Filter item prices based on their [id](#). + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Filter item prices based on their `name`s. + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ name?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Filter item prices based on their `pricing_model`. + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ pricing_model?:{in?:string,is?:'volume' | 'per_unit' | 'tiered' | 'flat_fee' | 'stairstep',is_not?:'volume' | 'per_unit' | 'tiered' | 'flat_fee' | 'stairstep',not_in?:string}; /** - * @description Filter item prices based on their `item_id`. + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Filter item prices based on `item_family_id`. + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ item_family_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Filter item prices based on `item_type`. + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ item_type?:{in?:string,is?:'charge' | 'addon' | 'plan',is_not?:'charge' | 'addon' | 'plan',not_in?:string}; /** - * @description Filter item prices based on their `currency_code`. + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ currency_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Filter item prices based on their `trial_period`. + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ trial_period?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; /** - * @description Filter item prices based on their `trial_period_unit`. + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ trial_period_unit?:{in?:string,is?:'month' | 'day',is_not?:'month' | 'day',not_in?:string}; /** - * @description Filter item prices based on their `status`. + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ status?:{in?:string,is?:'archived' | 'deleted' | 'active',is_not?:'archived' | 'deleted' | 'active',not_in?:string}; /** - * @description Filter item prices based on their `updated_at`. + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ updated_at?:{after?:string,before?:string,between?:string,on?:string}; /** - * @description Filter item prices based on their `period_unit`. + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ period_unit?:{in?:string,is?:'week' | 'month' | 'year' | 'day',is_not?:'week' | 'month' | 'year' | 'day',not_in?:string}; /** - * @description Filter item prices based on their `period`. + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ period?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; /** - * @description The subscription channel this object originated from and is maintained in. + * @description Returns a list of item prices satisfying **all** the conditions specified in the filter parameters below. The list is sorted by the date of creation in descending order. */ @@ -781,221 +890,156 @@ If an addon-item price has [differential pricing](differential_prices?prod_cat_v sort_by?:{asc?:'updated_at' | 'name' | 'id',desc?:'updated_at' | 'name' | 'id'}; } - export interface CreateResponse { + export interface DeleteResponse { item_price:ItemPrice; } - export interface CreateInputParam { - [key : string] : any; + + export interface FindApplicableItemsResponse { /** - * @description The identifier for the item price. It is unique and immutable. + * @description Returns the set of all applicable [addon-items](items?prod_cat_ver=2#addon-items) for a specific [plan-item price](item_prices?prod_cat_ver=2#types). This set consists of all addon-items whose item prices can be applied to a subscription having the plan-item price in it. When determining this set, Chargebee considers the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price. */ - id:string; + list:{item:Item}[]; /** - * @description A unique display name for the item price in the Chargebee UI. If `external_name` is not provided, this is also used in customer-facing pages and documents such as [invoices](./invoices?prod_cat_ver=2) and [hosted pages](hosted_pages?prod_cat_ver=2). + * @description Returns the set of all applicable [addon-items](items?prod_cat_ver=2#addon-items) for a specific [plan-item price](item_prices?prod_cat_ver=2#types). This set consists of all addon-items whose item prices can be applied to a subscription having the plan-item price in it. When determining this set, Chargebee considers the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price. */ - name:string; - + next_offset?:string; + } + export interface FindApplicableItemsInputParam { + [key : string]: any; /** - * @description Description of the item price. + * @description Returns the set of all applicable [addon-items](items?prod_cat_ver=2#addon-items) for a specific [plan-item price](item_prices?prod_cat_ver=2#types). This set consists of all addon-items whose item prices can be applied to a subscription having the plan-item price in it. When determining this set, Chargebee considers the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price. */ - - description?:string; + + limit?:number; /** - * @description The id of the item that the item price belongs to. + * @description Returns the set of all applicable [addon-items](items?prod_cat_ver=2#addon-items) for a specific [plan-item price](item_prices?prod_cat_ver=2#types). This set consists of all addon-items whose item prices can be applied to a subscription having the plan-item price in it. When determining this set, Chargebee considers the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price. */ - - item_id:string; + + offset?:string; /** - * @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. + * @description Returns the set of all applicable [addon-items](items?prod_cat_ver=2#addon-items) for a specific [plan-item price](item_prices?prod_cat_ver=2#types). This set consists of all addon-items whose item prices can be applied to a subscription having the plan-item price in it. When determining this set, Chargebee considers the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price. */ - - invoice_notes?:string; - + + sort_by?:{asc?:'updated_at' | 'name' | 'id',desc?:'updated_at' | 'name' | 'id'}; + } + export interface FindApplicableItemPricesResponse { /** - * @description The name of the item price used in customer-facing pages and documents. These include [invoices](./invoices?prod_cat_ver=2) and [hosted pages](hosted_pages?prod_cat_ver=2). If not provided, then `name` is used. + * @description Returns the set of all applicable [addon-item](item_prices?prod_cat_ver=2#types) prices for a specific plan-item price. This set consists of all the addon-item prices that can be applied to a subscription having the plan-item price. When determining this set, Chargebee considers the following: - */ - - external_name?:string; - - /** - * @description The currency code ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html)) for the item price. Is required when multiple currencies have been enabled. +* the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price +* the [compatibility](subscriptions?prod_cat_ver=2#compatibility) of the addon-item prices to the plan-item price - */ - - currency_code?:string; - - /** - * @description Specifies whether taxes apply to this item price. This value is set and returned even if [Taxes](https://www.chargebee.com/docs/tax.html) have been disabled in Chargebee. However, the value is effective only while Taxes are enabled. +**Note** - */ - - is_taxable?:boolean; - - /** - * @description Free quantity the subscriptions of this item_price will have. Only the quantity more than this will be charged for the subscription. +If an addon-item price has [differential pricing](differential_prices?prod_cat_ver=2) defined against the parent item of the plan-item price, then the pricing information in the addon-item price object returned, reflects the differential pricing. */ - free_quantity?:number; + list:{item_price:ItemPrice}[]; /** - * @description The quantity of the item that is available free-of-charge, represented in decimal. When a subscription is created for this plan or when the plan of a subscription is changed to this one, only the quantity above this number is charged for. Applicable for quantity-based plans and only when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + * @description Returns the set of all applicable [addon-item](item_prices?prod_cat_ver=2#types) prices for a specific plan-item price. This set consists of all the addon-item prices that can be applied to a subscription having the plan-item price. When determining this set, Chargebee considers the following: - */ - - free_quantity_in_decimal?:string; - - /** - * @description A set of key-value pairs stored as additional information for the item price. [Learn more](./#meta_data). +* the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price +* the [compatibility](subscriptions?prod_cat_ver=2#compatibility) of the addon-item prices to the plan-item price - */ - - metadata?:object; - - /** - * @description Whether the item price's description should be shown on [invoice PDFs](/docs/api/invoices#retrieve_invoice_as_pdf). If this Boolean is changed, only invoices generated (or [regenerated](https://www.chargebee.com/docs/invoice-operations.html#actions-for-payment-due-not-paid-invoices_regenerate-invoice)) after the change are affected; past invoices are not. +**Note** - */ - - show_description_in_invoices?:boolean; - - /** - * @description Whether the item price's description should be shown on [quote PDFs](/docs/api/quotes#retrieve_quote_as_pdf). If this Boolean is changed, only quotes created after the change are affected; past quotes are not. +If an addon-item price has [differential pricing](differential_prices?prod_cat_ver=2) defined against the parent item of the plan-item price, then the pricing information in the addon-item price object returned, reflects the differential pricing. */ - show_description_in_quotes?:boolean; - + next_offset?:string; + } + export interface FindApplicableItemPricesInputParam { + [key : string]: any; /** - * @description The [pricing scheme](https://www.chargebee.com/docs/2.0/plans.html#pricing-models) for this item price. If subscriptions, invoices or [differential prices](./differential_prices?prod_cat_ver=2) exist for this item price, `pricing_model` cannot be changed. -\* tiered - The per unit price is based on the tier that the total quantity falls in. -\* per_unit - A fixed price per unit quantity. -\* flat_fee - A fixed price that is not quantity-based. -\* volume - There are quantity tiers for which per unit prices are set. Quantities are purchased from successive tiers. -\* stairstep - A quantity-based pricing scheme. The item is charged a fixed price based on the tier that the total quantity falls in. + * @description Returns the set of all applicable [addon-item](item_prices?prod_cat_ver=2#types) prices for a specific plan-item price. This set consists of all the addon-item prices that can be applied to a subscription having the plan-item price. When determining this set, Chargebee considers the following: - */ - - pricing_model?:PricingModel; - - /** - * @description The cost of the item price when the pricing model is `flat_fee`. When the pricing model is `per_unit`, it is the price per unit quantity of the item. Not applicable for the other pricing models. The value is in the [minor unit of the currency](https://apidocs.chargebee.com/docs/api#handling_currency_units). +* the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price +* the [compatibility](subscriptions?prod_cat_ver=2#compatibility) of the addon-item prices to the plan-item price - */ - - price?:number; - - /** - * @description The price of the item when the pricing_model is `flat_fee`. When the pricing model is `per_unit`, it is the price per unit quantity of the item. Not applicable for the other pricing models. The value is in decimal and in major units of the currency. Also, this is only applicable when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. +**Note** - */ - - price_in_decimal?:string; - - /** - * @description The unit of time for `period`. If subscriptions or invoices exist for this item price, `period_unit` cannot be changed. The `period_unit` is mandatory when the item `type` is `plan` or `addon`. \* 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. +If an addon-item price has [differential pricing](differential_prices?prod_cat_ver=2) defined against the parent item of the plan-item price, then the pricing information in the addon-item price object returned, reflects the differential pricing. */ - - period_unit?:'week' | 'month' | 'year' | 'day'; + + limit?:number; /** - * @description - -* When the item `type` is `plan`: The billing period of the plan in `period_unit`s. For example, create a 6 month plan by providing `period` as 6 and `period_unit` as month. -* When item `type` is `addon`: The period of the addon in `period_unit`s. For example, create an addon with a 2 month `period` by providing period as 2 and `period_unit` as `month`. The period of an addon is the duration for which its `price` applies. When attached to a plan, the addon is billed for the billing period of the plan. [Learn more.](https://www.chargebee.com/docs/2.0/addons-billingcycle.html) + * @description Returns the set of all applicable [addon-item](item_prices?prod_cat_ver=2#types) prices for a specific plan-item price. This set consists of all the addon-item prices that can be applied to a subscription having the plan-item price. When determining this set, Chargebee considers the following: +* the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price +* the [compatibility](subscriptions?prod_cat_ver=2#compatibility) of the addon-item prices to the plan-item price +**Note** -If subscriptions or invoices exist for this item price, `period` cannot be changed. The `period` is mandatory when the item `type` is `plan` or `addon`. +If an addon-item price has [differential pricing](differential_prices?prod_cat_ver=2) defined against the parent item of the plan-item price, then the pricing information in the addon-item price object returned, reflects the differential pricing. */ - - period?:number; + + offset?:string; /** - * @description The unit of time for `trial_period`. \* month - A period of 1 calendar month. \* day - A period of 24 hours. + * @description Returns the set of all applicable [addon-item](item_prices?prod_cat_ver=2#types) prices for a specific plan-item price. This set consists of all the addon-item prices that can be applied to a subscription having the plan-item price. When determining this set, Chargebee considers the following: - */ - - trial_period_unit?:'month' | 'day'; - - /** - * @description The trial period of the plan in `trial_period_unit`s. You can also set [trial periods for addons](https://www.chargebee.com/docs/2.0/addons-trial.html); contact [Support](https://chargebee.freshdesk.com/support/home) to enable that feature. +* the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price +* the [compatibility](subscriptions?prod_cat_ver=2#compatibility) of the addon-item prices to the plan-item price - */ - - trial_period?:number; - - /** - * @description Defines the shipping frequency. Example: to bill customer every 2 weeks, provide "2" here. +**Note** - */ - - shipping_period?:number; - - /** - * @description Defines the shipping frequency in association with shipping period. \* day - A period of 24 hours. \* week - A period of 7 days. \* year - A period of 1 calendar year. \* month - A period of 1 calendar month. +If an addon-item price has [differential pricing](differential_prices?prod_cat_ver=2) defined against the parent item of the plan-item price, then the pricing information in the addon-item price object returned, reflects the differential pricing. */ - - shipping_period_unit?:'week' | 'month' | 'year' | 'day'; + + item_id?:string; /** - * @description The default number of billing cycles a subscription to the plan must run. Can be [overridden](./subscriptions?prod_cat_ver=2) for a subscription. + * @description Returns the set of all applicable [addon-item](item_prices?prod_cat_ver=2#types) prices for a specific plan-item price. This set consists of all the addon-item prices that can be applied to a subscription having the plan-item price. When determining this set, Chargebee considers the following: -Addons can also [have billing cycles](https://www.chargebee.com/docs/2.0/addons-billingcycle.html). However, you must contact [Support](https://chargebee.freshdesk.com/support/home) to enable that. Also, for addons, you can [override this](./attached_items?prod_cat_ver=2) while attaching it to a plan. However, if you provide the value while [applying the addon to a subscription](./subscriptions?prod_cat_ver=2#subscription_subscription_items_item_type), then that value takes still higher precedence. -If subscriptions, invoices or [differential prices](./differential_prices?prod_cat_ver=2) exist for this item price, `billing_cycles` cannot be changed. +* the [item_applicability](items?prod_cat_ver=2#item_item_applicability) and [applicable_items](items?prod_cat_ver=2#item_applicable_items) defined for the parent item of the plan-item price +* the [compatibility](subscriptions?prod_cat_ver=2#compatibility) of the addon-item prices to the plan-item price - */ - - billing_cycles?:number; - - /** - * @description Applicable only when [End-of-trial Action](https://www.chargebee.com/docs/trial_periods.html#how-to-define-the-end-of-trial-actions-for-subscriptions) has been enabled for the site. Specifies the operation to be carried out for the subscription once the trial ends. Whenever the `item.type` is `plan` and a trial period is defined for this item price, this attribute (parameter) is returned (required). This can be overridden at the [subscription-level](subscriptions?prod_cat_ver=2#subscription_trial_end_action). \* cancel_subscription - The subscription cancels. \* activate_subscription - The subscription activates and charges are raised for non-metered items. \* site_default - The action [configured for the site](https://www.chargebee.com/docs/trial_periods.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect. +**Note** - */ - - trial_end_action?:'activate_subscription' | 'cancel_subscription' | 'site_default'; - - /** - * @description Parameters for tax_detail +If an addon-item price has [differential pricing](differential_prices?prod_cat_ver=2) defined against the parent item of the plan-item price, then the pricing information in the addon-item price object returned, reflects the differential pricing. */ - - tax_detail?:{avalara_sale_type?:AvalaraSaleType,avalara_service_type?:number,avalara_tax_code?:string,avalara_transaction_type?:number,hsn_code?:string,tax_profile_id?:string,taxjar_product_code?:string}; - - /** - * @description Parameters for accounting_detail + + sort_by?:{asc?:'updated_at' | 'name' | 'id',desc?:'updated_at' | 'name' | 'id'}; + } + export interface Tier { + /** + * @description The lower limit of a range of units for the tier - */ + */ - accounting_detail?:{accounting_category1?:string,accounting_category2?:string,accounting_category3?:string,accounting_category4?:string,accounting_code?:string,sku?:string}; + starting_unit:number; - /** - * @description Parameters for tiers + /** + * @description The upper limit of a range of units for the tier - */ - - tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; - } - export interface Tier { - starting_unit?:number; + */ ending_unit?:number; - price?:number; + /** + * @description The per-unit price for the tier when the `pricing_model` is `tiered` or `volume`; the total cost for the item price when the `pricing_model` is `stairstep`. The value is in the [minor unit of the currency](https://apidocs.chargebee.com/docs/api#handling_currency_units). + + */ + + price:number; starting_unit_in_decimal?:string; @@ -1033,7 +1077,7 @@ If subscriptions, invoices or [differential prices](./differential_prices?prod_c avalara_service_type?:number; /** - * @description The [Avalara tax codes](https://taxcode.avatax.avalara.com) for the item price. Applicable only if you use [AvaTax for Sales integration](https://www.chargebee.com/docs/2.0/avalara-for-sales.html). + * @description The [Avalara tax codes](https://taxcode.avatax.avalara.com) for the item price. Applicable only if you use [AvaTax for Sales integration](https://www.chargebee.com/docs/2.0/avatax-for-sales.html). */ @@ -1043,7 +1087,7 @@ If subscriptions, invoices or [differential prices](./differential_prices?prod_c * @description The [HSN code](https://cbic-gst.gov.in/gst-goods-services-rates.html) to which the item is mapped for calculating the customer's tax in India. Applicable only when both of the following conditions are true: * **[India](https://www.chargebee.com/docs/indian-gst.html#configuring-indian-gst)** has been enabled as a **Tax Region**. (An error is returned when this condition is not true.) -* The [**AvaTax for Sales** integration](\"https://www.chargebee.com/docs/avalara.html\") has been enabled in Chargebee. +* The [**AvaTax for Sales** integration](https://www.chargebee.com/docs/avalara.html) has been enabled in Chargebee. */ diff --git a/types/resources/PaymentIntent.d.ts b/types/resources/PaymentIntent.d.ts index d41e2e0..2dcdf3c 100644 --- a/types/resources/PaymentIntent.d.ts +++ b/types/resources/PaymentIntent.d.ts @@ -56,7 +56,7 @@ declare module 'chargebee' { */ - payment_method_type?:'giropay' | 'ideal' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'sofort' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'card'; + payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'faster_payments' | 'sofort' | 'upi' | 'venmo' | 'amazon_payments' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'pay_to' | 'card'; /** * @description The URL the customer will be directed to once 3DS verification is successful. Applicable only when `payment_method_type` is `ideal`, `sofort`, `dotpay` or `giropay`. @@ -133,20 +133,6 @@ declare module 'chargebee' { } export namespace PaymentIntent { export class PaymentIntentResource { - /** - * @description Retrieves the PaymentIntent resource. - - */ - - retrieve(payment_intent_id:string):ChargebeeRequest; - - /** - * @description Updating properties on a PaymentIntent object. All the subsequent 3DS transaction attempts will have the updated values. - - */ - - update(payment_intent_id:string, input?:UpdateInputParam):ChargebeeRequest; - /** * @description Creates a PaymentIntent object. This is to be used with Chargebee.js API to complete the 3DS flow for new or stored cards. @@ -163,57 +149,20 @@ If multiple [business entities](/docs/api/advanced-features#mbe) are created for */ create(input:CreateInputParam):ChargebeeRequest; - } - export interface RetrieveResponse { - payment_intent:PaymentIntent; - } - - export interface UpdateResponse { - payment_intent:PaymentIntent; - } - export interface UpdateInputParam { - - /** - * @description Amount(in cents) to be authorized for 3DS flow. - - */ - - amount?:number; - - /** - * @description The currency code (ISO 4217 format) of the amount used in transaction. - - */ - - currency_code?:string; - - /** - * @description The gateway account used for performing the 3DS flow. - - */ - - gateway_account_id?:string; - - /** - * @description The payment method of this intent. \* google_pay - google_pay \* apple_pay - apple_pay \* ideal - ideal \* bancontact - bancontact \* netbanking_emandates - netbanking_emandates \* direct_debit - direct_debit \* card - card \* dotpay - dotpay \* giropay - giropay \* upi - upi \* sofort - sofort \* paypal_express_checkout - paypal_express_checkout - - */ - - payment_method_type?:'giropay' | 'ideal' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'sofort' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'card'; /** - * @description The URL the customer will be directed to once 3DS verification is successful. Applicable only when `payment_method_type` is `ideal`, `sofort`, `dotpay` or `giropay`. + * @description Updating properties on a PaymentIntent object. All the subsequent 3DS transaction attempts will have the updated values. */ - - success_url?:string; + + update(payment_intent_id:string, input?:UpdateInputParam):ChargebeeRequest; /** - * @description The URL the customer will be directed to when 3DS verification fails. Applicable only when `payment_method_type` is `ideal`, `sofort`, `dotpay` or `giropay`. + * @description Retrieves the PaymentIntent resource. */ - - failure_url?:string; + + retrieve(payment_intent_id:string):ChargebeeRequest; } export interface CreateResponse { payment_intent:PaymentIntent; @@ -277,7 +226,7 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade */ - payment_method_type?:'giropay' | 'ideal' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'sofort' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'card'; + payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'faster_payments' | 'sofort' | 'upi' | 'venmo' | 'amazon_payments' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'pay_to' | 'card'; /** * @description The URL the customer will be directed to once 3DS verification is successful. Applicable only when `payment_method_type` is `ideal`, `sofort`, `dotpay` or `giropay`. @@ -293,6 +242,57 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade failure_url?:string; } + export interface UpdateResponse { + payment_intent:PaymentIntent; + } + export interface UpdateInputParam { + + /** + * @description Amount(in cents) to be authorized for 3DS flow. + + */ + + amount?:number; + + /** + * @description The currency code (ISO 4217 format) of the amount used in transaction. + + */ + + currency_code?:string; + + /** + * @description The gateway account used for performing the 3DS flow. + + */ + + gateway_account_id?:string; + + /** + * @description The payment method of this intent. \* google_pay - google_pay \* boleto - boleto \* apple_pay - apple_pay \* ideal - ideal \* bancontact - bancontact \* netbanking_emandates - netbanking_emandates \* direct_debit - direct_debit \* card - card \* dotpay - dotpay \* giropay - giropay \* upi - upi \* sofort - sofort \* paypal_express_checkout - paypal_express_checkout + + */ + + payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'faster_payments' | 'sofort' | 'upi' | 'venmo' | 'amazon_payments' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'pay_to' | 'card'; + + /** + * @description The URL the customer will be directed to once 3DS verification is successful. Applicable only when `payment_method_type` is `ideal`, `sofort`, `dotpay` or `giropay`. + + */ + + success_url?:string; + + /** + * @description The URL the customer will be directed to when 3DS verification fails. Applicable only when `payment_method_type` is `ideal`, `sofort`, `dotpay` or `giropay`. + + */ + + failure_url?:string; + } + export interface RetrieveResponse { + payment_intent:PaymentIntent; + } + export interface PaymentAttempt { /** * @description Identifier for PaymentIntent's active payment attempt. @@ -313,7 +313,7 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade */ - payment_method_type?:'giropay' | 'ideal' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'sofort' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'card'; + payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'faster_payments' | 'sofort' | 'upi' | 'venmo' | 'amazon_payments' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'pay_to' | 'card'; /** * @description Reference of PaymentIntent at gateway diff --git a/types/resources/PaymentVoucher.d.ts b/types/resources/PaymentVoucher.d.ts index 0dcb192..bca280f 100644 --- a/types/resources/PaymentVoucher.d.ts +++ b/types/resources/PaymentVoucher.d.ts @@ -74,7 +74,7 @@ declare module 'chargebee' { /** * @description The gateway through which this payment voucher was created. -**Note** : Note: Currently, `stripe` is the only supported gateway through which you can create the payment voucher. \* ecentric - Ecentric provides a seamless payment processing service in South Africa specializing on omnichannel capabilities. \* bluesnap - BlueSnap is a payment gateway. \* tco - 2Checkout is a payment gateway. \* first_data_global - First Data Global Gateway Virtual Terminal Account \* exact - Exact Payments is a payment gateway. \* bluepay - BluePay is a payment gateway. \* paypal_express_checkout - PayPal Express Checkout is a payment gateway. \* eway - eWAY Account is a payment gateway. \* paypal_payflow_pro - PayPal Payflow Pro is a payment gateway. \* razorpay - Razorpay is a fast growing payment service provider in India working with all leading banks and support for major local payment methods including Netbanking, UPI etc. \* global_payments - Global Payments is a payment service provider. \* amazon_payments - Amazon Payments is a payment service provider. \* not_applicable - Indicates that payment gateway is not applicable for this resource. \* checkout_com - Checkout.com is a payment gateway. \* adyen - Adyen is a payment gateway. \* braintree - Braintree is a payment gateway. \* nmi - NMI is a payment gateway. \* quickbooks - Intuit QuickBooks Payments gateway \* wepay - WePay is a payment gateway. \* worldpay - WorldPay is a payment gateway \* wirecard - WireCard Account is a payment service provider. \* chargebee_payments - Chargebee Payments gateway \* sage_pay - Sage Pay is a payment gateway. \* moneris_us - Moneris USA is a payment gateway. \* pin - Pin is a payment gateway \* authorize_net - Authorize.net is a payment gateway \* elavon - Elavon Virtual Merchant is a payment solution. \* paypal_pro - PayPal Pro Account is a payment gateway. \* orbital - Chase Paymentech(Orbital) is a payment gateway. \* paypal - PayPal Commerce is a payment gateway. \* beanstream - Bambora(formerly known as Beanstream) is a payment gateway. \* hdfc - HDFC Account is a payment gateway. \* ingenico_direct - Worldline Online Payments is a payment gateway. \* ogone - Ingenico ePayments (formerly known as Ogone) is a payment gateway. \* migs - MasterCard Internet Gateway Service payment gateway. \* stripe - Stripe is a payment gateway. \* vantiv - Vantiv is a payment gateway. \* moneris - Moneris is a payment gateway. \* bank_of_america - Bank of America Gateway \* chargebee - Chargebee test gateway. \* eway_rapid - eWAY Rapid is a payment gateway. \* gocardless - GoCardless is a payment service provider. \* mollie - Mollie is a payment gateway. \* paymill - PAYMILL is a payment gateway. \* balanced_payments - Balanced is a payment gateway \* cybersource - CyberSource is a payment gateway. +**Note** : Note: Currently, `stripe` is the only supported gateway through which you can create the payment voucher. \* ecentric - Ecentric provides a seamless payment processing service in South Africa specializing on omnichannel capabilities. \* bluesnap - BlueSnap is a payment gateway. \* tco - 2Checkout is a payment gateway. \* first_data_global - First Data Global Gateway Virtual Terminal Account \* exact - Exact Payments is a payment gateway. \* bluepay - BluePay is a payment gateway. \* paypal_express_checkout - PayPal Express Checkout is a payment gateway. \* eway - eWAY Account is a payment gateway. \* metrics_global - Metrics global is a leading payment service provider providing unified payment services in the US. \* paypal_payflow_pro - PayPal Payflow Pro is a payment gateway. \* razorpay - Razorpay is a fast growing payment service provider in India working with all leading banks and support for major local payment methods including Netbanking, UPI etc. \* global_payments - Global Payments is a payment service provider. \* amazon_payments - Amazon Payments is a payment service provider. \* not_applicable - Indicates that payment gateway is not applicable for this resource. \* windcave - Windcave provides an end to end payment processing solution in ANZ and other leading global markets. \* checkout_com - Checkout.com is a payment gateway. \* adyen - Adyen is a payment gateway. \* braintree - Braintree is a payment gateway. \* nmi - NMI is a payment gateway. \* quickbooks - Intuit QuickBooks Payments gateway \* wepay - WePay is a payment gateway. \* worldpay - WorldPay is a payment gateway \* wirecard - WireCard Account is a payment service provider. \* chargebee_payments - Chargebee Payments gateway \* sage_pay - Sage Pay is a payment gateway. \* moneris_us - Moneris USA is a payment gateway. \* pin - Pin is a payment gateway \* authorize_net - Authorize.net is a payment gateway \* elavon - Elavon Virtual Merchant is a payment solution. \* paypal_pro - PayPal Pro Account is a payment gateway. \* orbital - Chase Paymentech(Orbital) is a payment gateway. \* paypal - PayPal Commerce is a payment gateway. \* beanstream - Bambora(formerly known as Beanstream) is a payment gateway. \* hdfc - HDFC Account is a payment gateway. \* ingenico_direct - Worldline Online Payments is a payment gateway. \* ogone - Ingenico ePayments (formerly known as Ogone) is a payment gateway. \* migs - MasterCard Internet Gateway Service payment gateway. \* stripe - Stripe is a payment gateway. \* vantiv - Vantiv is a payment gateway. \* moneris - Moneris is a payment gateway. \* bank_of_america - Bank of America Gateway \* chargebee - Chargebee test gateway. \* eway_rapid - eWAY Rapid is a payment gateway. \* gocardless - GoCardless is a payment service provider. \* mollie - Mollie is a payment gateway. \* paymill - PAYMILL is a payment gateway. \* balanced_payments - Balanced is a payment gateway \* cybersource - CyberSource is a payment gateway. */ @@ -146,78 +146,70 @@ declare module 'chargebee' { export namespace PaymentVoucher { export class PaymentVoucherResource { /** - * @description Retrieves vouchers for a customer in reverse chronological order. + * @description Creates a voucher type payment source. If you create this voucher type payment source using customer details, like tax ID, you can then generate a voucher with that payment source. */ - payment_vouchers_for_customer(customer_id:string, input?:Payment_vouchersForCustomerInputParam):ChargebeeRequest; + create(input:CreateInputParam):ChargebeeRequest; /** - * @description Retrieves vouchers for an invoice in reverse chronological order. + * @description Retrieves a voucher using the unique `payment_voucher_id`. */ - payment_vouchers_for_invoice(invoice_id:string, input?:Payment_vouchersForInvoiceInputParam):ChargebeeRequest; + retrieve(payment_voucher_id:string):ChargebeeRequest; /** - * @description Retrieves a voucher using the unique `payment_voucher_id`. + * @description Retrieves vouchers for an invoice in reverse chronological order. */ - retrieve(payment_voucher_id:string):ChargebeeRequest; + payment_vouchers_for_invoice(invoice_id:string, input?:Payment_vouchersForInvoiceInputParam):ChargebeeRequest; /** - * @description Creates a voucher type payment source. If you create this voucher type payment source using customer details, like tax ID, you can then generate a voucher with that payment source. + * @description Retrieves vouchers for a customer in reverse chronological order. */ - create(input:CreateInputParam):ChargebeeRequest; + payment_vouchers_for_customer(customer_id:string, input?:Payment_vouchersForCustomerInputParam):ChargebeeRequest; } - export interface Payment_vouchersForCustomerResponse { + export interface CreateResponse { + payment_voucher:PaymentVoucher; + } + export interface CreateInputParam { + /** - * @description Retrieves vouchers for a customer in reverse chronological order. + * @description The unique identifier of the customer for whom you want to create the voucher. */ - list:{payment_voucher:PaymentVoucher}[]; + customer_id:string; /** - * @description Retrieves vouchers for a customer in reverse chronological order. + * @description The identifier of the payment source used for generating the voucher. */ - next_offset?:string; - } - export interface Payment_vouchersForCustomerInputParam { - [key : string]: any; - /** - * @description The number of resources to be returned. - - */ - - limit?:number; + payment_source_id?:string; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Parameters for voucher_payment_source */ - - offset?:string; - /** - * @description Current status of Payment Voucher. - - */ - - status?:{in?:string,is?:'consumed' | 'expired' | 'failure' | 'active',is_not?:'consumed' | 'expired' | 'failure' | 'active',not_in?:string}; + voucher_payment_source?:{voucher_type:VoucherType}; /** - * @description Retrieves vouchers for a customer in reverse chronological order. + * @description Parameters for `invoice_allocations` */ - - sort_by?:{asc?:'date' | 'updated_at',desc?:'date' | 'updated_at'}; + + invoice_allocations?:{invoice_id:string}[]; + } + export interface RetrieveResponse { + payment_voucher:PaymentVoucher; } + export interface Payment_vouchersForInvoiceResponse { /** * @description Retrieves vouchers for an invoice in reverse chronological order. @@ -236,21 +228,21 @@ declare module 'chargebee' { export interface Payment_vouchersForInvoiceInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description Retrieves vouchers for an invoice in reverse chronological order. */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Retrieves vouchers for an invoice in reverse chronological order. */ offset?:string; /** - * @description Current status of Payment Voucher. + * @description Retrieves vouchers for an invoice in reverse chronological order. */ @@ -263,49 +255,72 @@ declare module 'chargebee' { sort_by?:{asc?:'date' | 'updated_at',desc?:'date' | 'updated_at'}; } - export interface RetrieveResponse { - payment_voucher:PaymentVoucher; - } - - export interface CreateResponse { - payment_voucher:PaymentVoucher; - } - export interface CreateInputParam { - + export interface Payment_vouchersForCustomerResponse { /** - * @description The unique identifier of the customer for whom you want to create the voucher. + * @description Retrieves vouchers for a customer in reverse chronological order. */ - customer_id:string; + list:{payment_voucher:PaymentVoucher}[]; /** - * @description The identifier of the payment source used for generating the voucher. + * @description Retrieves vouchers for a customer in reverse chronological order. */ - payment_source_id?:string; - + next_offset?:string; + } + export interface Payment_vouchersForCustomerInputParam { + [key : string]: any; /** - * @description Parameters for voucher_payment_source + * @description Retrieves vouchers for a customer in reverse chronological order. */ + + limit?:number; - voucher_payment_source?:{voucher_type:VoucherType}; + /** + * @description Retrieves vouchers for a customer in reverse chronological order. + + */ + + offset?:string; /** - * @description Parameters for `invoice_allocations` + * @description Retrieves vouchers for a customer in reverse chronological order. */ + + status?:{in?:string,is?:'consumed' | 'expired' | 'failure' | 'active',is_not?:'consumed' | 'expired' | 'failure' | 'active',not_in?:string}; - invoice_allocations?:{invoice_id:string}[]; + /** + * @description Retrieves vouchers for a customer in reverse chronological order. + + */ + + sort_by?:{asc?:'date' | 'updated_at',desc?:'date' | 'updated_at'}; } export interface InvoicePaymentVoucher { - invoice_id?:string; + /** + * @description Identifier for the invoice. + + */ + + invoice_id:string; + + /** + * @description Uniquely identifies the payment voucher. + + */ + + txn_id:string; - txn_id?:string; + /** + * @description Timestamp at which the transaction is applied. + + */ - applied_at?:number; + applied_at:number; } } } \ No newline at end of file diff --git a/types/resources/PortalSession.d.ts b/types/resources/PortalSession.d.ts index e9ae9a4..92e6ace 100644 --- a/types/resources/PortalSession.d.ts +++ b/types/resources/PortalSession.d.ts @@ -103,18 +103,11 @@ declare module 'chargebee' { create(input?:CreateInputParam):ChargebeeRequest; /** - * @description When an user is sent back to your return URL with session details, you should validate that information by calling this API. The details passed to the **return_url** should be sent as below: - -* **auth_session_id** - this should be sent as part of the endpoint. -* **auth_session_token** - this should be sent as value for the input parameter **token**. - - - -**Note:** This API is not applicable for [in-app](https://www.chargebee.com/docs/v3-self-serve-portal.html) portal. + * @description This API retrieves a portal session using `portal_session_id` as a path parameter. */ - activate(portal_session_id:string, input:ActivateInputParam):ChargebeeRequest; + retrieve(portal_session_id:string):ChargebeeRequest; /** * @description Logs out the portal session. Typically this should be called when customers logout of your application. @@ -130,11 +123,18 @@ If this API is called for a Portal Session that currently is in : logout(portal_session_id:string):ChargebeeRequest; /** - * @description This API retrieves a portal session using `portal_session_id` as a path parameter. + * @description When an user is sent back to your return URL with session details, you should validate that information by calling this API. The details passed to the **return_url** should be sent as below: + +* **auth_session_id** - this should be sent as part of the endpoint. +* **auth_session_token** - this should be sent as value for the input parameter **token**. + + + +**Note:** This API is not applicable for [in-app](https://www.chargebee.com/docs/v3-self-serve-portal.html) portal. */ - retrieve(portal_session_id:string):ChargebeeRequest; + activate(portal_session_id:string, input:ActivateInputParam):ChargebeeRequest; } export interface CreateResponse { portal_session:PortalSession; @@ -164,6 +164,14 @@ If this API is called for a Portal Session that currently is in : customer?:{id:string}; } + export interface RetrieveResponse { + portal_session:PortalSession; + } + + export interface LogoutResponse { + portal_session:PortalSession; + } + export interface ActivateResponse { portal_session:PortalSession; } @@ -176,23 +184,40 @@ If this API is called for a Portal Session that currently is in : token:string; } - export interface LogoutResponse { - portal_session:PortalSession; - } - - export interface RetrieveResponse { - portal_session:PortalSession; - } - export interface LinkedCustomer { - customer_id?:string; + /** + * @description Identifier of the customer. + + */ + + customer_id:string; + + /** + * @description Email of the customer. Configured email notifications will be sent to this email. + + */ email?:string; + /** + * @description The customer has billing address. + + */ + has_billing_address?:boolean; + /** + * @description The customer has payment method. + + */ + has_payment_method?:boolean; + /** + * @description The customer has atleast one active subscription. + + */ + has_active_subscription?:boolean; } } diff --git a/types/resources/PromotionalCredit.d.ts b/types/resources/PromotionalCredit.d.ts index b8ed7f8..8ae6d0c 100644 --- a/types/resources/PromotionalCredit.d.ts +++ b/types/resources/PromotionalCredit.d.ts @@ -89,18 +89,13 @@ declare module 'chargebee' { export namespace PromotionalCredit { export class PromotionalCreditResource { /** - * @description This endpoint retrieves the promotional credit based on the promotional credit id + * @description This API call can be used to add promotional credits to a customer. [Learn more about Promotional Credits](https://www.chargebee.com/docs/2.0/credit-notes.html#creating-promotional-credits). - */ - - retrieve(account_credit_id:string):ChargebeeRequest; - - /** - * @description This endpoint lists the promotional credits set for a customer +For example, if a customer has credits of $10, if you pass the **amount** as $10, then the customer's credit balance would become $20. */ - list(input?:ListInputParam):ChargebeeRequest; + add(input:AddInputParam):ChargebeeRequest; /** * @description This API call can be used to deduct promotional credits for a customer. [Learn more about Promotional Credits](https://www.chargebee.com/docs/2.0/credit-notes.html#creating-promotional-credits). @@ -123,76 +118,74 @@ For example, if a customer has a credit balance of $10 and if you would like to set(input:SetInputParam):ChargebeeRequest; /** - * @description This API call can be used to add promotional credits to a customer. [Learn more about Promotional Credits](https://www.chargebee.com/docs/2.0/credit-notes.html#creating-promotional-credits). + * @description This endpoint lists the promotional credits set for a customer -For example, if a customer has credits of $10, if you pass the **amount** as $10, then the customer's credit balance would become $20. + */ + + list(input?:ListInputParam):ChargebeeRequest; + + /** + * @description This endpoint retrieves the promotional credit based on the promotional credit id */ - add(input:AddInputParam):ChargebeeRequest; + retrieve(account_credit_id:string):ChargebeeRequest; } - export interface RetrieveResponse { + export interface AddResponse { + customer:Customer; + promotional_credit:PromotionalCredit; } - - export interface ListResponse { + export interface AddInputParam { + /** - * @description This endpoint lists the promotional credits set for a customer + * @description Identifier of the customer. */ - list:{promotional_credit:PromotionalCredit}[]; + customer_id:string; /** - * @description This endpoint lists the promotional credits set for a customer + * @description Promotional credits amount. */ - next_offset?:string; - } - export interface ListInputParam { - [key : string]: any; - /** - * @description The number of resources to be returned. - - */ - - limit?:number; + amount?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Amount in decimal. */ - - offset?:string; + + amount_in_decimal?:string; /** - * @description Unique reference ID provided for promotional credits + * @description The currency code (ISO 4217 format) for promotional credit. */ - - id?:{is?:string,is_not?:string,starts_with?:string}; + + currency_code?:string; /** - * @description Timestamp indicating when this promotional credit resource is created. + * @description Detailed description of this promotional credits. */ - - created_at?:{after?:string,before?:string,between?:string,on?:string}; + + description:string; /** - * @description Type of promotional credits + * @description Type of promotional credits provided to customer. \* general - General \* referral_rewards - Referral \* loyalty_credits - Loyalty Credits */ - - type?:{in?:string,is?:'decrement' | 'increment',is_not?:'decrement' | 'increment',not_in?:string}; + + credit_type?:CreditType; /** - * @description Identifier of the customer. + * @description Describes why promotional credits were provided. */ - - customer_id?:{is?:string,is_not?:string,starts_with?:string}; + + reference?:string; } export interface DeductResponse { customer:Customer; @@ -306,62 +299,69 @@ For example, if a customer has credits of $10, if you pass the **amount** as $10 reference?:string; } - export interface AddResponse { - customer:Customer; - - promotional_credit:PromotionalCredit; - } - export interface AddInputParam { - + export interface ListResponse { /** - * @description Identifier of the customer. + * @description This endpoint lists the promotional credits set for a customer */ - customer_id:string; + list:{promotional_credit:PromotionalCredit}[]; /** - * @description Promotional credits amount. + * @description This endpoint lists the promotional credits set for a customer */ - amount?:number; - + next_offset?:string; + } + export interface ListInputParam { + [key : string]: any; /** - * @description Amount in decimal. + * @description This endpoint lists the promotional credits set for a customer */ - - amount_in_decimal?:string; + + limit?:number; /** - * @description The currency code (ISO 4217 format) for promotional credit. + * @description This endpoint lists the promotional credits set for a customer */ - - currency_code?:string; + + offset?:string; /** - * @description Detailed description of this promotional credits. + * @description This endpoint lists the promotional credits set for a customer */ - - description:string; + + id?:{is?:string,is_not?:string,starts_with?:string}; /** - * @description Type of promotional credits provided to customer. \* general - General \* referral_rewards - Referral \* loyalty_credits - Loyalty Credits + * @description This endpoint lists the promotional credits set for a customer */ - - credit_type?:CreditType; + + created_at?:{after?:string,before?:string,between?:string,on?:string}; /** - * @description Describes why promotional credits were provided. + * @description This endpoint lists the promotional credits set for a customer */ + + type?:{in?:string,is?:'decrement' | 'increment',is_not?:'decrement' | 'increment',not_in?:string}; - reference?:string; + /** + * @description This endpoint lists the promotional credits set for a customer + + */ + + customer_id?:{is?:string,is_not?:string,starts_with?:string}; } + export interface RetrieveResponse { + promotional_credit:PromotionalCredit; + } + } } \ No newline at end of file diff --git a/types/resources/Purchase.d.ts b/types/resources/Purchase.d.ts index 1b82021..810e417 100644 --- a/types/resources/Purchase.d.ts +++ b/types/resources/Purchase.d.ts @@ -73,7 +73,7 @@ The following subsections describe the types of groups in detail. You can specify up to 10 groups, -* with a recommended subscription group of 5. To increase this limit to a maximum of 8, contact [Chargebee Support](https://support.chargebee.com). +* with a recommended subscription group of 5. To increase this limit to a maximum of 8, contact [Chargebee Support](https://support.chargebee.com/support/home). * with a maximum of 10 one-time charge groups by default. The total limit for group items for a single purchase is 60. @@ -83,7 +83,7 @@ The total limit for group items for a single purchase is 60. 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. **Note** -A subscription group can have up to 20 non-plan item prices. To increase this limit to a maximum of 60, contact [Chargebee Support](https://support.chargebee.com). +A subscription group can have up to 20 non-plan item prices. To increase this limit to a maximum of 60, contact [Chargebee Support](https://support.chargebee.com/support/home). #### Custom Fields {#custom-fields} @@ -94,7 +94,7 @@ Purchase API supports custom fields of Subscriptions, use the following format t 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. **Note** -* A one-time charge group can have up to 20 item prices. To increase this limit to a maximum of 60, contact [Chargebee Support](https://support.chargebee.com). +* A one-time charge group can have up to 20 item prices. To increase this limit to a maximum of 60, contact [Chargebee Support](https://support.chargebee.com/support/home). * 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). ### Applying discounts {#discounts} diff --git a/types/resources/Quote.d.ts b/types/resources/Quote.d.ts index d601c13..3a6bcdd 100644 --- a/types/resources/Quote.d.ts +++ b/types/resources/Quote.d.ts @@ -275,13 +275,6 @@ Ireland** . The first two characters of the VAT number in such a case is `X } export namespace Quote { export class QuoteResource { - /** - * @description Create a quote for new subscription line items of a customer. - - */ - - create_sub_items_for_customer_quote(customer_id:string, input?:CreateSubItemsForCustomerQuoteInputParam):ChargebeeRequest; - /** * @description Retrieves the quotes identified by the 'number' specified in the url. @@ -290,18 +283,18 @@ Ireland** . The first two characters of the VAT number in such a case is `X retrieve(quote_id:string):ChargebeeRequest; /** - * @description Changes the quote produced for creating a new subscription items + * @description Create a quote for new subscription line items of a customer. */ - edit_create_sub_customer_quote_for_items(quote_id:string, input?:EditCreateSubCustomerQuoteForItemsInputParam):ChargebeeRequest; + create_sub_items_for_customer_quote(customer_id:string, input?:CreateSubItemsForCustomerQuoteInputParam):ChargebeeRequest; /** - * @description Updates the status of the quote. Status can be updated to Accepted, Declined, and Closed. + * @description Changes the quote produced for creating a new subscription items */ - update_status(quote_id:string, input:UpdateStatusInputParam):ChargebeeRequest; + edit_create_sub_customer_quote_for_items(quote_id:string, input?:EditCreateSubCustomerQuoteForItemsInputParam):ChargebeeRequest; /** * @description Create a quote for updating subscription line items. @@ -311,18 +304,18 @@ Ireland** . The first two characters of the VAT number in such a case is `X update_subscription_quote_for_items(input?:UpdateSubscriptionQuoteForItemsInputParam):ChargebeeRequest; /** - * @description This API retrieves all the quote line groups and lineitems for a quote. + * @description Changes the quote produced for updating the subscription items. */ - quote_line_groups_for_quote(quote_id:string, input?:QuoteLineGroupsForQuoteInputParam):ChargebeeRequest; + edit_update_subscription_quote_for_items(quote_id:string, input?:EditUpdateSubscriptionQuoteForItemsInputParam):ChargebeeRequest; /** - * @description Can be used to extend the expiry date of a quote. + * @description Creates a quote using charge-items and one-time charges. */ - extend_expiry_date(quote_id:string, input:ExtendExpiryDateInputParam):ChargebeeRequest; + create_for_charge_items_and_charges(input:CreateForChargeItemsAndChargesInputParam):ChargebeeRequest; /** * @description Changes the quote produced for adding one-time charges and charge items. @@ -332,39 +325,39 @@ Ireland** . The first two characters of the VAT number in such a case is `X edit_for_charge_items_and_charges(quote_id:string, input?:EditForChargeItemsAndChargesInputParam):ChargebeeRequest; /** - * @description Changes the quote produced for updating the subscription items. + * @description List all quotes. */ - edit_update_subscription_quote_for_items(quote_id:string, input?:EditUpdateSubscriptionQuoteForItemsInputParam):ChargebeeRequest; + list(input?:ListInputParam):ChargebeeRequest; /** - * @description List all quotes. + * @description This API retrieves all the quote line groups and lineitems for a quote. */ - list(input?:ListInputParam):ChargebeeRequest; + quote_line_groups_for_quote(quote_id:string, input?:QuoteLineGroupsForQuoteInputParam):ChargebeeRequest; /** - * @description Retrieves the quote as a PDF. The returned URL is secure, allows download and expires in 60 minutes. + * @description This API is to convert a quote to an invoice. */ - pdf(quote_id:string, input?:PdfInputParam):ChargebeeRequest; + convert(quote_id:string, input?:ConvertInputParam):ChargebeeRequest; /** - * @description This API is to convert a quote to an invoice. + * @description Updates the status of the quote. Status can be updated to Accepted, Declined, and Closed. */ - convert(quote_id:string, input?:ConvertInputParam):ChargebeeRequest; + update_status(quote_id:string, input:UpdateStatusInputParam):ChargebeeRequest; /** - * @description Creates a quote using charge-items and one-time charges. + * @description Can be used to extend the expiry date of a quote. */ - create_for_charge_items_and_charges(input:CreateForChargeItemsAndChargesInputParam):ChargebeeRequest; + extend_expiry_date(quote_id:string, input:ExtendExpiryDateInputParam):ChargebeeRequest; /** * @description Delete a quote using this API. @@ -372,7 +365,22 @@ Ireland** . The first two characters of the VAT number in such a case is `X */ delete(quote_id:string, input?:DeleteInputParam):ChargebeeRequest; + + /** + * @description Retrieves the quote as a PDF. The returned URL is secure, allows download and expires in 60 minutes. + + */ + + pdf(quote_id:string, input?:PdfInputParam):ChargebeeRequest; + } + export interface RetrieveResponse { + quote:Quote; + + quoted_subscription?:QuotedSubscription; + + quoted_charge?:QuotedCharge; } + export interface CreateSubItemsForCustomerQuoteResponse { quote:Quote; @@ -478,14 +486,6 @@ Ireland** . The first two characters of the VAT number in such a case is `X item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; } - export interface RetrieveResponse { - quote:Quote; - - quoted_subscription?:QuotedSubscription; - - quoted_charge?:QuotedCharge; - } - export interface EditCreateSubCustomerQuoteForItemsResponse { quote:Quote; @@ -584,29 +584,6 @@ Ireland** . The first two characters of the VAT number in such a case is `X item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; } - export interface UpdateStatusResponse { - quote:Quote; - - quoted_subscription?:QuotedSubscription; - - quoted_charge?:QuotedCharge; - } - export interface UpdateStatusInputParam { - - /** - * @description Status to update for the quote. \* accepted - Accepted. \* closed - Closed \* declined - Declined. - - */ - - status:'declined' | 'accepted' | 'closed'; - - /** - * @description An internal [comment](./comments) to be added for this operation, to the quote. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Quote PDF](./quotes#retrieve_quote_as_pdf). - - */ - - comment?:string; - } export interface UpdateSubscriptionQuoteForItemsResponse { quote:Quote; @@ -796,137 +773,6 @@ Ireland** . The first two characters of the VAT number in such a case is `X item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; } - export interface QuoteLineGroupsForQuoteResponse { - /** - * @description This API retrieves all the quote line groups and lineitems for a quote. - - */ - - list:{quote_line_group:QuoteLineGroup}[]; - - /** - * @description This API retrieves all the quote line groups and lineitems for a quote. - - */ - - next_offset?:string; - } - export interface QuoteLineGroupsForQuoteInputParam { - [key : string]: any; - /** - * @description The number of resources to be returned. - - */ - - limit?:number; - - /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. - - */ - - offset?:string; - } - export interface ExtendExpiryDateResponse { - quote:Quote; - - quoted_subscription?:QuotedSubscription; - - quoted_charge?:QuotedCharge; - } - export interface ExtendExpiryDateInputParam { - - /** - * @description Quote will be valid till this date. After this date quote will be marked as closed. - - */ - - valid_till:number; - } - export interface EditForChargeItemsAndChargesResponse { - quote:Quote; - - quoted_charge?:QuotedCharge; - } - export interface EditForChargeItemsAndChargesInputParam { - - /** - * @description Purchase Order Number for this quote. - - */ - - po_number?:string; - - /** - * @description Notes specific to this quote that you want customers to see on the quote PDF. - - */ - - notes?:string; - - /** - * @description Quotes will be vaild till this date. After this quote will be marked as closed. - - */ - - expires_at?:number; - - /** - * @description The currency code (ISO 4217 format) of the quote. - - */ - - currency_code?:string; - - /** - * @description The 'One Time' coupon to be applied. - - */ - - coupon?:string; - - /** - * @description List of Coupons to be added. - - */ - - coupon_ids?:string[]; - - /** - * @description Parameters for shipping_address - - */ - - 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}; - - /** - * @description Parameters for item_prices - - */ - - item_prices?:{item_price_id?:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,unit_price?:number,unit_price_in_decimal?:string}[]; - - /** - * @description Parameters for item_tiers - - */ - - item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; - - /** - * @description Parameters for charges - - */ - - charges?:{amount?:number,amount_in_decimal?:string,avalara_sale_type?:AvalaraSaleType,avalara_service_type?:number,avalara_transaction_type?:number,description?:string,service_period?:number}[]; - - /** - * @description Parameters for discounts - - */ - - discounts?:{amount?:number,apply_on:ApplyOn,item_price_id?:string,percentage?:number}[]; - } export interface EditUpdateSubscriptionQuoteForItemsResponse { quote:Quote; @@ -1109,201 +955,110 @@ Ireland** . The first two characters of the VAT number in such a case is `X item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; } - export interface ListResponse { + export interface CreateForChargeItemsAndChargesResponse { + quote:Quote; + + quoted_charge?:QuotedCharge; + } + export interface CreateForChargeItemsAndChargesInputParam { + /** - * @description List all quotes. + * @description The quote name will be used as the pdf name of the quote. */ - list:{quote:Quote,quoted_subscription?:QuotedSubscription}[]; + name?:string; /** - * @description List all quotes. + * @description Identifier of the customer for which the quote needs to be created. */ - next_offset?:string; - } - export interface ListInputParam { - [key : string]: any; + customer_id:string; + /** - * @description The number of resources to be returned. + * @description Purchase Order Number for this quote. */ - - limit?:number; + + po_number?:string; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Notes specific to this quote that you want customers to see on the quote PDF. */ - - offset?:string; + + notes?:string; /** - * @description Indicates whether to include deleted objects in the list. The deleted objects have the attribute \`deleted\` as \`true\`. + * @description Quotes will be vaild till this date. After this quote will be marked as closed. */ - - include_deleted?:boolean; + + expires_at?:number; /** - * @description The quote number. Acts as a identifier for quote and typically generated sequentially. + * @description The currency code (ISO 4217 format) of the quote. */ - - id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; - /** - * @description The identifier of the customer this quote belongs to. - - */ - - customer_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; - - /** - * @description To filter based on subscription_id. -NOTE: Not to be used if *consolidated invoicing* feature is enabled. - - */ - - subscription_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string}; - - /** - * @description Current status of this quote. - - */ - - status?:{in?:string,is?:'declined' | 'invoiced' | 'accepted' | 'closed' | 'open',is_not?:'declined' | 'invoiced' | 'accepted' | 'closed' | 'open',not_in?:string}; - - /** - * @description Creation date of the quote. Typically this is the date on which quote is generated. - - */ - - date?:{after?:string,before?:string,between?:string,on?:string}; + currency_code?:string; /** - * @description To filter based on updated at. This attribute will be present only if the resource has been updated after 2016-09-28. + * @description The 'One Time' coupon to be applied. */ - - updated_at?:{after?:string,before?:string,between?:string,on?:string}; - /** - * @description List all quotes. - - */ - - sort_by?:{asc?:'date',desc?:'date'}; - } - export interface PdfResponse { - download:Download; - } - export interface PdfInputParam { + coupon?:string; /** - * @description When true, the quote PDF has summary of all charges on the quote. When false, the quote PDF has a detailed view of charges grouped by charge event. This parameter does not affect one-time quotes. + * @description List of Coupons to be added. */ - consolidated_view?:boolean; + coupon_ids?:string[]; /** - * @description Determines the pdf should be rendered as inline or attachment in the browser. \* attachment - PDF is rendered as attachment in the browser \* inline - PDF is rendered as inline in the browser + * @description Parameters for shipping_address */ - disposition_type?:DispositionType; - } - export interface ConvertResponse { - quote:Quote; - - quoted_subscription?:QuotedSubscription; - - quoted_charge?:QuotedCharge; - - customer:Customer; - - subscription?:Subscription; - - invoice?:Invoice; - - credit_note?:CreditNote; - - unbilled_charges?:UnbilledCharge[]; - } - export interface ConvertInputParam { + 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}; /** - * @description The document date displayed on the invoice PDF. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. When not provided, the value is the same as current date. Moreover, if the invoice is created as `pending`, and if the site is configured to set invoice dates to date of closing, then upon invoice closure, this date is changed to the invoice closing date. `taxes` and `line_item_taxes` are computed based on the tax configuration as of `invoice_date`. When passing this parameter, the following prerequisites must be met: - -* `invoice_date` must be in the past. -* `invoice_date` is not more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December. -* The date is not earlier than `quoted_subscription.start_date` or `quoted_subscription.changes_scheduled_at` (whichever is applicable). -* `invoice_immediately` must be `true`. -. + * @description Parameters for item_prices */ - invoice_date?:number; + item_prices?:{item_price_id?:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,unit_price?:number,unit_price_in_decimal?:string}[]; /** - * @description This attribute is set to `true` automatically for the subscription when it has one or more `metered` items. However, when there are no `metered` items, you can pass this parameter as `true` to force all invoices (except the first) to be created as `pending`. This is useful in the following scenarios: - -* When you manage metered billing at your end by calculating usage-based charges yourself and add them to the subscription as [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). -* When your workflow involves inspecting all charges before you close invoices. - -**Note:** - -* You must enable [Metered Billing](https://www.chargebee.com/docs/2.0/metered_billing.html) for this parameter to be acceptable. -* To create the first invoice also as `pending`, pass `first_invoice_pending` as `true`. -. + * @description Parameters for item_tiers */ - create_pending_invoices?:boolean; + item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; /** - * @description Non-metered items are billed at the beginning of a billing cycle while metered items are billed at the end. Consequently, the first invoice of the subscription contains only the non-metered items. - -By passing this parameter as `true`, you create the first invoice as `pending` allowing you to add the previous term's metered charges to it before closing. This is useful when the subscription is moved to Chargebee from a different billing system. As applicable to all `pending` invoices, this invoice is also [closed automatically](https://www.chargebee.com/docs/2.0/metered_billing.html#configuring-metered-billing) or via an [API call](/docs/api/invoices?prod_cat_ver=2#close_a_pending_invoice). -**Note:** - -This parameter is passed only when there are metered items in the subscription or when `create_pending_invoices` is `true`. -. + * @description Parameters for charges */ - first_invoice_pending?:boolean; + charges?:{amount?:number,amount_in_decimal?:string,avalara_sale_type?:AvalaraSaleType,avalara_service_type?:number,avalara_transaction_type?:number,description?:string,service_period?:number}[]; /** - * @description Parameters for subscription + * @description Parameters for discounts */ - subscription?:{auto_close_invoices?:boolean,auto_collection?:AutoCollection,id?:string,po_number?:string}; + discounts?:{amount?:number,apply_on:ApplyOn,item_price_id?:string,percentage?:number}[]; } - export interface CreateForChargeItemsAndChargesResponse { + export interface EditForChargeItemsAndChargesResponse { quote:Quote; quoted_charge?:QuotedCharge; } - export interface CreateForChargeItemsAndChargesInputParam { - - /** - * @description The quote name will be used as the pdf name of the quote. - - */ - - name?:string; - - /** - * @description Identifier of the customer for which the quote needs to be created. - - */ - - customer_id:string; + export interface EditForChargeItemsAndChargesInputParam { /** * @description Purchase Order Number for this quote. @@ -1382,144 +1137,678 @@ This parameter is passed only when there are metered items in the subscription o discounts?:{amount?:number,apply_on:ApplyOn,item_price_id?:string,percentage?:number}[]; } - export interface DeleteResponse { - quote:Quote; - - quoted_subscription?:QuotedSubscription; + export interface ListResponse { + /** + * @description List all quotes. + + */ - quoted_charge?:QuotedCharge; - } - export interface DeleteInputParam { + list:{quote:Quote,quoted_subscription?:QuotedSubscription}[]; /** - * @description Reason for deleting quote. This comment will be added to the subscription entity if the quote belongs to a subscription or added to the customer entity if the quote is associated only with a customer. + * @description List all quotes. */ - comment?:string; + next_offset?:string; } - export interface LineItem { - id?:string; + export interface ListInputParam { + [key : string]: any; + /** + * @description List all quotes. + + */ + + limit?:number; - subscription_id?:string; + /** + * @description List all quotes. + + */ + + offset?:string; - date_from?:number; + /** + * @description List all quotes. + + */ + + include_deleted?:boolean; - date_to?:number; + /** + * @description List all quotes. + + */ + + id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; - unit_amount?:number; + /** + * @description List all quotes. + + */ + + customer_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; - quantity?:number; + /** + * @description List all quotes. + + */ + + subscription_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string}; - amount?:number; + /** + * @description List all quotes. + + */ + + status?:{in?:string,is?:'declined' | 'invoiced' | 'accepted' | 'closed' | 'open',is_not?:'declined' | 'invoiced' | 'accepted' | 'closed' | 'open',not_in?:string}; - pricing_model?:'volume' | 'per_unit' | 'tiered' | 'flat_fee' | 'stairstep'; + /** + * @description List all quotes. + + */ + + date?:{after?:string,before?:string,between?:string,on?:string}; - is_taxed?:boolean; + /** + * @description List all quotes. + + */ + + updated_at?:{after?:string,before?:string,between?:string,on?:string}; - tax_amount?:number; + /** + * @description List all quotes. + + */ + + sort_by?:{asc?:'date',desc?:'date'}; + } + export interface QuoteLineGroupsForQuoteResponse { + /** + * @description This API retrieves all the quote line groups and lineitems for a quote. + + */ - tax_rate?:number; + list:{quote_line_group:QuoteLineGroup}[]; - unit_amount_in_decimal?:string; + /** + * @description This API retrieves all the quote line groups and lineitems for a quote. + + */ - quantity_in_decimal?:string; + next_offset?:string; + } + export interface QuoteLineGroupsForQuoteInputParam { + [key : string]: any; + /** + * @description This API retrieves all the quote line groups and lineitems for a quote. + + */ + + limit?:number; - amount_in_decimal?:string; + /** + * @description This API retrieves all the quote line groups and lineitems for a quote. + + */ + + offset?:string; + } + export interface ConvertResponse { + quote:Quote; - discount_amount?:number; + quoted_subscription?:QuotedSubscription; - item_level_discount_amount?:number; + quoted_charge?:QuotedCharge; - reference_line_item_id?:string; + customer:Customer; - description?:string; + subscription?:Subscription; - entity_description?:string; + invoice?:Invoice; - entity_type?:'addon_item_price' | 'plan_item_price' | 'charge_item_price' | 'adhoc'; + credit_note?:CreditNote; - tax_exempt_reason?:'high_value_physical_goods' | 'tax_not_configured' | 'reverse_charge' | 'zero_rated' | 'customer_exempt' | 'region_non_taxable' | 'zero_value_item' | 'export' | 'product_exempt'; + unbilled_charges?:UnbilledCharge[]; + } + export interface ConvertInputParam { + + /** + * @description The document date displayed on the invoice PDF. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. When not provided, the value is the same as current date. Moreover, if the invoice is created as `pending`, and if the site is configured to set invoice dates to date of closing, then upon invoice closure, this date is changed to the invoice closing date. `taxes` and `line_item_taxes` are computed based on the tax configuration as of `invoice_date`. When passing this parameter, the following prerequisites must be met: + +* `invoice_date` must be in the past. +* `invoice_date` is not more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December. +* The date is not earlier than `quoted_subscription.start_date` or `quoted_subscription.changes_scheduled_at` (whichever is applicable). +* `invoice_immediately` must be `true`. +. + + */ + + invoice_date?:number; + + /** + * @description This attribute is set to `true` automatically for the subscription when it has one or more `metered` items. However, when there are no `metered` items, you can pass this parameter as `true` to force all invoices (except the first) to be created as `pending`. This is useful in the following scenarios: + +* When you manage metered billing at your end by calculating usage-based charges yourself and add them to the subscription as [one-time charges](https://www.chargebee.com/docs/2.0/charges.html). +* When your workflow involves inspecting all charges before you close invoices. + +**Note:** + +* You must enable [Metered Billing](https://www.chargebee.com/docs/2.0/metered_billing.html) for this parameter to be acceptable. +* To create the first invoice also as `pending`, pass `first_invoice_pending` as `true`. +. + + */ + + create_pending_invoices?:boolean; + + /** + * @description Non-metered items are billed at the beginning of a billing cycle while metered items are billed at the end. Consequently, the first invoice of the subscription contains only the non-metered items. + +By passing this parameter as `true`, you create the first invoice as `pending` allowing you to add the previous term's metered charges to it before closing. This is useful when the subscription is moved to Chargebee from a different billing system. As applicable to all `pending` invoices, this invoice is also [closed automatically](https://www.chargebee.com/docs/2.0/metered_billing.html#configuring-metered-billing) or via an [API call](/docs/api/invoices?prod_cat_ver=2#close_a_pending_invoice). +**Note:** + +This parameter is passed only when there are metered items in the subscription or when `create_pending_invoices` is `true`. +. + + */ + + first_invoice_pending?:boolean; + + /** + * @description Parameters for subscription + + */ + + subscription?:{auto_close_invoices?:boolean,auto_collection?:AutoCollection,id?:string,po_number?:string}; + } + export interface UpdateStatusResponse { + quote:Quote; + + quoted_subscription?:QuotedSubscription; + + quoted_charge?:QuotedCharge; + } + export interface UpdateStatusInputParam { + + /** + * @description Status to update for the quote. \* accepted - Accepted. \* closed - Closed \* declined - Declined. + + */ + + status:'declined' | 'accepted' | 'closed'; + + /** + * @description An internal [comment](./comments) to be added for this operation, to the quote. This comment is displayed on the Chargebee UI. It is not displayed on any customer-facing [Hosted Page](./hosted_pages) or any document such as the [Quote PDF](./quotes#retrieve_quote_as_pdf). + + */ + + comment?:string; + } + export interface ExtendExpiryDateResponse { + quote:Quote; + + quoted_subscription?:QuotedSubscription; + + quoted_charge?:QuotedCharge; + } + export interface ExtendExpiryDateInputParam { + + /** + * @description Quote will be valid till this date. After this date quote will be marked as closed. + + */ + + valid_till:number; + } + export interface DeleteResponse { + quote:Quote; + + quoted_subscription?:QuotedSubscription; + + quoted_charge?:QuotedCharge; + } + export interface DeleteInputParam { + + /** + * @description Reason for deleting quote. This comment will be added to the subscription entity if the quote belongs to a subscription or added to the customer entity if the quote is associated only with a customer. + + */ + + comment?:string; + } + export interface PdfResponse { + download:Download; + } + export interface PdfInputParam { + + /** + * @description When true, the quote PDF has summary of all charges on the quote. When false, the quote PDF has a detailed view of charges grouped by charge event. This parameter does not affect one-time quotes. + + */ + + consolidated_view?:boolean; + + /** + * @description Determines the pdf should be rendered as inline or attachment in the browser. \* attachment - PDF is rendered as attachment in the browser \* inline - PDF is rendered as inline in the browser + + */ + + disposition_type?:DispositionType; + } + export interface LineItem { + /** + * @description Uniquely identifies a line_item + + */ + + id?:string; + + /** + * @description A unique identifier for the subscription this line item belongs to. + + */ + + subscription_id?:string; + + /** + * @description Start date of this line item. + + */ + + date_from:number; + + /** + * @description End date of this line item. + + */ + + date_to:number; + + /** + * @description Unit amount of the line item. + + */ + + unit_amount:number; + + /** + * @description [Quantity of the recurring item](/docs/api/invoices?prod_cat_ver=2#invoice_line_items_quantity) which is represented by this line item. For `metered` line items, this value is updated from [usages](/docs/api/usages) once when the invoice is generated as `pending` and finally when the invoice is [closed](/docs/api/invoices#close_a_pending_invoice). + + */ + + quantity?:number; + + /** + * @description Total amount of this line item. Typically equals to unit amount x quantity + + */ + + amount?:number; + + /** + * @description The [pricing scheme](https://www.chargebee.com/docs/2.0/plans.html#pricing-models) for this item price. \* per_unit - A fixed price per unit quantity. \* stairstep - A quantity-based pricing scheme. The item is charged a fixed price based on the tier that the total quantity falls in. \* flat_fee - A fixed price that is not quantity-based. \* tiered - The per unit price is based on the tier that the total quantity falls in. \* volume - There are quantity tiers for which per unit prices are set. Quantities are purchased from successive tiers. + + */ + + pricing_model?:'volume' | 'per_unit' | 'tiered' | 'flat_fee' | 'stairstep'; + + /** + * @description Specifies whether this line item is taxed or not + + */ + + is_taxed:boolean; + + /** + * @description The tax amount charged for this item + + */ + + tax_amount?:number; + + /** + * @description Rate of tax used to calculate tax for this lineitem + + */ + + tax_rate?:number; + + /** + * @description The decimal representation of the unit amount of the `line_item`. The value is in major units of the currency. Returned when the `line_item` is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + + unit_amount_in_decimal?:string; + + /** + * @description The decimal representation of the quantity of this line_item. Returned when the `line_item` is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + + quantity_in_decimal?:string; + + /** + * @description The decimal representation of the amount for the `line_item`, in major units of the currency. Typically equals to `unit_amount_in_decimal` x `quantity_in_decimal`. Returned when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + + amount_in_decimal?:string; + + /** + * @description Total discounts for this line + + */ + + discount_amount?:number; + + /** + * @description Line Item-level discounts for this line. + + */ + + item_level_discount_amount?:number; + + /** + * @description Invoice Reference Line Item ID + + */ + + reference_line_item_id?:string; + + /** + * @description Detailed description about this line item. + + */ + + description:string; + + /** + * @description Detailed description about this item. + + */ + + entity_description?:string; + + /** + * @description Specifies the modelled entity this line item is based on. \* addon - Indicates that this lineitem is based on 'Addon' entity. The 'entity_id' attribute specifies the [addon](/docs/api/addons#addon_attributes) id \* plan_item_price - Indicates that this line item is based on plan Item Price \* addon_item_price - Indicates that this line item is based on addon Item Price \* charge_item_price - Indicates that this line item is based on charge Item Price \* adhoc - Indicates that this lineitem is not modelled. i.e created adhoc. So the 'entity_id' attribute will be null in this case \* plan_setup - Indicates that this lineitem is based on 'Plan Setup' charge. The 'entity_id' attribute specifies the [plan](/docs/api/plans#plan_attributes) id \* plan - Indicates that this lineitem is based on 'Plan' entity. The 'entity_id' attribute specifies the [plan](/docs/api/plans#plan_attributes) id + + */ + + entity_type:'addon_item_price' | 'plan_item_price' | 'charge_item_price' | 'adhoc'; + + /** + * @description The reason due to which the line item price/amount is exempted from tax. \* zero_value_item - If the total invoice value/amount is equal to zero. E.g., If the total order value is $10 and a $10 coupon has been applied against that order, the total order value becomes $0. Hence the invoice value also becomes $0. \* reverse_charge - If the Customer is identified as B2B customer (when VAT Number is entered), applicable for EU only \* tax_not_configured - If tax is not enabled for the site \* high_value_physical_goods - If physical goods are sold from outside Australia to customers in Australia, and the price of all the physical good line items is greater than AUD 1000, then tax will not be applied \* product_exempt - If the Plan or Addon is marked as Tax exempt \* zero_rated - If the rate of tax is 0% and no Sales/ GST tax is collectable for that line item \* customer_exempt - If the Customer is marked as Tax exempt \* region_non_taxable - If the product sold is not taxable in this region, but it is taxable in other regions, hence this region is not part of the Taxable jurisdiction \* export - You are not registered for tax in the customer's region. This is also the reason code when both `billing_address` and `shipping_address` have not been provided for the customer and subscription respectively + + */ + + tax_exempt_reason?:'high_value_physical_goods' | 'tax_not_configured' | 'reverse_charge' | 'zero_rated' | 'customer_exempt' | 'region_non_taxable' | 'zero_value_item' | 'export' | 'product_exempt'; + + /** + * @description The identifier of the modelled entity this line item is based on. Will be null for 'adhoc' entity type + + */ entity_id?:string; + /** + * @description A unique identifier for the customer this line item belongs to + + */ + customer_id?:string; } export interface Discount { - amount?:number; + /** + * @description The amount deducted. The format of this value depends on the [kind of currency](/docs/api?prod_cat_ver=2#currencies). + + */ + + amount:number; + + /** + * @description Description for this deduction. + + */ description?:string; + /** + * @description The unique id of the line item that this deduction is for. Is required when `discounts[entity_type]` is `item_level_coupon` or `document_level_coupon`. + + */ + line_item_id?:string; - entity_type?:'item_level_coupon' | 'promotional_credits' | 'item_level_discount' | 'prorated_credits' | 'document_level_discount' | 'document_level_coupon'; + /** + * @description The type of deduction and the amount to which it is applied. \* document_level_coupon - The deduction is due to a coupon applied to the invoice `sub_total`. The coupon id is passed as `entity_id`. \* prorated_credits - The deduction is due to a legacy adjustment credit applied to the invoice. The `entity_id` is `null` in this case. The legacy credits feature is superseded by [adjustment_credit_notes](/docs/api/invoices?prod_cat_ver=2#invoice_adjustment_credit_notes). \* item_level_coupon - The deduction is due to a coupon applied to line item. The coupon `id` is passed as `entity_id`. \* item_level_discount - The deduction is due to a [discount](/docs/api/discounts?prod_cat_ver=2) applied to a line item of the invoice. The discount `id` is available as the `entity_id`. \* promotional_credits - The deduction is due to a [promotional credit](/docs/api/promotional_credits?prod_cat_ver=2) applied to the invoice. \* document_level_discount - The deduction is due to a [discount](/docs/api/discounts?prod_cat_ver=2) applied to the invoice `sub_total`. The discount `id` is available as the `entity_id`. + + */ + + entity_type:'item_level_coupon' | 'promotional_credits' | 'item_level_discount' | 'prorated_credits' | 'document_level_discount' | 'document_level_coupon'; + + /** + * @description The type of discount that is applied to the line item. Relevant only when `discounts[entity_type]` is one of `item_level_discount` , `item_level_coupon`, `document_level_discount`, or `document_level_coupon` \* percentage - when percentage is applied as discount \* fixed_amount - when amount is applied as discount + + */ discount_type?:'fixed_amount' | 'percentage'; + /** + * @description When the deduction is due to a `coupon` or a [discount](discounts), then this is the `id` of the coupon or discount. + + */ + entity_id?:string; + /** + * @description The [coupon code](/docs/api/coupon_codes#coupon_code_code), if applicable, used to provide the discount. The [coupon.id](/docs/api/coupons#coupon_id) is available in `entity_id`. + + */ + coupon_set_code?:string; } export interface LineItemDiscount { - line_item_id?:string; + /** + * @description The unique id of the line item that this deduction is for. + + */ - discount_type?:'item_level_coupon' | 'promotional_credits' | 'item_level_discount' | 'prorated_credits' | 'document_level_discount' | 'document_level_coupon'; + line_item_id:string; + + /** + * @description The type of deduction and the amount to which it is applied. \* item_level_coupon - The deduction is due to a coupon applied to a line item of the invoice. The coupon `id` is available as `entity_id`. \* prorated_credits - The deduction is due to a legacy adjustment credit applied to the invoice. The `entity_id` is `null` in this case. The legacy credits feature is superseded by [adjustment_credit_notes](/docs/api/invoices?prod_cat_ver=2#invoice_adjustment_credit_notes). \* document_level_coupon - The deduction is due to a coupon applied to the invoice `sub_total`. The coupon `id` is available as `entity_id`. \* document_level_discount - The deduction is due to a [discount](/docs/api/discounts?prod_cat_ver=2) applied to the invoice `sub_total`. The discount `id` is available as the `entity_id`. \* item_level_discount - The deduction is due to a [discount](/docs/api/discounts?prod_cat_ver=2) applied to a line item of the invoice. The discount `id` is available as the `entity_id`. \* promotional_credits - The deduction is due to a [promotional credit](/docs/api/promotional_credits) applied to the invoice. The `entity_id` is `null` in this case. + + */ + + discount_type:'item_level_coupon' | 'promotional_credits' | 'item_level_discount' | 'prorated_credits' | 'document_level_discount' | 'document_level_coupon'; coupon_id?:string; + /** + * @description When the deduction is due to a `coupon` or a [discount](discounts), then this is the `id` of the coupon or discount. + + */ + entity_id?:string; - discount_amount?:number; + /** + * @description The amount deducted. The format of this value depends on the [kind of currency](/docs/api#currencies). + + */ + + discount_amount:number; } export interface Tax { - name?:string; + /** + * @description The name of the tax applied. E.g. GST. + + */ - amount?:number; + name:string; + + /** + * @description The tax amount. + + */ + + amount:number; + + /** + * @description Description of the tax item. + + */ description?:string; } export interface LineItemTax { + /** + * @description The unique reference id of the line item for which the tax is applicable + + */ + line_item_id?:string; - tax_name?:string; + /** + * @description The name of the tax applied + + */ + + tax_name:string; - tax_rate?:number; + /** + * @description The rate of tax used to calculate tax amount + + */ + + tax_rate:number; + + /** + * @description Indicates if tax is applied only on a portion of the line item amount. + + */ is_partial_tax_applied?:boolean; + /** + * @description Indicates the non-compliance tax that should not be reported to the jurisdiction. + + */ + is_non_compliance_tax?:boolean; - taxable_amount?:number; + /** + * @description Indicates the actual portion of the line item amount that is taxable. + + */ - tax_amount?:number; + taxable_amount:number; + + /** + * @description The tax amount + + */ + + tax_amount:number; + + /** + * @description The type of tax jurisdiction \* unincorporated - Combined tax of state and county. \* federal - The tax jurisdiction is a federal \* state - The tax jurisdiction is a state \* county - The tax jurisdiction is a county \* country - The tax jurisdiction is a country \* city - The tax jurisdiction is a city \* other - Jurisdictions other than the ones listed above. \* special - Special tax jurisdiction. + + */ tax_juris_type?:'special' | 'country' | 'unincorporated' | 'other' | 'city' | 'federal' | 'county' | 'state'; + /** + * @description The name of the tax jurisdiction + + */ + tax_juris_name?:string; + /** + * @description The tax jurisdiction code + + */ + tax_juris_code?:string; + /** + * @description Total tax amount in the currency of the place of supply. This is applicable only for Invoice and Credit Notes API. + + */ + tax_amount_in_local_currency?:number; + /** + * @description The currency code (ISO 4217 format) of the place of supply in which VAT needs to be converted and displayed. This is applicable only for Invoice and Credit Notes API. + + */ + local_currency_code?:string; } export interface LineItemTier { + /** + * @description Uniquely identifies a line_item + + */ + line_item_id?:string; - starting_unit?:number; + /** + * @description The lower limit of a range of units for the tier + + */ + + starting_unit:number; + + /** + * @description The upper limit of a range of units for the tier + + */ ending_unit?:number; - quantity_used?:number; + /** + * @description The number of units purchased in a range. + + */ + + quantity_used:number; + + /** + * @description The price of the tier if the charge model is a `stairtstep` pricing , or the price of each unit in the tier if the charge model is `tiered`/`volume` pricing. + + */ + + unit_amount:number; - unit_amount?:number; + /** + * @description The decimal representation of the the lowest value of quantity in this tier. This is zero for the lowest tier. For all other tiers, it is the same as `ending_unit_in_decimal` of the next lower tier. Returned only when the `line_items.pricing_model` is `tiered`, `volume` or `stairstep` and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ starting_unit_in_decimal?:string; + /** + * @description The decimal representation of the highest value of quantity in this tier. This attribute is not applicable for the highest tier. For all other tiers, it must be equal to the `starting_unit_in_decimal` of the next higher tier. Returned only when the `line_items.pricing_model` is `tiered`, `volume` or stairstep and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + ending_unit_in_decimal?:string; + /** + * @description The decimal representation of the quantity purchased from this tier. Returned when the `line_item` is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + quantity_used_in_decimal?:string; + /** + * @description The decimal representation of the per-unit price for the tier when the `pricing_model` is `tiered` or `volume`. When the `pricing_model` is `stairstep`, it is the decimal representation of the total price for `line_item`. The value is in major units of the currency. Returned when the `line_item` is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + unit_amount_in_decimal?:string; } export interface ShippingAddress { @@ -1633,7 +1922,7 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - index?:number; + index:number; } export interface BillingAddress { /** diff --git a/types/resources/QuoteLineGroup.d.ts b/types/resources/QuoteLineGroup.d.ts index 3c03d92..91816c1 100644 --- a/types/resources/QuoteLineGroup.d.ts +++ b/types/resources/QuoteLineGroup.d.ts @@ -104,108 +104,353 @@ declare module 'chargebee' { export interface LineItem { + /** + * @description Uniquely identifies a line_item + + */ + id?:string; + /** + * @description A unique identifier for the subscription this line item belongs to. + + */ + subscription_id?:string; + /** + * @description Start date of this line item. + + */ + date_from?:number; + /** + * @description End date of this line item. + + */ + date_to?:number; + /** + * @description Unit amount of the line item. + + */ + unit_amount?:number; + /** + * @description [Quantity of the recurring item](/docs/api/invoices?prod_cat_ver=2#invoice_line_items_quantity) which is represented by this line item. For `metered` line items, this value is updated from [usages](/docs/api/usages) once when the invoice is generated as `pending` and finally when the invoice is [closed](/docs/api/invoices#close_a_pending_invoice). + + */ + quantity?:number; + /** + * @description Total amount of this line item. Typically equals to unit amount x quantity + + */ + amount?:number; + /** + * @description The [pricing scheme](https://www.chargebee.com/docs/2.0/plans.html#pricing-models) for this item price. \* per_unit - A fixed price per unit quantity. \* stairstep - A quantity-based pricing scheme. The item is charged a fixed price based on the tier that the total quantity falls in. \* flat_fee - A fixed price that is not quantity-based. \* tiered - The per unit price is based on the tier that the total quantity falls in. \* volume - There are quantity tiers for which per unit prices are set. Quantities are purchased from successive tiers. + + */ + pricing_model?:'volume' | 'per_unit' | 'tiered' | 'flat_fee' | 'stairstep'; + /** + * @description Specifies whether this line item is taxed or not + + */ + is_taxed?:boolean; + /** + * @description The tax amount charged for this item + + */ + tax_amount?:number; + /** + * @description Rate of tax used to calculate tax for this lineitem + + */ + tax_rate?:number; + /** + * @description The decimal representation of the unit amount of the `line_item`. The value is in major units of the currency. Returned when the `line_item` is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + unit_amount_in_decimal?:string; + /** + * @description The decimal representation of the quantity of this line_item. Returned when the `line_item` is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + quantity_in_decimal?:string; + /** + * @description The decimal representation of the amount for the `line_item`, in major units of the currency. Typically equals to `unit_amount_in_decimal` x `quantity_in_decimal`. Returned when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + amount_in_decimal?:string; + /** + * @description Total discounts for this line + + */ + discount_amount?:number; + /** + * @description Line Item-level discounts for this line. + + */ + item_level_discount_amount?:number; + /** + * @description Invoice Reference Line Item ID + + */ + reference_line_item_id?:string; + /** + * @description Detailed description about this line item. + + */ + description?:string; + /** + * @description Detailed description about this item. + + */ + entity_description?:string; + /** + * @description Specifies the modelled entity this line item is based on. \* addon - Indicates that this lineitem is based on 'Addon' entity. The 'entity_id' attribute specifies the [addon](/docs/api/addons#addon_attributes) id \* plan_item_price - Indicates that this line item is based on plan Item Price \* addon_item_price - Indicates that this line item is based on addon Item Price \* charge_item_price - Indicates that this line item is based on charge Item Price \* adhoc - Indicates that this lineitem is not modelled. i.e created adhoc. So the 'entity_id' attribute will be null in this case \* plan_setup - Indicates that this lineitem is based on 'Plan Setup' charge. The 'entity_id' attribute specifies the [plan](/docs/api/plans#plan_attributes) id \* plan - Indicates that this lineitem is based on 'Plan' entity. The 'entity_id' attribute specifies the [plan](/docs/api/plans#plan_attributes) id + + */ + entity_type?:'addon_item_price' | 'plan_item_price' | 'charge_item_price' | 'adhoc'; + /** + * @description The reason due to which the line item price/amount is exempted from tax. \* reverse_charge - If the Customer is identified as B2B customer (when VAT Number is entered), applicable for EU only \* tax_not_configured - If tax is not enabled for the site \* high_value_physical_goods - If physical goods are sold from outside Australia to customers in Australia, and the price of all the physical good line items is greater than AUD 1000, then tax will not be applied \* product_exempt - If the Plan or Addon is marked as Tax exempt \* zero_rated - If the rate of tax is 0% and no Sales/ GST tax is collectable for that line item \* customer_exempt - If the Customer is marked as Tax exempt \* region_non_taxable - If the product sold is not taxable in this region, but it is taxable in other regions, hence this region is not part of the Taxable jurisdiction \* export - You are not registered for tax in the customer's region. This is also the reason code when both `billing_address` and `shipping_address` have not been provided for the customer and subscription respectively + + */ + tax_exempt_reason?:'high_value_physical_goods' | 'tax_not_configured' | 'reverse_charge' | 'zero_rated' | 'customer_exempt' | 'region_non_taxable' | 'zero_value_item' | 'export' | 'product_exempt'; + /** + * @description The identifier of the modelled entity this line item is based on. Will be null for 'adhoc' entity type + + */ + entity_id?:string; + /** + * @description A unique identifier for the customer this line item belongs to + + */ + customer_id?:string; } export interface Discount { + /** + * @description The amount deducted. The format of this value depends on the [kind of currency](/docs/api?prod_cat_ver=2#currencies). + + */ + amount?:number; + /** + * @description Description for this deduction. + + */ + description?:string; + /** + * @description The unique id of the line item that this deduction is for. Is required when `discounts[entity_type]` is `item_level_coupon` or `document_level_coupon`. + + */ + line_item_id?:string; + /** + * @description The type of deduction and the amount to which it is applied. \* document_level_coupon - The deduction is due to a coupon applied to the invoice `sub_total`. The coupon id is passed as `entity_id`. \* prorated_credits - The deduction is due to a legacy adjustment credit applied to the invoice. The `entity_id` is `null` in this case. The legacy credits feature is superseded by [adjustment_credit_notes](/docs/api/invoices?prod_cat_ver=2#invoice_adjustment_credit_notes). \* item_level_coupon - The deduction is due to a coupon applied to line item. The coupon `id` is passed as `entity_id`. \* item_level_discount - The deduction is due to a [discount](/docs/api/discounts?prod_cat_ver=2) applied to a line item of the invoice. The discount `id` is available as the `entity_id`. \* promotional_credits - The deduction is due to a [promotional credit](/docs/api/promotional_credits?prod_cat_ver=2) applied to the invoice. \* document_level_discount - The deduction is due to a [discount](/docs/api/discounts?prod_cat_ver=2) applied to the invoice `sub_total`. The discount `id` is available as the `entity_id`. + + */ + entity_type?:'item_level_coupon' | 'promotional_credits' | 'item_level_discount' | 'prorated_credits' | 'document_level_discount' | 'document_level_coupon'; + /** + * @description The type of discount that is applied to the line item. Relevant only when `discounts[entity_type]` is one of `item_level_discount` , `item_level_coupon`, `document_level_discount`, or `document_level_coupon` \* percentage - when percentage is applied as discount \* fixed_amount - when amount is applied as discount + + */ + discount_type?:'fixed_amount' | 'percentage'; + /** + * @description When the deduction is due to a `coupon` or a [discount](discounts), then this is the `id` of the coupon or discount. + + */ + entity_id?:string; + /** + * @description The [coupon code](/docs/api/coupon_codes#coupon_code_code), if applicable, used to provide the discount. The [coupon.id](/docs/api/coupons#coupon_id) is available in `entity_id`. + + */ + coupon_set_code?:string; } export interface LineItemDiscount { + /** + * @description The unique id of the line item that this deduction is for. + + */ + line_item_id?:string; + /** + * @description The type of deduction and the amount to which it is applied. \* item_level_coupon - The deduction is due to a coupon applied to a line item of the invoice. The coupon `id` is available as `entity_id`. \* prorated_credits - The deduction is due to a legacy adjustment credit applied to the invoice. The `entity_id` is `null` in this case. The legacy credits feature is superseded by [adjustment_credit_notes](/docs/api/invoices?prod_cat_ver=2#invoice_adjustment_credit_notes). \* document_level_coupon - The deduction is due to a coupon applied to the invoice `sub_total`. The coupon `id` is available as `entity_id`. \* document_level_discount - The deduction is due to a [discount](/docs/api/discounts?prod_cat_ver=2) applied to the invoice `sub_total`. The discount `id` is available as the `entity_id`. \* item_level_discount - The deduction is due to a [discount](/docs/api/discounts?prod_cat_ver=2) applied to a line item of the invoice. The discount `id` is available as the `entity_id`. \* promotional_credits - The deduction is due to a [promotional credit](/docs/api/promotional_credits) applied to the invoice. The `entity_id` is `null` in this case. + + */ + discount_type?:'item_level_coupon' | 'promotional_credits' | 'item_level_discount' | 'prorated_credits' | 'document_level_discount' | 'document_level_coupon'; coupon_id?:string; + /** + * @description When the deduction is due to a `coupon` or a [discount](discounts), then this is the `id` of the coupon or discount. + + */ + entity_id?:string; + /** + * @description The amount deducted. The format of this value depends on the [kind of currency](/docs/api#currencies). + + */ + discount_amount?:number; } export interface Tax { + /** + * @description The name of the tax applied. E.g. GST. + + */ + name?:string; + /** + * @description The tax amount. + + */ + amount?:number; + /** + * @description Description of the tax item. + + */ + description?:string; } export interface LineItemTax { + /** + * @description The unique reference id of the line item for which the tax is applicable + + */ + line_item_id?:string; + /** + * @description The name of the tax applied + + */ + tax_name?:string; + /** + * @description The rate of tax used to calculate tax amount + + */ + tax_rate?:number; + /** + * @description Indicates if tax is applied only on a portion of the line item amount. + + */ + is_partial_tax_applied?:boolean; + /** + * @description Indicates the non-compliance tax that should not be reported to the jurisdiction. + + */ + is_non_compliance_tax?:boolean; + /** + * @description Indicates the actual portion of the line item amount that is taxable. + + */ + taxable_amount?:number; + /** + * @description The tax amount + + */ + tax_amount?:number; + /** + * @description The type of tax jurisdiction \* unincorporated - Combined tax of state and county. \* federal - The tax jurisdiction is a federal \* state - The tax jurisdiction is a state \* county - The tax jurisdiction is a county \* country - The tax jurisdiction is a country \* city - The tax jurisdiction is a city \* other - Jurisdictions other than the ones listed above. \* special - Special tax jurisdiction. + + */ + tax_juris_type?:'special' | 'country' | 'unincorporated' | 'other' | 'city' | 'federal' | 'county' | 'state'; + /** + * @description The name of the tax jurisdiction + + */ + tax_juris_name?:string; + /** + * @description The tax jurisdiction code + + */ + tax_juris_code?:string; + /** + * @description Total tax amount in the currency of the place of supply. This is applicable only for Invoice and Credit Notes API. + + */ + tax_amount_in_local_currency?:number; + /** + * @description The currency code (ISO 4217 format) of the place of supply in which VAT needs to be converted and displayed. This is applicable only for Invoice and Credit Notes API. + + */ + local_currency_code?:string; } } diff --git a/types/resources/QuotedCharge.d.ts b/types/resources/QuotedCharge.d.ts index db995d0..9670a1f 100644 --- a/types/resources/QuotedCharge.d.ts +++ b/types/resources/QuotedCharge.d.ts @@ -41,74 +41,244 @@ declare module 'chargebee' { export interface Charge { + /** + * @description The amount to be charged. The unit depends on the [type of currency](/docs/api?prod_cat_ver=1#md_disabled). + + */ + amount?:number; + /** + * @description The decimal representation of the amount for the one-time charge. The value is in [major units of the currency](/docs/api#md_enabled). Applicable only when multi-decimal pricing is enabled. + + */ + amount_in_decimal?:string; + /** + * @description Description for this charge + + */ + description?:string; + /** + * @description Specifies the service period of the charge in days. When the quote is converted, the [invoice.line_item.date_from](/docs/api/invoices#invoice_line_items) is set to current date/time and `invoice.line_item.date_to` is set to `service_period_in_days` ahead of `date_from`. + + */ + service_period_in_days?:number; + /** + * @description Indicates the type of sale carried out. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. \* wholesale - Transaction is a sale to another company that will resell your product or service to another consumer \* retail - Transaction is a sale to an end user \* consumed - Transaction is for an item that is consumed directly \* vendor_use - Transaction is for an item that is subject to vendor use tax + + */ + avalara_sale_type?:'consumed' | 'wholesale' | 'vendor_use' | 'retail'; + /** + * @description Indicates the type of product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. + + */ + avalara_transaction_type?:number; + /** + * @description Indicates the type of service for the product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. + + */ + avalara_service_type?:number; } export interface ItemPrice { + /** + * @description A unique ID for your system to identify the item price. + + */ + item_price_id?:string; + /** + * @description Item price quantity + + */ + quantity?:number; + /** + * @description The decimal representation of the quantity of the item purchased. Can be provided for quantity-based item prices and only when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + quantity_in_decimal?:string; + /** + * @description The price or per-unit-price of the item price. By default, it is the [value set](/docs/api/item_prices#item_price_price) for the `item_price`. This is only applicable when the `pricing_model` of the `item_price` is `flat_fee` or `per_unit`. The value depends on the [type of currency](/docs/api/#handling_currency_units). + + */ + unit_price?:number; + /** + * @description The decimal representation of the price or per-unit price of the plan. The value is in major units of the currency. Always returned when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + unit_price_in_decimal?:string; + /** + * @description Defines service period of the item in days from the day of charge. + + */ + service_period_days?:number; } export interface ItemTier { + /** + * @description The id of the item price to which this tier belongs. + + */ + item_price_id?:string; + /** + * @description The lowest value in the quantity tier. + + */ + starting_unit?:number; + /** + * @description The highest value in the quantity tier. + + */ + ending_unit?:number; + /** + * @description The per-unit price for the tier when the `pricing_model` is `tiered` or `volume`. The total cost for the item price when the `pricing_model` is `stairstep`. The value is in the minor unit of the currency. + + */ + price?:number; + /** + * @description The decimal representation of the the lowest value of quantity in this tier. This is zero for the lowest tier. For all other tiers, it is the same as `ending_unit_in_decimal` of the next lower tier. Returned only when the pricing_model is `tiered`, `volume` or `stairstep` and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + starting_unit_in_decimal?:string; + /** + * @description The decimal representation of the highest value of quantity in this tier. This attribute is not applicable for the highest tier. For all other tiers, it must be equal to the `starting_unit_in_decimal` of the next higher tier. Returned only when the pricing_model is `tiered`, `volume` or `stairstep` and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + ending_unit_in_decimal?:string; + /** + * @description The decimal representation of the per-unit price for the tier when the `pricing_model` is `tiered` or `volume`. When the `pricing_model` is `stairstep`, it is the decimal representation of the total price for the item. The value is in major units of the currency. Returned when the plan is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + price_in_decimal?:string; + /** + * @description The index number of the subscription to which the item price is added. Provide a unique number between `0` and `4` (inclusive) for each subscription that is to be created. + + */ + index?:number; } export interface Coupon { + /** + * @description Used to uniquely identify the coupon + + */ + coupon_id?:string; } export interface Discount { + /** + * @description An immutable unique id for the discount. It is always auto-generated. + + */ + id?:string; + /** + * @description The name of the discount as it should appear on customer-facing pages and documents such as [invoices](/docs/api/invoices?prod_cat_ver=2) and [hosted pages](/docs/api/hosted_pages?prod_cat_ver=2). This is auto-generated based on the `type`, `amount`, and `currency_code` of the discount. For example, it can be `10% off` or `10$ off`. + + */ + invoice_name?:string; + /** + * @description The type of discount. Possible value are: \* percentage - The specified percentage will be given as discount. \* fixed_amount - The specified amount will be given as discount. + + */ + type?:'fixed_amount' | 'percentage'; + /** + * @description The percentage of the original amount that should be deducted from it. Only applicable when `discount.type` is percentage. + + */ + percentage?:number; + /** + * @description The value of the discount. [The format of this value](https://apidocs.chargebee.com/docs/api?prod_cat_ver=2#currencies) depends on the kind of currency. This is only applicable when `discount.type` is `fixed_amount`. + + */ + amount?:number; + /** + * @description The currency code ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html)) of the discount. This is only applicable when `discount.type` is `fixed_amount`. + + */ + currency_code?:string; + /** + * @description The amount on the invoice to which the discount is applied. \* invoice_amount - The discount is applied to the invoice `sub_total`. \* specific_item_price - The discount is applied to the `invoice.line_item.amount` that corresponds to the item price specified by `item_price_id`. + + */ + apply_on?:'specific_item_price' | 'invoice_amount'; + /** + * @description The [id of the item price](/docs/api/subscriptions?prod_cat_ver=2#subscription_subscription_items_item_price_id) in the subscription to which the discount is to be applied. Relevant only when `apply_on` = `specific_item_price`. + + */ + item_price_id?:string; + /** + * @description Timestamp indicating when this discount is created. + + */ + created_at?:number; + /** + * @description Used to uniquely identify the coupon in your website/application and to integrate with Chargebee. +**Note:** + + +When the coupon ID contains a special character; for example: `#`, the API returns an error. +Make sure that you [encode](https://www.urlencoder.org/) the coupon ID in the path parameter before making an API call. + + */ + coupon_id?:string; + /** + * @description The index number of the subscription to which the item price is added. Provide a unique number between `0` and `4` (inclusive) for each subscription that is to be created. + + */ + index?:number; } } diff --git a/types/resources/QuotedSubscription.d.ts b/types/resources/QuotedSubscription.d.ts index 5c1f985..f7d952c 100644 --- a/types/resources/QuotedSubscription.d.ts +++ b/types/resources/QuotedSubscription.d.ts @@ -128,91 +128,310 @@ declare module 'chargebee' { export interface Coupon { + /** + * @description Used to uniquely identify the coupon + + */ + coupon_id?:string; } export interface Discount { + /** + * @description An immutable unique id for the discount. It is always auto-generated. + + */ + id?:string; + /** + * @description The name of the discount as it should appear on customer-facing pages and documents such as [invoices](/docs/api/invoices?prod_cat_ver=2) and [hosted pages](/docs/api/hosted_pages?prod_cat_ver=2). This is auto-generated based on the `type`, `amount`, and `currency_code` of the discount. For example, it can be `10% off` or `10$ off`. + + */ + invoice_name?:string; + /** + * @description The type of discount. Possible value are: \* fixed_amount - The specified amount will be given as discount. \* percentage - The specified percentage will be given as discount. + + */ + type?:'fixed_amount' | 'percentage'; + /** + * @description The percentage of the original amount that should be deducted from it. Only applicable when `discount.type` is percentage. + + */ + percentage?:number; + /** + * @description The value of the discount. [The format of this value](https://apidocs.chargebee.com/docs/api?prod_cat_ver=2#currencies) depends on the kind of currency. This is only applicable when `discount.type` is `fixed_amount`. + + */ + amount?:number; + /** + * @description The currency code ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html)) of the discount. This is only applicable when `discount.type` is `fixed_amount`. + + */ + currency_code?:string; + /** + * @description Specifies the time duration for which this discount is attached to the subscription. \* forever - The discount is attached to the subscription and applied on the invoices till it is [explicitly removed](/docs/api/subscriptions?prod_cat_ver=2#update_subscription_for_items_discounts_operation_type). \* one_time - The discount stays attached to the subscription till it is applied on an invoice **once** . It is removed after that from the subscription. \* limited_period - The discount is attached to the subscription and applied on the invoices for a limited duration. This duration starts from the point it is applied to an invoice for the first time and expires after a period specified by `period` and `period_unit`. + + */ + duration_type?:'limited_period' | 'one_time' | 'forever'; + /** + * @description The duration of time for which the discount is attached to the subscription, in `period_units`. Applicable only when `duration_type` is `limited_period`. + + */ + period?:number; + /** + * @description The unit of time for `period`. Applicable only when `duration_type` is `limited_period`. \* day - A period of 24 hours. \* year - A period of 1 calendar year. \* week - A period of 7 days. \* month - A period of 1 calendar month. + + */ + period_unit?:'week' | 'month' | 'year' | 'day'; + /** + * @description The discount is included in MRR calculations for your site. This attribute is only applicable when `duration_type` is `one_time` and when the [feature is enabled](https://www.chargebee.com/docs/reporting.html#dashboards_flexible-mrr-calculation) in Chargebee. Also, If the [site-level setting](https://www.chargebee.com/docs/reporting.html#chart_flexible-mrr-calculation) is to exclude one-time discounts from MRR calculations, this value is always returned `false`. + + */ + included_in_mrr?:boolean; + /** + * @description The amount on the invoice to which the discount is applied. \* invoice_amount - The discount is applied to the invoice `sub_total`. \* specific_item_price - The discount is applied to the `invoice.line_item.amount` that corresponds to the item price specified by `item_price_id`. + + */ + apply_on?:'specific_item_price' | 'invoice_amount'; + /** + * @description The [id of the item price](/docs/api/subscriptions?prod_cat_ver=2#subscription_subscription_items_item_price_id) in the subscription to which the discount is to be applied. Relevant only when `apply_on` = `specific_item_price`. + + */ + item_price_id?:string; + /** + * @description Timestamp indicating when this discount is created. + + */ + created_at?:number; + /** + * @description Specifies till when the limited period discount is applicable. This attribute will be sent in the response only for `limited_period` duration type discount. + + */ + apply_till?:number; + /** + * @description Specifies the number of times the discount has been applied. + + */ + applied_count?:number; + /** + * @description Used to uniquely identify the coupon in your website/application and to integrate with Chargebee. +**Note:** + + +When the coupon ID contains a special character; for example: `#`, the API returns an error. +Make sure that you [encode](https://www.urlencoder.org/) the coupon ID in the path parameter before making an API call. + + */ + coupon_id?:string; + /** + * @description The index number of the subscription to which the item price is added. Provide a unique number between `0` and `4` (inclusive) for each subscription that is to be created. + + */ + index?:number; } export interface SubscriptionItem { + /** + * @description The unique identifier of the item price. + + */ + item_price_id?:string; + /** + * @description The type of item. There must be one and only one item of type `plan` in this list. \* plan - Plan \* addon - Addon \* charge - Charge + + */ + item_type?:'charge' | 'addon' | 'plan'; + /** + * @description The quantity of the item purchased + + */ + quantity?:number; + /** + * @description The decimal representation of the quantity of the item purchased. Can be provided for quantity-based item prices and only when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + quantity_in_decimal?:string; + /** + * @description The price/per unit price of the item. When not provided, [the value set](/docs/api/item_prices?prod_cat_ver=2#item_price_attributes) for the item price is used. This is only applicable when the `pricing_model` of the item price is `flat_fee` or `per_unit`. Also, it is only allowed when [price overriding](https://www.chargebee.com/docs/price-override.html) is enabled for the site. The value depends on the type of currency. If `changes_scheduled_at` is in the past and a `unit_price` is not passed, then the item price's current unit price is considered even if the item price did not exist on the date as of when the change is scheduled. + + */ + unit_price?:number; + /** + * @description The decimal representation of the price or per-unit price of the plan. The value is in major units of the currency. Always returned when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + unit_price_in_decimal?:string; + /** + * @description The total amount for the item as determined from `unit_price`, `free_quantity`, `quantity` and `item_tiers` as applicable. The value depends on the [type of currency](./#handling_currency_units). + + */ + amount?:number; + /** + * @description The decimal representation of the total amount for the item, in major units of the currency. Always returned when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + amount_in_decimal?:string; + /** + * @description The `free_quantity` of the plan-item as [specified](./item_prices?prod_cat_ver=2) for the item price. + + */ + free_quantity?:number; + /** + * @description The `free_quantity_in_decimal` as set for the item price. Returned for quantity-based item prices when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + free_quantity_in_decimal?:string; + /** + * @description The date/time when the trial period of the item ends. Applies to plan-items and----when [enabled](https://www.chargebee.com/docs/2.0/addons-trial.html)----addon-items as well. + + */ + trial_end?:number; + /** + * @description For the plan-item price: +the value determines the number of billing cycles the subscription runs before canceling automatically. If not provided, then [the value set](./item_prices?prod_cat_ver=2#item_price_attributes) for the plan-item price is used. + +For addon-item prices: +If [addon billing cycles](https://www.chargebee.com/docs/2.0/addons-billingcycle.html) are enabled then this is the number of subscription billing cycles for which the addon is included. If not provided, then [the value set under attached addons](./attached_items?prod_cat_ver=2#attached_item_attributes) is used. Further, if that value is not provided, then [the value set for the addon-item price](./item_prices?prod_cat_ver=2#item_price_attributes) is used. + + */ + billing_cycles?:number; + /** + * @description The service period of the item in days from the day of charge. + + */ + service_period_days?:number; + /** + * @description When `charge_on_option` option is set to `on_event`, this parameter specifies the event at which the charge-item is applied to the subscription. This parameter only applies to charge-items. \* plan_activation - same as subscription activation, but also includes the case when the plan-item of the subscription is changed. \* subscription_activation - the moment a subscription enters an `active` or `non-renewing` state. Also includes reactivations of canceled subscriptions. \* contract_termination - when a contract term is [terminated](./subscriptions?prod_cat_ver=2#cancel_subscription_for_items_contract_term_cancel_option). \* subscription_trial_start - the time when the trial period of the subscription begins. \* subscription_creation - the time of creation of the subscription. + + */ + charge_on_event?:'subscription_creation' | 'subscription_activation' | 'subscription_trial_start' | 'contract_termination' | 'plan_activation'; + /** + * @description Indicates if the charge-item is to be charged only once or each time the `charge_on_event` occurs. This parameter only applies to charge-items. + + */ + charge_once?:boolean; + /** + * @description Indicates when the charge-item is to be charged. This parameter only applies to charge-items. \* on_event - The item is charged at the occurrence of the event specified as `charge_on_event`. \* immediately - The item is charged immediately on being added to the subscription. + + */ + charge_on_option?:'on_event' | 'immediately'; } export interface ItemTier { + /** + * @description The id of the item price to which this tier belongs. + + */ + item_price_id?:string; + /** + * @description The lowest value in the quantity tier. + + */ + starting_unit?:number; + /** + * @description The highest value in the quantity tier. + + */ + ending_unit?:number; + /** + * @description The per-unit price for the tier when the `pricing_model` is `tiered` or `volume`. The total cost for the item price when the `pricing_model` is `stairstep`. The value is in the minor unit of the currency. + + */ + price?:number; + /** + * @description The decimal representation of the the lowest value of quantity in this tier. This is zero for the lowest tier. For all other tiers, it is the same as `ending_unit_in_decimal` of the next lower tier. Returned only when the pricing_model is `tiered`, `volume` or `stairstep` and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + starting_unit_in_decimal?:string; + /** + * @description The decimal representation of the highest value of quantity in this tier. This attribute is not applicable for the highest tier. For all other tiers, it must be equal to the `starting_unit_in_decimal` of the next higher tier. Returned only when the pricing_model is `tiered`, `volume` or `stairstep` and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + ending_unit_in_decimal?:string; + /** + * @description The decimal representation of the per-unit price for the tier when the `pricing_model` is `tiered` or `volume`. When the `pricing_model` is `stairstep`, it is the decimal representation of the total price for the item. The value is in major units of the currency. Returned when the plan is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + price_in_decimal?:string; + /** + * @description The index number of the subscription to which the item price is added. Provide a unique number between `0` and `4` (inclusive) for each subscription that is to be created. + + */ + index?:number; } export interface QuotedContractTerm { diff --git a/types/resources/SiteMigrationDetail.d.ts b/types/resources/SiteMigrationDetail.d.ts index 6214db3..f167fa7 100644 --- a/types/resources/SiteMigrationDetail.d.ts +++ b/types/resources/SiteMigrationDetail.d.ts @@ -71,49 +71,49 @@ declare module 'chargebee' { export interface ListInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description This endpoint lists the site migration details. */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description This endpoint lists the site migration details. */ offset?:string; /** - * @description Entity Id of the record in the other site. + * @description This endpoint lists the site migration details. */ entity_id_at_other_site?:{is?:string,is_not?:string,starts_with?:string}; /** - * @description Site name to which the record is moved in/out. + * @description This endpoint lists the site migration details. */ other_site_name?:{is?:string,is_not?:string,starts_with?:string}; /** - * @description Id of the entity in this site. + * @description This endpoint lists the site migration details. */ entity_id?:{is?:string,is_not?:string,starts_with?:string}; /** - * @description Entity Type of the record + * @description This endpoint lists the site migration details. */ entity_type?:{in?:string,is?:'credit_note' | 'subscription' | 'invoice' | 'transaction' | 'customer' | 'order',is_not?:'credit_note' | 'subscription' | 'invoice' | 'transaction' | 'customer' | 'order',not_in?:string}; /** - * @description Status of the migration + * @description This endpoint lists the site migration details. */ diff --git a/types/resources/Subscription.d.ts b/types/resources/Subscription.d.ts index cff7c85..82b067d 100644 --- a/types/resources/Subscription.d.ts +++ b/types/resources/Subscription.d.ts @@ -302,7 +302,9 @@ declare module 'chargebee' { invoice_notes?:string; /** - * @description A set of key-value pairs stored as additional information for the subscription. [Learn more](./advanced-features#meta_data). + * @description A collection of key-value pairs that provides extra information about the subscription. +**Note:** There's a character limit of 65,535. +[Learn more](advanced-features#metadata). */ @@ -430,144 +432,111 @@ Applicable only when [Metered Billing](https://www.chargebee.com/docs/metered_bi export namespace Subscription { export class SubscriptionResource { /** - * @description Deletes an advance invoicing schedule. When *schedule_type = specific_dates*, you also have the option of deleting a part of the schedule. + * @description **Note:** This endpoint optionally supports 3DS. To use it [create](./payment_intents?prod_cat_ver=2#create_a_payment_intent) a `payment_intent` and provide it via this endpoint. + +Creates a new subscription for an existing customer in Chargebee. Any available [credits and excess payments](./customers?prod_cat_ver=2#customer_balances) for the customer are automatically applied on the invoice. +**See also** + +* [Create a purchase](https://apidocs.chargebee.com/docs/api/purchases#create_a_purchase): an operation that creates a purchase representing multiple subscriptions bought together by a customer. */ - remove_advance_invoice_schedule(subscription_id:string, input?:RemoveAdvanceInvoiceScheduleInputParam):ChargebeeRequest; + create_with_items(customer_id:string, input?:CreateWithItemsInputParam):ChargebeeRequest; /** - * @description **Note:** This endpoint optionally supports 3DS. To use it, [create](./payment_intents?prod_cat_ver=2#create_a_payment_intent) a `payment_intent` and provide it via this endpoint. - -Updates the specified subscription by setting the parameters passed. Any parameters not provided are left unmodified. If an invoice is generated for this operation, any available [credits and excess payments](./customers?prod_cat_ver=2#customer_balances) for the customer are automatically applied. + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - update_for_items(subscription_id:string, input?:UpdateForItemsInputParam):ChargebeeRequest; + list(input?:ListInputParam):ChargebeeRequest; /** - * @description Removes Coupons associated with the Subscription. If the param 'coupon_ids' is not specified, all the Coupons linked to the Subscription will be removed. + * @description Retrieves a list of contract term resources for the subscription specified in the path. */ - remove_coupons(subscription_id:string, input?:RemoveCouponsInputParam):ChargebeeRequest; + contract_terms_for_subscription(subscription_id:string, input?:ContractTermsForSubscriptionInputParam):ChargebeeRequest; /** - * @description **Note:** This operation optionally supports 3DS verification flow. To achieve the same, create the [Payment Intent](/docs/api/#3ds-implementation-guide) and pass it as input parameter to this API. - -This API is used to resume a **paused** subscription. On resumption the subscription will be activated and any applicable charges will be initiated. - -You could schedule the resumption by passing **specific_date** parameter in resume_option. If scheduled, the subscription will be resumed on the **specific_date** and moved to Active state. - -For in-term resumption, unless there are scheduled changes, unbilled charges will not be charged. - -**What is an "in-term resumption"?** -An "in-term resumption" is when the pause and resumption happens within the billing term of the subscription. - -**Example :** A subscription was billed from 1st to 31st of a month. It was paused on the 20th and resumed before 31st. This is an in-term resumption. - -#### UNPAID INVOICES - -Specifying **unpaid_invoices** allows you to close invoices of the subscription which have amounts due. The invoices are chosen for payment collection after applying the available credits and excess payments. - -If specified as **schedule_payment_collection**, payment collection for the amount due of past invoices will be attempted. The payment method available will be charged if auto-collection is enabled for the customer, and appropriate payment collection(payment succeeded or payment failed) events will be triggered. If the payment collection fails, no further retries will be made on the invoices. - -**Note:** If the invoices of the subscription are consolidated, and any of the subscriptions in the consolidated invoice are cancelled, these invoices will not be selected for collection. + * @description Returns a list of discounts currently attached to the subscription given by `{subscription_id}`. The list is sorted by date of creation, in descending order. */ - resume(subscription_id:string, input?:ResumeInputParam):ChargebeeRequest; + list_discounts(subscription_id:string, input?:ListDiscountsInputParam):ChargebeeRequest; /** - * @description Cancels the subscription. - -#### Canceling contract terms - -* Subscriptions with contract terms can only be canceled by [terminating the contract term](/docs/api/subscriptions?prod_cat_ver=2&lang=curl#cancel_subscription_for_items_contract_term_cancel_option). -* When canceling a contract term, the default value for the following parameters is taken from the [site settings for contract terms](https://www.chargebee.com/docs/2.0/contract-terms.html#configuring-contract-terms) instead of the [site settings for subscription cancellation](https://www.chargebee.com/docs/2.0/cancellations.html#configure-subscription-cancellation). - * `credit_option_for_current_term_charges` - * `unbilled_charges_option` - * `account_receivables_handling` - * `refundable_credits_handling` -* From among the parameters for this request, `end_of_term` or `cancel_at` should not be passed when using contract terms; use `contract_term_cancel_option` instead. -* The `subscription_items` parameter is used to override price or quantity for the termination fee. To use this parameter, the following two conditions must be met: - * `contract_term_cancel_option` must be set to `terminate_now`. - * the subscription must have a [subscription_items](/docs/api/subscriptions?prod_cat_ver=2#subscription_subscription_items) attribute with `charge_on_event` set to `contract_term_termination`. + * @description Retrieves a subscription. */ - cancel_for_items(subscription_id:string, input?:CancelForItemsInputParam):ChargebeeRequest; + retrieve(subscription_id:string):ChargebeeRequest; /** - * @description Regenerates the current invoice for the subscription. The current invoice is that which includes non-`metered` items from the current term and `metered` items from the previous term of the subscription. + * @description Retrieves a subscription with the scheduled changes applied. +**Note:** Only the following attributes are changed -#### prerequisites +* item_id +* item_price_id +* billing_period +* billing_period_unit +* remaining_billing_cycles +* coupons + +Other attributes such as **status** ,**next_billing_at** are not changed and will reflect the current subscription values. -* The current invoice of the subscription must have been [voided](/docs/api/invoices?prod_cat_ver=2#void_an_invoice) or [deleted](/docs/api/invoices?prod_cat_ver=2#delete_an_invoice). -* The subscription `status` must be `active` or `non_renewing`. -* There should be no [unbilled charges](/docs/api/unbilled_charges?prod_cat_ver=2) for non-`metered` items for the current term. -* There should be no [unbilled charges](/docs/api/unbilled_charges?prod_cat_ver=2) for `metered` items for the previous term. -* The subscription must not have any [advance invoice](https://www.chargebee.com/docs/2.0/advance-invoices.html#generating-an-advance-invoice) or [advance invoice schedule](https://www.chargebee.com/docs/2.0/advance-invoices.html#generating-an-advance-invoice_setting-up-an-advance-invoicing-schedule). -#### deleting an invoice -Usages are also deleted when an invoice is deleted. Therefore, if the invoice was deleted, you may [add](/docs/api/usages?prod_cat_ver=2#create_a_usage) or [bulk import](https://www.chargebee.com/docs/2.0/bulk-operations.html#overview_available-bulk-operations) usages before regenerating an invoice. */ - regenerate_invoice(subscription_id:string, input?:RegenerateInvoiceInputParam):ChargebeeRequest; + retrieve_with_scheduled_changes(subscription_id:string):ChargebeeRequest; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description Removes the subscription changes scheduled on next renewal. Advance charges, if any, will be refunded as credits and a new invoice will be generated on renewal. */ - list(input?:ListInputParam):ChargebeeRequest; + remove_scheduled_changes(subscription_id:string):ChargebeeRequest; /** - * @description Imports a subscription into Chargebee. + * @description **Note:** Cannot be called when the subscription is on a [contract term](contract_terms). (That is, when the `contract_term.status attribute` is `active`.) + +If the subscription is in **Non Renewing** or **In Trial** state and is also scheduled to cancel at the end of current term, then this API can be used to remove the scheduled cancellation. When a scheduled cancellation is removed, the subscription will revert to **Active** or **In Trial** state, whichever is the state before cancellation was scheduled. + +While removing the scheduled cancellation, you may specify the number of billing cycles. If the billing cycle is not specified, the default billing cycle from the plan will be applied on the subscription. */ - import_for_items(customer_id:string, input:ImportForItemsInputParam):ChargebeeRequest; + remove_scheduled_cancellation(subscription_id:string, input?:RemoveScheduledCancellationInputParam):ChargebeeRequest; /** - * @description Retrieves the *advance_invoice_schedule* for a subscription. Note that this endpoint is only applicable for *schedule_type = specific_dates* or fixed_intervals. + * @description Removes Coupons associated with the Subscription. If the param 'coupon_ids' is not specified, all the Coupons linked to the Subscription will be removed. */ - retrieve_advance_invoice_schedule(subscription_id:string):ChargebeeRequest; + remove_coupons(subscription_id:string, input?:RemoveCouponsInputParam):ChargebeeRequest; /** - * @description **Note:** Cannot be called when the subscription is on a [contract term](contract_terms). (That is, when the `contract_term.status attribute` is `active`.) - -If the subscription is in **Non Renewing** or **In Trial** state and is also scheduled to cancel at the end of current term, then this API can be used to remove the scheduled cancellation. When a scheduled cancellation is removed, the subscription will revert to **Active** or **In Trial** state, whichever is the state before cancellation was scheduled. + * @description **Note:** This endpoint optionally supports 3DS. To use it, [create](./payment_intents?prod_cat_ver=2#create_a_payment_intent) a `payment_intent` and provide it via this endpoint. -While removing the scheduled cancellation, you may specify the number of billing cycles. If the billing cycle is not specified, the default billing cycle from the plan will be applied on the subscription. +Updates the specified subscription by setting the parameters passed. Any parameters not provided are left unmodified. If an invoice is generated for this operation, any available [credits and excess payments](./customers?prod_cat_ver=2#customer_balances) for the customer are automatically applied. */ - remove_scheduled_cancellation(subscription_id:string, input?:RemoveScheduledCancellationInputParam):ChargebeeRequest; + update_for_items(subscription_id:string, input?:UpdateForItemsInputParam):ChargebeeRequest; /** - * @description Retrieves a subscription with the scheduled changes applied. -**Note:** Only the following attributes are changed - -* item_id -* item_price_id -* billing_period -* billing_period_unit -* remaining_billing_cycles -* coupons - -Other attributes such as **status** ,**next_billing_at** are not changed and will reflect the current subscription values. - + * @description Changes the subscription's current term end date. Depending on the "status" of the subscription, "term end date" has different effects. +* If the Subscription is in **trial**, it affects trial end date. +* If the Subscription is **active**, it affects the next billing date. +* If the Subscription's status is **non_renewing**, this affects the upcoming cancellation date. +**Tip**: To cycle through a couple of billing cycles and test webhooks, you may use this API. */ - retrieve_with_scheduled_changes(subscription_id:string):ChargebeeRequest; + change_term_end(subscription_id:string, input:ChangeTermEndInputParam):ChargebeeRequest; /** * @description **Note:** This operation optionally supports 3DS verification flow. To achieve the same, create the [Payment Intent](/docs/api/#3ds-implementation-guide) and pass it as input parameter to this API. @@ -597,13 +566,6 @@ When dunning (payment failure retry settings) is configured with the last retry reactivate(subscription_id:string, input?:ReactivateInputParam):ChargebeeRequest; - /** - * @description Creates an advance invoice or an [advance invoicing schedule](advance_invoice_schedules#advance_invoice_schedule). When an advance invoice is generated, and [`auto_collection`](subscriptions#subscription_auto_collection) is `on` for the subscription, the [`payment_source`](subscriptions#subscription_payment_source_id) associated with the subscription is charged. Any changes scheduled for the subscription are taken into account automatically while generating an advance invoice. Advance invoices are not generated for a subscription when it is in the [`paused`](subscriptions#subscription_status) status. Advance invoices are generated only for non-`metered` items in a subscription. - - */ - - charge_future_renewals(subscription_id:string, input?:ChargeFutureRenewalsInputParam):ChargebeeRequest; - /** * @description Adds a one time charge to the subscription which will be added to the invoice generated at the end of the current term. If there are any applicable coupons in the subscription, an appropriate discount will be applied. @@ -614,64 +576,51 @@ To collect a charge immediately, [use this API](/docs/api/invoices#create_invoic add_charge_at_term_end(subscription_id:string, input:AddChargeAtTermEndInputParam):ChargebeeRequest; /** - * @description Removes the subscription changes scheduled on next renewal. Advance charges, if any, will be refunded as credits and a new invoice will be generated on renewal. + * @description Creates an advance invoice or an [advance invoicing schedule](advance_invoice_schedules#advance_invoice_schedule). When an advance invoice is generated, and [`auto_collection`](subscriptions#subscription_auto_collection) is `on` for the subscription, the [`payment_source`](subscriptions#subscription_payment_source_id) associated with the subscription is charged. Any changes scheduled for the subscription are taken into account automatically while generating an advance invoice. Advance invoices are not generated for a subscription when it is in the [`paused`](subscriptions#subscription_status) status. Advance invoices are generated only for non-`metered` items in a subscription. */ - remove_scheduled_changes(subscription_id:string):ChargebeeRequest; + charge_future_renewals(subscription_id:string, input?:ChargeFutureRenewalsInputParam):ChargebeeRequest; /** - * @description Changes the subscription's current term end date. Depending on the "status" of the subscription, "term end date" has different effects. - -* If the Subscription is in **trial**, it affects trial end date. -* If the Subscription is **active**, it affects the next billing date. -* If the Subscription's status is **non_renewing**, this affects the upcoming cancellation date. - -**Tip**: To cycle through a couple of billing cycles and test webhooks, you may use this API. + * @description Modifies the [advance invoicing schedule](advance_invoice_schedules#advance_invoice_schedule) for a subscription. */ - change_term_end(subscription_id:string, input:ChangeTermEndInputParam):ChargebeeRequest; + edit_advance_invoice_schedule(subscription_id:string, input?:EditAdvanceInvoiceScheduleInputParam):ChargebeeRequest; /** - * @description Deletes the subscription resource. + * @description Retrieves the *advance_invoice_schedule* for a subscription. Note that this endpoint is only applicable for *schedule_type = specific_dates* or fixed_intervals. */ - delete(subscription_id:string):ChargebeeRequest; + retrieve_advance_invoice_schedule(subscription_id:string):ChargebeeRequest; /** - * @description **Note:** This endpoint optionally supports 3DS. To use it [create](./payment_intents?prod_cat_ver=2#create_a_payment_intent) a `payment_intent` and provide it via this endpoint. - -Creates a new subscription for an existing customer in Chargebee. Any available [credits and excess payments](./customers?prod_cat_ver=2#customer_balances) for the customer are automatically applied on the invoice. -**See also** - -* [Create a purchase](https://apidocs.chargebee.com/docs/api/purchases#create_a_purchase): an operation that creates a purchase representing multiple subscriptions bought together by a customer. + * @description Deletes an advance invoicing schedule. When *schedule_type = specific_dates*, you also have the option of deleting a part of the schedule. */ - create_with_items(customer_id:string, input?:CreateWithItemsInputParam):ChargebeeRequest; + remove_advance_invoice_schedule(subscription_id:string, input?:RemoveAdvanceInvoiceScheduleInputParam):ChargebeeRequest; /** - * @description Imports unbilled charges into Chargebee. + * @description Regenerates the current invoice for the subscription. The current invoice is that which includes non-`metered` items from the current term and `metered` items from the previous term of the subscription. - */ - - import_unbilled_charges(subscription_id:string, input?:ImportUnbilledChargesInputParam):ChargebeeRequest; - - /** - * @description If the subscription is in **Paused** state and is scheduled to resume on a specific_date, this API can be used to remove the scheduled resumption. When the scheduled resumption is removed, the subscription will remain **Paused**. +#### prerequisites - */ - - remove_scheduled_resumption(subscription_id:string):ChargebeeRequest; - - /** - * @description Retrieves a subscription. +* The current invoice of the subscription must have been [voided](/docs/api/invoices?prod_cat_ver=2#void_an_invoice) or [deleted](/docs/api/invoices?prod_cat_ver=2#delete_an_invoice). +* The subscription `status` must be `active` or `non_renewing`. +* There should be no [unbilled charges](/docs/api/unbilled_charges?prod_cat_ver=2) for non-`metered` items for the current term. +* There should be no [unbilled charges](/docs/api/unbilled_charges?prod_cat_ver=2) for `metered` items for the previous term. +* The subscription must not have any [advance invoice](https://www.chargebee.com/docs/2.0/advance-invoices.html#generating-an-advance-invoice) or [advance invoice schedule](https://www.chargebee.com/docs/2.0/advance-invoices.html#generating-an-advance-invoice_setting-up-an-advance-invoicing-schedule). + +#### deleting an invoice + +Usages are also deleted when an invoice is deleted. Therefore, if the invoice was deleted, you may [add](/docs/api/usages?prod_cat_ver=2#create_a_usage) or [bulk import](https://www.chargebee.com/docs/2.0/bulk-operations.html#overview_available-bulk-operations) usages before regenerating an invoice. */ - retrieve(subscription_id:string):ChargebeeRequest; + regenerate_invoice(subscription_id:string, input?:RegenerateInvoiceInputParam):ChargebeeRequest; /** * @description Import previous and active [contract terms](./contract_terms). @@ -683,39 +632,32 @@ For contract terms in `active` state, import is allowed only if the as import_contract_term(subscription_id:string, input?:ImportContractTermInputParam):ChargebeeRequest; /** - * @description Assigns the payment source and sets auto collection state for the subscription. - - */ - - override_billing_profile(subscription_id:string, input?:OverrideBillingProfileInputParam):ChargebeeRequest; - - /** - * @description If the subscription is in **Active** or **Non Renewing** state and is also scheduled to pause at the end_of_term/specific_date, this API can be used to remove the scheduled pause. + * @description Imports unbilled charges into Chargebee. */ - remove_scheduled_pause(subscription_id:string):ChargebeeRequest; + import_unbilled_charges(subscription_id:string, input?:ImportUnbilledChargesInputParam):ChargebeeRequest; /** - * @description Modifies the [advance invoicing schedule](advance_invoice_schedules#advance_invoice_schedule) for a subscription. + * @description Imports a subscription into Chargebee. */ - edit_advance_invoice_schedule(subscription_id:string, input?:EditAdvanceInvoiceScheduleInputParam):ChargebeeRequest; + import_for_items(customer_id:string, input:ImportForItemsInputParam):ChargebeeRequest; /** - * @description Returns a list of discounts currently attached to the subscription given by `{subscription_id}`. The list is sorted by date of creation, in descending order. + * @description Assigns the payment source and sets auto collection state for the subscription. */ - list_discounts(subscription_id:string, input?:ListDiscountsInputParam):ChargebeeRequest; + override_billing_profile(subscription_id:string, input?:OverrideBillingProfileInputParam):ChargebeeRequest; /** - * @description Retrieves a list of contract term resources for the subscription specified in the path. + * @description Deletes the subscription resource. */ - contract_terms_for_subscription(subscription_id:string, input?:ContractTermsForSubscriptionInputParam):ChargebeeRequest; + delete(subscription_id:string):ChargebeeRequest; /** * @description Pauses the subscription, changing its `status` to `paused`. This prevents the subscription from getting renewed. No new charges are created until the subscription is resumed. @@ -731,123 +673,141 @@ For contract terms in `active` state, import is allowed only if the as */ pause(subscription_id:string, input?:PauseInputParam):ChargebeeRequest; - } - export interface RemoveAdvanceInvoiceScheduleResponse { - subscription:Subscription; - - advance_invoice_schedules?:AdvanceInvoiceSchedule[]; - } - export interface RemoveAdvanceInvoiceScheduleInputParam { /** - * @description Parameters for specific_dates_schedule + * @description Cancels the subscription. - */ - - specific_dates_schedule?:{id?:string}[]; - } - export interface UpdateForItemsResponse { - subscription:Subscription; - - customer:Customer; - - card?:Card; - - invoice?:Invoice; - - unbilled_charges?:UnbilledCharge[]; - - credit_notes?:CreditNote[]; - } - export interface UpdateForItemsInputParam { - [key : string] : any; - /** - * @description Item ids of [mandatorily attached addons](./attached_items?prod_cat_ver=2) that are to be removed from the subscription. +#### Canceling contract terms + +* Subscriptions with contract terms can only be canceled by [terminating the contract term](/docs/api/subscriptions?prod_cat_ver=2&lang=curl#cancel_subscription_for_items_contract_term_cancel_option). +* When canceling a contract term, the default value for the following parameters is taken from the [site settings for contract terms](https://www.chargebee.com/docs/2.0/contract-terms.html#configuring-contract-terms) instead of the [site settings for subscription cancellation](https://www.chargebee.com/docs/2.0/cancellations.html#configure-subscription-cancellation). + * `credit_option_for_current_term_charges` + * `unbilled_charges_option` + * `account_receivables_handling` + * `refundable_credits_handling` +* From among the parameters for this request, `end_of_term` or `cancel_at` should not be passed when using contract terms; use `contract_term_cancel_option` instead. +* The `subscription_items` parameter is used to override price or quantity for the termination fee. To use this parameter, the following two conditions must be met: + * `contract_term_cancel_option` must be set to `terminate_now`. + * the subscription must have a [subscription_items](/docs/api/subscriptions?prod_cat_ver=2#subscription_subscription_items) attribute with `charge_on_event` set to `contract_term_termination`. */ - - mandatory_items_to_remove?:string[]; + + cancel_for_items(subscription_id:string, input?:CancelForItemsInputParam):ChargebeeRequest; /** - * @description If `true` then the existing `subscription_items` list for the subscription is replaced by the one provided. If `false` then the provided `subscription_items` list gets added to the existing list. + * @description **Note:** This operation optionally supports 3DS verification flow. To achieve the same, create the [Payment Intent](/docs/api/#3ds-implementation-guide) and pass it as input parameter to this API. - */ - - replace_items_list?:boolean; +This API is used to resume a **paused** subscription. On resumption the subscription will be activated and any applicable charges will be initiated. + +You could schedule the resumption by passing **specific_date** parameter in resume_option. If scheduled, the subscription will be resumed on the **specific_date** and moved to Active state. + +For in-term resumption, unless there are scheduled changes, unbilled charges will not be charged. + +**What is an "in-term resumption"?** +An "in-term resumption" is when the pause and resumption happens within the billing term of the subscription. + +**Example :** A subscription was billed from 1st to 31st of a month. It was paused on the 20th and resumed before 31st. This is an in-term resumption. + +#### UNPAID INVOICES + +Specifying **unpaid_invoices** allows you to close invoices of the subscription which have amounts due. The invoices are chosen for payment collection after applying the available credits and excess payments. + +If specified as **schedule_payment_collection**, payment collection for the amount due of past invoices will be attempted. The payment method available will be charged if auto-collection is enabled for the customer, and appropriate payment collection(payment succeeded or payment failed) events will be triggered. If the payment collection fails, no further retries will be made on the invoices. + +**Note:** If the invoices of the subscription are consolidated, and any of the subscriptions in the consolidated invoice are cancelled, these invoices will not be selected for collection. + + */ + + resume(subscription_id:string, input?:ResumeInputParam):ChargebeeRequest; /** - * @description Updates [Net D](https://www.chargebee.com/docs/net_d.html) for the subscription. Net D is the number of days within which any invoice raised for the subscription must be paid. + * @description If the subscription is in **Active** or **Non Renewing** state and is also scheduled to pause at the end_of_term/specific_date, this API can be used to remove the scheduled pause. -* If the value is `0` or a positive integer: Net D is set explicitly for the subscription to the value provided. The value must be one of those defined in the [site configuration](https://www.chargebee.com/docs/net_d.html#enable-net-d-for-chargebee-invoices). -* If the value is `-1`: The attribute is reset and therefore not returned by the API. In this case, when an invoice is raised -- whether now or later -- the `net_term_days` defined at the [customer level](customers#customer_net_term_days) is considered. -* If the value is not provided: The attribute is left unaltered. -. + */ + + remove_scheduled_pause(subscription_id:string):ChargebeeRequest; + + /** + * @description If the subscription is in **Paused** state and is scheduled to resume on a specific_date, this API can be used to remove the scheduled resumption. When the scheduled resumption is removed, the subscription will remain **Paused**. */ + + remove_scheduled_resumption(subscription_id:string):ChargebeeRequest; + } + export interface CreateWithItemsResponse { + subscription:Subscription; - net_term_days?:number; + customer:Customer; + + card?:Card; + invoice?:Invoice; + + unbilled_charges?:UnbilledCharge[]; + } + export interface CreateWithItemsInputParam { + [key : string] : any; /** - * @description The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if `create_pending_invoices` is set to `true`, and if the site is configured to set invoice dates to date of closing, then upon invoice closure, this date is changed to the invoice closing date. taxes and line_item_taxes are computed based on the tax configuration as of `invoice_date`. When passing this parameter, the following prerequisites must be met: - -* `invoice_date` must be in the past. -* `invoice_date` is not more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December. -* It is not earlier than `changes_scheduled_at`, `reactivate_from`, or `trial_end`. -* `invoice_immediately` is `true`. -. + * @description A unique and immutable identifier for the subscription. If not provided, it is autogenerated. */ - invoice_date?:number; + id?:string; /** - * @description The new start date of a `future` subscription. Applicable only for `future` subscriptions. + * @description The unique ID of the [business entity](/docs/api/advanced-features?prod_cat_ver=2#mbe) this subscription should be [linked](/docs/api/advanced-features?prod_cat_ver=2#mbe-linked-be) to. Applicable only when multiple business entities have been created for the site. This must be the same as the business entity of the `{customer_id}` for the operation to be successful. +**Note** + +An alternative way of passing this parameter is by means of a [custom HTTP header](/docs/api/advanced-features?prod_cat_ver=2#mbe-header-main). +. */ - start_date?:number; + business_entity_id?:string; /** - * @description The time at which the trial has ended or will end for the subscription. This is only allowed when the subscription `status` is `future`, `in_trial`, or `cancelled`. Also, the value must not be earlier than `changes_scheduled_at` or `start_date`. **Note** : This parameter can be backdated (set to a value in the past) only when the subscription is in `cancelled` or `in_trial` `status`. Do this to keep a record of when the trial ended in case it ended at some point in the past. When `trial_end` is backdated, the subscription immediately goes into `active` or `non_renewing` status. + * @description End of the trial period for the subscription. This overrides the trial period set for the plan-item. The value must be later than `start_date`. Set it to `0` to have no trial period. */ trial_end?:number; /** - * @description Billing cycles set for plan-item price is used by default. + * @description The number of billing cycles the subscription runs before canceling. If not provided, then the billing cycles [set for the plan-item price](https://apidocs.chargebee.com/docs/api/item_prices?prod_cat_ver=2#item_price_billing_cycles) is used. */ billing_cycles?:number; /** - * @description The number of subscription billing cycles to [invoice in advance](https://www.chargebee.com/docs/advance-invoices.html). If a new term is started for the subscription due to this API call, then `terms_to_charge` is inclusive of this new term. See description for the `force_term_reset` parameter to learn more about when a subscription term is reset. + * @description Item ids of [mandatorily attached addons](./attached_items?prod_cat_ver=2) that are to be removed from the subscription. */ - terms_to_charge?:number; + mandatory_items_to_remove?:string[]; /** - * @description If the subscription `status` is `cancelled` and it is being reactivated via this operation, this is the date/time at which the subscription should be reactivated. -**Note:** It is recommended not to pass this parameter along with `changed_scheduled_at`. `reactivate_from` can be backdated (set to a value in the past). Use backdating when the subscription has been reactivated already but its billing has been delayed. Backdating is allowed only when the following prerequisites are met: + * @description Defines [Net D](https://www.chargebee.com/docs/net_d.html) for the subscription. Net D is the number of days within which any invoice raised for the subscription must be paid. -* Backdating must be enabled for subscription reactivation operations. -* The current day of the month does not exceed the limit set in Chargebee for backdating subscription change. This limit is the day of the month by which the accounting for the previous month must be closed. -* The date is on or after the last date/time any of the product catalog items of the subscription were changed. -* The date is not more than duration X into the past where X is the billing period of the plan. For example, if the period of the plan in the subscription is 2 months and today is 14th April, `changes_scheduled_at` cannot be earlier than 14th February. +* If a value is provided: Net D is set explicitly for the subscription to the value provided. The value must be one among those defined in the [site configuration](https://www.chargebee.com/docs/net_d.html#enable-net-d-for-chargebee-invoices). +* If not provided: The attribute is not set and therefore not returned by the API. In this case, when an invoice is raised -- whether now or later -- the `net_term_days` defined at the [customer level](customers#customer_net_term_days) is considered. . */ - reactivate_from?:number; + net_term_days?:number; /** - * @description Override the [billing alignment mode](https://www.chargebee.com/docs/calendar-billing.html#alignment-of-billing-date) chosen for the site for calendar billing. Only applicable when using calendar billing. \* immediate - Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly.. \* delayed - Subscription period will be aligned with the configured billing date at the next renewal. + * @description The date/time at which the subscription is to start. If not provided, the subscription starts immediately. You can provide a value in the past as well. This is called backdating the subscription creation and is done when the subscription has already been provisioned but its billing has been delayed. Backdating is allowed only when the following prerequisites are met: + +* Backdating is enabled for subscription creation operations. +* The current day of the month does not exceed the limit set in Chargebee for backdating such operations. This day is typically the day of the month by which the accounting for the previous month must be closed. +* The date is not more than duration X into the past, where X is the billing period of the plan. For example, if the period of the plan in the subscription is 2 months and today is 14th April, `start_date` cannot be earlier than 14th February. +. */ - billing_alignment_mode?:BillingAlignmentMode; + start_date?:number; /** * @description Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property. \* on - Whenever an invoice is created for this subscription, an automatic charge will be attempted on the payment method available. \* off - Automatic collection of charges will not be made for this subscription. Use this for offline payments. @@ -857,90 +817,71 @@ For contract terms in `active` state, import is allowed only if the as auto_collection?:AutoCollection; /** - * @description The preferred offline payment method for the subscription. \* sepa_credit - SEPA Credit \* cash - Cash \* no_preference - No Preference \* bank_transfer - Bank Transfer \* check - Check \* boleto - Boleto \* ach_credit - ACH Credit - - */ - - offline_payment_method?:OfflinePaymentMethod; - - /** - * @description Purchase order number for this subscription. + * @description The number of subscription billing cycles (including the first one) to [invoice in advance](https://www.chargebee.com/docs/advance-invoices.html). */ - po_number?:string; + terms_to_charge?:number; /** - * @description List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](https://apidocs.chargebee.com/docs/api/coupon_codes). If `changes_scheduled_at` is in the past, then the currently available coupons can be used even if they were not available as of the date for when the change is scheduled. + * @description Override the [billing alignment mode](https://www.chargebee.com/docs/calendar-billing.html#alignment-of-billing-date) for Calendar Billing. Only applicable when using Calendar Billing. The default value is that which has been configured for the site. \* immediate - Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly.. \* delayed - Subscription period will be aligned with the configured billing date at the next renewal. */ - coupon_ids?:string[]; + billing_alignment_mode?:BillingAlignmentMode; /** - * @description If `true` then the existing `coupon_ids` list for the subscription is replaced by the one provided. If `false` then the provided list gets added to the existing `coupon_ids`. + * @description Purchase order number for this subscription. */ - replace_coupon_list?:boolean; + po_number?:string; /** - * @description * When `true`: [Prorated credits or charges](https://www.chargebee.com/docs/2.0/proration.html#proration-mechanism) are created as applicable for this change. -* When `false`: The subscription is changed without creating any credits or charges. -* When not provided, the value configured in the [site settings](https://www.chargebee.com/docs/2.0/proration.html#proration-for-subscription-change) is considered. - -**Caveat** - -For further changes within the same billing term, when `prorate` is set to `true`, **credits** are **not created** when **all** the conditions below hold true: - -An immediate previous change was made - -* with `prorate` set to `false` and -* no changes were made to the subscription's billing term and -* a change was made to either the subscription's items or their prices. + * @description List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. */ - prorate?:boolean; + coupon_ids?:string[]; /** - * @description Set this to true if you want the update to be applied at the end of the current subscription billing cycle. + * @description Id of the payment source to be attached to this subscription. */ - end_of_term?:boolean; + payment_source_id?:string; /** - * @description Say the subscription has the renewal date as 28th of every month. When the plan-item price of the subscription is set to one that has the same billing period as the current plan-item price, the subscription change does not change the term. In other words, the subscription still renews on the 28th. Passing this parameter as `true` will have the subscription reset its term to the current date (provided `end_of_term` is false). -**Note**: When the new plan-item price has a billing period different from the current plan-item price of the subscription, the term is always reset, regardless of the value passed for this parameter. + * @description If `true`, ignores the [hierarchy relationship](./customers?prod_cat_ver=2#customer_relationship) and uses customer as payment and invoice owner. */ - force_term_reset?:boolean; + override_relationship?:boolean; /** - * @description When the `status` of the subscription is `cancelled`, this parameter determines whether the subscription is reactivated upon making this API request. Unless passed explicitly as `false`, this parameter is implied as `true` when you provide the `subscription_items` parameter. + * @description A customer-facing note added to all invoices associated with this subscription. This note is one among [all the notes](/docs/api/invoices#invoice_notes) displayed on the invoice PDF. */ - reactivate?:boolean; + invoice_notes?:string; /** - * @description The Chargebee payment token generated by Chargebee JS. + * @description The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if `create_pending_invoices` is set to `true`, and if the site is configured to set invoice dates to the date of closing, then upon invoice closure, this date is changed to the invoice closing date. `taxes` and `line_item_taxes` are computed based on the tax configuration as of `invoice_date`. When passing this parameter, the following prerequisites must be met: - */ - - token_id?:string; - - /** - * @description A customer-facing note added to all invoices associated with this subscription. This note is one among [all the notes](/docs/api/invoices#invoice_notes) displayed on the invoice PDF. +* `invoice_date` must be in the past. +* It is not earlier than `start_date`. +* It is not more than one calendar month into the past. Eg. If today is 13th January, then you cannot pass a value that is earlier than 13th December. +* `invoice_immediately` is true. +. */ - invoice_notes?:string; + invoice_date?:number; /** - * @description A set of key-value pairs stored as additional information for the subscription. [Learn more](./advanced-features#meta_data). + * @description A collection of key-value pairs that provides extra information about the subscription. +**Note:** There's a character limit of 65,535. +[Learn more](advanced-features?prod_cat_ver=2#metadata). */ @@ -955,38 +896,25 @@ An immediate previous change was made invoice_immediately?:boolean; /** - * @description If `true`, ignores the [hierarchy relationship](./customers?prod_cat_ver=2#customer_relationship) and uses customer as payment and invoice owner. + * @description Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False. */ - override_relationship?:boolean; + replace_primary_payment_source?:boolean; /** - * @description When `change_option` is set to `specific_date`, then set the date/time at which the subscription change is to happen or has happened. **Note:** It is recommended not to pass this parameter along with `reactivate_from`. `changes_scheduled_at` can be set to a value in the past. This is called backdating the subscription change and is performed when the subscription change has already been provisioned but its billing has been delayed. Backdating is allowed only when the following prerequisites are met: - -* Backdating must be enabled for subscription change operations. -* Only the following changes can be backdated: - * Changes in the recurring items or their prices. - * Addition of non-recurring items. -* Subscription `status` is `active`, `cancelled`, or `non_renewing`. -* The current day of the month does not exceed the limit set in Chargebee for backdating subscription change. This limit is typically the day of the month by which the accounting for the previous month must be closed. -* The date is on or after `current_term_start`. -* The date is on or after the last date/time any of the following changes were made: - * Changes in the recurring items or their prices. - * Addition of non-recurring items. -* The date is not more than duration X into the past where X is the billing period of the plan. For example, if the period of the plan in the subscription is 2 months and today is 14th April, `changes_scheduled_at` cannot be earlier than 14th February. -. + * @description The period of time by which the first term of the subscription is to be extended free-of-charge. The value must be in multiples of free_period_unit. */ - changes_scheduled_at?:number; + free_period?:number; /** - * @description When the quote is converted, this attribute determines the date/time as of when the subscription change is to be carried out. \* end_of_term - The change is carried out at the end of the current billing cycle of the subscription. \* specific_date - The change is carried out as of the date specified under `changes_scheduled_at`. \* immediately - The change is carried out immediately. + * @description The unit of time in multiples of which the free_period parameter is expressed. The value must be equal to or lower than the [period_unit](/docs/api/plans#create_a_plan_period_unit) attribute of the [plan](/docs/api/subscriptions#create_a_subscription_plan_id) chosen. \* week - Charge based on week(s) \* month - Charge based on month(s) \* day - Charge based on day(s) \* year - Charge based on year(s) */ - change_option?:ChangeOption; + free_period_unit?:FreePeriodUnit; /** * @description Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same as `billing_cycles` or a custom value depending on the [site configuration](https://www.chargebee.com/docs/contract-terms.html#configuring-contract-terms). @@ -995,20 +923,6 @@ An immediate previous change was made contract_term_billing_cycle_on_renewal?:number; - /** - * @description The period of time by which the first term of the subscription is to be extended free-of-charge. The value must be in multiples of free_period_unit. - - */ - - free_period?:number; - - /** - * @description The unit of time in multiples of which the free_period parameter is expressed. The value must be equal to or lower than the [period_unit](/docs/api/plans#create_a_plan_period_unit) attribute of the [plan](/docs/api/subscriptions#create_a_subscription_plan_id) chosen. \* week - Charge based on week(s) \* month - Charge based on month(s) \* day - Charge based on day(s) \* year - Charge based on year(s) - - */ - - free_period_unit?:FreePeriodUnit; - /** * @description Indicates whether the invoices for this subscription are generated with a `pending` `status`. This attribute is set to `true` automatically when the subscription has item prices that belong to `metered` items. @@ -1032,67 +946,61 @@ Applicable only when [Metered Billing](https://www.chargebee.com/docs/metered_bi auto_close_invoices?:boolean; /** - * @description Applicable only when [End-of-trial Action](https://www.chargebee.com/docs/2.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) has been enabled for the site. Whenever the subscription has a trial period, this attribute (parameter) is returned (required) and specifies the operation to be carried out for the subscription once the trial ends. \* activate_subscription - The subscription activates and charges are raised for non-metered items. \* cancel_subscription - The subscription cancels. \* plan_default - The action [configured for the site](https://www.chargebee.com/docs/trial_periods.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect. This is the default value when `trial_end_action` is defined for the plan. \* site_default - The action [configured for the site](https://www.chargebee.com/docs/trial_periods.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect. This is the default value when `trial_end_action` is **not** defined for the plan. + * @description If you want to bill the usages from the previous billing cycle, set this parameter to `true`. This is useful if the subscription has moved from another system into Chargebee and you haven't closed the previous cycle's invoice yet. This creates a `pending` invoice immediately on subscription creation, to which you can [add usages](/docs/api/usages#create_a_usage) for the previous cycle. - */ - - trial_end_action?:TrialEndAction; - - /** - * @description The type of initiator to be used for the payment request triggered by this operation. \* customer - Pass this value to indicate that the request is initiated by the customer \* merchant - Pass this value to indicate that the request is initiated by the merchant +If any non-`metered` items are present for the current term, they're also added to this `pending` invoice. As with all `pending` invoices, this invoice is also [closed automatically](https://www.chargebee.com/docs/metered_billing.html#configuring-metered-billing) or via an [API call](/docs/api/invoices#close_a_pending_invoice). This parameter can be passed only when the `create_pending_invoices` is `true` +. */ - payment_initiator?:PaymentInitiator; + first_invoice_pending?:boolean; /** - * @description Parameters for card + * @description Applicable only when [End-of-trial Action](https://www.chargebee.com/docs/2.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) has been enabled for the site. Whenever the subscription has a trial period, this attribute (parameter) is returned (required) and specifies the operation to be carried out for the subscription once the trial ends. \* cancel_subscription - The subscription cancels. \* activate_subscription - The subscription activates and charges are raised for non-metered items. \* plan_default - The action [configured for the site](https://www.chargebee.com/docs/trial_periods.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect. This is the default value when `trial_end_action` is defined for the plan. \* site_default - The action [configured for the site](https://www.chargebee.com/docs/trial_periods.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect. This is the default value when `trial_end_action` is **not** defined for the plan. */ - card?:{additional_information?:object,billing_addr1?:string,billing_addr2?:string,billing_city?:string,billing_country?:string,billing_state?:string,billing_state_code?:string,billing_zip?:string,cvv?:string,expiry_month?:number,expiry_year?:number,first_name?:string,gateway_account_id?:string,last_name?:string,number?:string}; + trial_end_action?:TrialEndAction; /** - * @description Parameters for payment_method + * @description The type of initiator to be used for the payment request triggered by this operation. \* customer - Pass this value to indicate that the request is initiated by the customer \* merchant - Pass this value to indicate that the request is initiated by the merchant */ - payment_method?:{additional_information?:object,gateway_account_id?:string,issuing_country?:string,reference_id?:string,tmp_token?:string,type?:Type}; + payment_initiator?:PaymentInitiator; /** - * @description Parameters for payment_intent + * @description Parameters for shipping_address */ - payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'sofort' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'card',reference_id?:string}; + 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}; /** - * @description Parameters for billing_address + * @description **Note:** This endpoint optionally supports 3DS. To use it [create](./payment_intents?prod_cat_ver=2#create_a_payment_intent) a `payment_intent` and provide it via this endpoint. - */ - - billing_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}; - - /** - * @description Parameters for shipping_address +Creates a new subscription for an existing customer in Chargebee. Any available [credits and excess payments](./customers?prod_cat_ver=2#customer_balances) for the customer are automatically applied on the invoice. +**See also** + +* [Create a purchase](https://apidocs.chargebee.com/docs/api/purchases#create_a_purchase): an operation that creates a purchase representing multiple subscriptions bought together by a customer. */ - 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}; + statement_descriptor?:{additional_info?:string,descriptor?:string}; /** - * @description Parameters for customer + * @description Parameters for payment_intent */ - customer?:{business_customer_without_vat_number?:boolean,einvoicing_method?:EinvoicingMethod,entity_identifier_scheme?:string,entity_identifier_standard?:string,is_einvoice_enabled?:boolean,registered_for_gst?:boolean,vat_number?:string,vat_number_prefix?:string}; + payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'faster_payments' | 'sofort' | 'upi' | 'venmo' | 'amazon_payments' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'pay_to' | 'card',reference_id?:string}; /** * @description Parameters for contract_term */ - contract_term?:{action_at_term_end?:'cancel' | 'renew_once' | 'renew' | 'evergreen',cancellation_cutoff_period?:number}; + contract_term?:{action_at_term_end?:'cancel' | 'renew' | 'evergreen',cancellation_cutoff_period?:number}; /** * @description Parameters for subscription_items @@ -1106,7 +1014,7 @@ Applicable only when [Metered Billing](https://www.chargebee.com/docs/metered_bi */ - discounts?:{amount?:number,apply_on:ApplyOn,duration_type:DurationType,id?:string,included_in_mrr?:boolean,item_price_id?:string,operation_type:OperationType,percentage?:number,period?:number,period_unit?:PeriodUnit}[]; + discounts?:{amount?:number,apply_on:ApplyOn,duration_type:DurationType,included_in_mrr?:boolean,item_price_id?:string,percentage?:number,period?:number,period_unit?:PeriodUnit}[]; /** * @description Parameters for item_tiers @@ -1115,457 +1023,406 @@ Applicable only when [Metered Billing](https://www.chargebee.com/docs/metered_bi item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; } - export interface RemoveCouponsResponse { - subscription:Subscription; - - customer:Customer; + export interface ListResponse { + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ - card?:Card; - } - export interface RemoveCouponsInputParam { + list:{subscription:Subscription,customer:Customer,card?:Card}[]; /** - * @description List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - coupon_ids?:string[]; - } - export interface ResumeResponse { - subscription:Subscription; - - customer:Customer; - - card?:Card; - - invoice?:Invoice; - - unbilled_charges?:UnbilledCharge[]; - } - export interface ResumeInputParam { - - /** - * @description List of options to resume the subscription. \* specific_date - Resume on a specific date \* immediately - Resume immediately - - */ - - resume_option?:ResumeOption; - - /** - * @description Date on which the subscription will be resumed. Applicable when **resume_option** is set as 'specific_date'. - - */ - - resume_date?:number; - - /** - * @description Applicable when charges get added during this operation and **resume_option** is set as 'immediately'. Allows to raise invoice immediately or add them to unbilled charges. \* add_to_unbilled_charges - Add to unbilled charges \* invoice_immediately - Invoice immediately - - */ - - charges_handling?:ChargesHandling; - - /** - * @description Applicable when the subscription has past due invoices and **resume_option** is set as 'immediately'. Allows to collect past due invoices or retain them as unpaid. If 'schedule_payment_collection' option is chosen in this field, remaining refundable credits and excess payments are applied. **Note:** The payment collection attempt will be asynchronous. \* no_action - Retain as unpaid \* schedule_payment_collection - Collect payment - - */ - - unpaid_invoices_handling?:UnpaidInvoicesHandling; - - /** - * @description null - - */ - - payment_initiator?:PaymentInitiator; - - /** - * @description Parameters for payment_intent - - */ - - payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'sofort' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'card',reference_id?:string}; - } - export interface CancelForItemsResponse { - subscription:Subscription; - - customer:Customer; - - card?:Card; - - invoice?:Invoice; - - unbilled_charges?:UnbilledCharge[]; - - credit_notes?:CreditNote[]; + next_offset?:string; } - export interface CancelForItemsInputParam { - - /** - * @description Set this to `true` if you want to cancel the subscription at the end of the current subscription billing cycle. The subscription `status` changes to `non_renewing`. - - */ - - end_of_term?:boolean; - - /** - * @description Specify the date/time at which you want to cancel the subscription. This parameter should not be provided when `end_of_term` is passed as `true`. `cancel_at` can be set to a value in the past. This is called backdating. Use backdating when the subscription has been canceled already but its billing has been delayed. The following prerequisites must be met to allow backdating: - -* Backdating must be enabled for subscription cancellation. -* The current day of the month does not exceed the limit set in Chargebee for backdating subscription cancellation. This limit is typically the day of the month by which the accounting for the previous month must be closed. -* The date is on or after `current_term_start`. -* The date is on or after the last date/time any of the following changes were made: - * Changes in the recurring items or their prices. - * Addition of non-recurring items. -* The date is not more than duration X into the past where X is the billing period of the plan. For example, if the period of the subscription's plan is 2 months and today is 14th April, `changes_scheduled_at` cannot be earlier than 14th February. -. - - */ - - cancel_at?:number; - + export interface ListInputParam { + [key : string]: any; /** - * @description For immediate cancellation (`end_of_term` = `false`), specify how to provide credits for current term charges. When not provided, the [site default](https://www.chargebee.com/docs/cancellations.html#configure-subscription-cancellation) is considered. \* none - No credits notes are created. \* full - Credits are issues for the full value of the current term charges. \* prorate - Prorated credits are issued. + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - - credit_option_for_current_term_charges?:CreditOptionForCurrentTermCharges; + + limit?:number; /** - * @description For immediate cancellation (`end_of_term` = `false`), specify how to handle any unbilled charges. When not provided, the [site default](https://www.chargebee.com/docs/cancellations.html#configure-subscription-cancellation) is considered. \* invoice - An invoice is generated immediately with the unbilled charges. \* delete - The unbilled charges are deleted. + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - - unbilled_charges_option?:UnbilledChargesOption; + + offset?:string; /** - * @description Applicable when the subscription has past due invoices. Specify this if you want to close the due invoices of the subscription. If specified as schedule_payment_collection/write_off, the due invoices of the subscription will be qualified for the selected operation after the remaining refundable credits and excess payments are applied. **Note:** The payment collection attempt will be asynchronous. Not applicable when 'end_of_term' is true. \* no_action - No action is taken. \* write_off - The amount due in the invoices will be written-off. Credit notes created due to write-off will not be sent in the response. \* schedule_payment_collection - An automatic charge for the due amount of the past invoices will be attempted on the payment method available, if customer's auto-collection property is 'ON'. + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - - account_receivables_handling?:AccountReceivablesHandling; + + include_deleted?:boolean; /** - * @description Applicable when the customer has remaining refundable credits(issued against online payments). If specified as schedule_refund, the refund will be initiated for these credits after they are applied against the subscription's past due invoices if any. **Note:** The refunds initiated will be asynchronous. Not applicable when 'end_of_term' is true. \* schedule_refund - Initiates refund of the remaining credits. \* no_action - No action is taken. + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - - refundable_credits_handling?:RefundableCreditsHandling; + + id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Cancels the current contract term. - -* `terminate_immediately` immediately does the following: - * sets the contract term [`status`](contract_terms#contract_term_status) to `terminated`. - * Cancels the subscription. - * Collects any [termination fee](contract_terms#termintation_fee). -* `end_of_contract_term` Sets the [`contract_term[action_at_term_end]`](contract_terms#contract_term_action_at_term_end) to `cancel`. In other words, the contract term is not renewed and the subscription is canceled at the end of the contract term. -. \* terminate_immediately - Terminate immediately \* end_of_contract_term - End of contract term + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - - contract_term_cancel_option?:ContractTermCancelOption; + + customer_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if `create_pending_invoices` is `true`, and if the site is configured to set invoice dates to date of closing, then upon invoice closure, this date is changed to the invoice closing date. `taxes` and `line_item_taxes` are computed based on the `tax` configuration as of `invoice_date`. When passing this parameter, the following prerequisites must be met: - -* `invoice_date` must be in the past. -* `invoice_date` is not more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December. -* It is not earlier than `cancel_at`. -. + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - - invoice_date?:number; + + item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Subscriptions \> Subscription Cancellation**. Must be passed if set as mandatory in the app. The codes are case-sensitive. + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - - cancel_reason_code?:string; + + item_price_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Parameters for subscription_items + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - - subscription_items?:{item_price_id?:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,unit_price?:number,unit_price_in_decimal?:string}[]; - } - export interface RegenerateInvoiceResponse { - invoice?:Invoice; - - unbilled_charges?:UnbilledCharge[]; - } - export interface RegenerateInvoiceInputParam { + + status?:{in?:string,is?:'in_trial' | 'paused' | 'future' | 'active' | 'cancelled' | 'non_renewing',is_not?:'in_trial' | 'paused' | 'future' | 'active' | 'cancelled' | 'non_renewing',not_in?:string}; /** - * @description The start date of the period being invoiced. The default value is [current_term_start](https://apidocs.chargebee.com/docs/api/subscriptions#subscription_current_term_start ). + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - - date_from?:number; + + cancel_reason?:{in?:string,is?:'tax_calculation_failed' | 'fraud_review_failed' | 'currency_incompatible_with_gateway' | 'non_compliant_eu_customer' | 'non_compliant_customer' | 'not_paid' | 'no_card',is_not?:'tax_calculation_failed' | 'fraud_review_failed' | 'currency_incompatible_with_gateway' | 'non_compliant_eu_customer' | 'non_compliant_customer' | 'not_paid' | 'no_card',is_present?:'true' | 'false',not_in?:string}; /** - * @description The end date of the period being invoiced. The default value is [current_term_end](https://apidocs.chargebee.com/docs/api/subscriptions#subscription_current_term_end ). + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - - date_to?:number; + + cancel_reason_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Whether the charges should be prorated according to the term specified by `date_from` and `date_to`. Should not be passed without `date_from` and `date_to`. + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - - prorate?:boolean; + + remaining_billing_cycles?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,is_present?:'true' | 'false',lt?:string,lte?:string}; /** - * @description Only applicable when [Consolidated Invoicing](https://www.chargebee.com/docs/consolidated-invoicing.html ) is enabled for the customer. Set to `false` to leave the current term charge for the subscription as [unbilled](https://www.chargebee.com/docs/unbilled-charges.html ). Once you have done this for all suitable subscriptions of the customer, call [Create an invoice for unbilled charges](https://apidocs.chargebee.com/docs/api/unbilled_charges#create_an_invoice_for_unbilled_charges ) to invoice them. + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ + + created_at?:{after?:string,before?:string,between?:string,on?:string}; - invoice_immediately?:boolean; - } - export interface ListResponse { /** * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - - list:{subscription:Subscription,customer:Customer,card?:Card}[]; + + activated_at?:{after?:string,before?:string,between?:string,is_present?:'true' | 'false',on?:string}; /** * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ + + next_billing_at?:{after?:string,before?:string,between?:string,on?:string}; - next_offset?:string; - } - export interface ListInputParam { - [key : string]: any; /** - * @description The number of resources to be returned. + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - limit?:number; + cancelled_at?:{after?:string,before?:string,between?:string,on?:string}; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - offset?:string; + has_scheduled_changes?:{is?:'true' | 'false'}; /** - * @description Indicates whether to include deleted objects in the list. The deleted objects have the attribute \`deleted\` as \`true\`. + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - include_deleted?:boolean; + updated_at?:{after?:string,before?:string,between?:string,on?:string}; /** - * @description A unique and immutable identifier for the subscription. If not provided, it is autogenerated. + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + offline_payment_method?:{in?:string,is?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',is_not?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',not_in?:string}; /** - * @description Identifier of the customer with whom this subscription is associated. + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - customer_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + auto_close_invoices?:{is?:'true' | 'false'}; /** - * @description Identifier of the plan for this subscription + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - plan_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + override_relationship?:{is?:'true' | 'false'}; /** - * @description The plan item code + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + sort_by?:{asc?:'updated_at' | 'created_at',desc?:'updated_at' | 'created_at'}; /** - * @description The plan item price code + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - item_price_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + business_entity_id?:{is?:string,is_not?:string,starts_with?:string}; /** - * @description Current state of the subscription + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. */ - status?:{in?:string,is?:'in_trial' | 'paused' | 'future' | 'active' | 'cancelled' | 'non_renewing',is_not?:'in_trial' | 'paused' | 'future' | 'active' | 'cancelled' | 'non_renewing',not_in?:string}; - + channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string}; + } + export interface ContractTermsForSubscriptionResponse { /** - * @description The reason for canceling the subscription. Set by Chargebee automatically. + * @description Retrieves a list of contract term resources for the subscription specified in the path. */ - - cancel_reason?:{in?:string,is?:'tax_calculation_failed' | 'fraud_review_failed' | 'currency_incompatible_with_gateway' | 'non_compliant_eu_customer' | 'non_compliant_customer' | 'not_paid' | 'no_card',is_not?:'tax_calculation_failed' | 'fraud_review_failed' | 'currency_incompatible_with_gateway' | 'non_compliant_eu_customer' | 'non_compliant_customer' | 'not_paid' | 'no_card',is_present?:'true' | 'false',not_in?:string}; + + list:{contract_term:ContractTerm}[]; /** - * @description Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Subscriptions \> Subscription Cancellation**. Must be passed if set as mandatory in the app. The codes are case-sensitive + * @description Retrieves a list of contract term resources for the subscription specified in the path. */ - - cancel_reason_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + next_offset?:string; + } + export interface ContractTermsForSubscriptionInputParam { + [key : string]: any; /** - * @description * When the subscription is not on a contract term: this value is the number of billing cycles remaining after the current cycle, at the end of which, the subscription cancels. -* When the subscription is on a [contract term](contract_terms): this value is the number of billing cycles remaining in the contract term after the current billing cycle. + * @description Retrieves a list of contract term resources for the subscription specified in the path. */ - remaining_billing_cycles?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,is_present?:'true' | 'false',lt?:string,lte?:string}; + limit?:number; /** - * @description The time at which the subscription was created. + * @description Retrieves a list of contract term resources for the subscription specified in the path. */ - created_at?:{after?:string,before?:string,between?:string,on?:string}; - + offset?:string; + } + export interface ListDiscountsResponse { /** - * @description Time at which the subscription `status` last changed to `active`. For example, this value is updated when an `in_trial` or `cancelled` subscription activates. + * @description Returns a list of discounts currently attached to the subscription given by `{subscription_id}`. The list is sorted by date of creation, in descending order. */ - - activated_at?:{after?:string,before?:string,between?:string,is_present?:'true' | 'false',on?:string}; + + list:{discount:Discount}[]; /** - * @description The date/time at which the next billing for the subscription happens. This is usually right after `current_term_end` unless multiple subscription terms were invoiced in advance using the `terms_to_charge` parameter. + * @description Returns a list of discounts currently attached to the subscription given by `{subscription_id}`. The list is sorted by date of creation, in descending order. */ - - next_billing_at?:{after?:string,before?:string,between?:string,on?:string}; + next_offset?:string; + } + export interface ListDiscountsInputParam { + [key : string]: any; /** - * @description Time at which subscription was cancelled or is set to be cancelled. + * @description Returns a list of discounts currently attached to the subscription given by `{subscription_id}`. The list is sorted by date of creation, in descending order. */ - cancelled_at?:{after?:string,before?:string,between?:string,on?:string}; + limit?:number; /** - * @description If `true`, there are subscription changes scheduled on next renewal. + * @description Returns a list of discounts currently attached to the subscription given by `{subscription_id}`. The list is sorted by date of creation, in descending order. */ - has_scheduled_changes?:{is?:'true' | 'false'}; + offset?:string; + } + export interface RetrieveResponse { + subscription:Subscription; + + customer:Customer; + + card?:Card; + } + + export interface RetrieveWithScheduledChangesResponse { + subscription:Subscription; + + customer:Customer; + + card?:Card; + } + + export interface RemoveScheduledChangesResponse { + subscription:Subscription; + + customer:Customer; + + card?:Card; + + credit_notes?:CreditNote[]; + } + + export interface RemoveScheduledCancellationResponse { + subscription:Subscription; + + customer:Customer; + + card?:Card; + } + export interface RemoveScheduledCancellationInputParam { /** - * @description To filter based on `updated_at`. This attribute will be present only if the resource has been updated after 2016-09-28. It is advisable when using this filter, to pass the `sort_by` input parameter as `updated_at` for a faster response. + * @description Number of cycles(plan interval) this subscription should be charged. After the billing cycles exhausted, the subscription will be cancelled. */ - - updated_at?:{after?:string,before?:string,between?:string,on?:string}; + + billing_cycles?:number; + } + export interface RemoveCouponsResponse { + subscription:Subscription; + + customer:Customer; + + card?:Card; + } + export interface RemoveCouponsInputParam { /** - * @description The preferred offline payment method for the subscription. + * @description List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. */ - - offline_payment_method?:{in?:string,is?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',is_not?:'bank_transfer' | 'no_preference' | 'ach_credit' | 'boleto' | 'check' | 'sepa_credit' | 'cash',not_in?:string}; + coupon_ids?:string[]; + } + export interface UpdateForItemsResponse { + subscription:Subscription; + + customer:Customer; + + card?:Card; + + invoice?:Invoice; + + unbilled_charges?:UnbilledCharge[]; + + credit_notes?:CreditNote[]; + } + export interface UpdateForItemsInputParam { + [key : string] : any; /** - * @description Set to `false` to override for this subscription, the [site-level setting](https://www.chargebee.com/docs/2.0/metered_billing.html#configuring-metered-billing) for auto-closing invoices. Only applicable when auto-closing invoices has been enabled for the site. This attribute has a higher precedence than the same attribute at the [customer level](/docs/api/customers?prod_cat_ver=2#customer_auto_close_invoices). + * @description Item ids of [mandatorily attached addons](./attached_items?prod_cat_ver=2) that are to be removed from the subscription. */ - - auto_close_invoices?:{is?:'true' | 'false'}; + + mandatory_items_to_remove?:string[]; /** - * @description If `true`, ignores the [hierarchy relationship](./customers?prod_cat_ver=2#customer_relationship) and uses customer as payment and invoice owner. + * @description If `true` then the existing `subscription_items` list for the subscription is replaced by the one provided. If `false` then the provided `subscription_items` list gets added to the existing list. */ - - override_relationship?:{is?:'true' | 'false'}; + + replace_items_list?:boolean; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description Updates [Net D](https://www.chargebee.com/docs/net_d.html) for the subscription. Net D is the number of days within which any invoice raised for the subscription must be paid. + +* If the value is `0` or a positive integer: Net D is set explicitly for the subscription to the value provided. The value must be one of those defined in the [site configuration](https://www.chargebee.com/docs/net_d.html#enable-net-d-for-chargebee-invoices). +* If the value is `-1`: The attribute is reset and therefore not returned by the API. In this case, when an invoice is raised -- whether now or later -- the `net_term_days` defined at the [customer level](customers#customer_net_term_days) is considered. +* If the value is not provided: The attribute is left unaltered. +. */ - - sort_by?:{asc?:'updated_at' | 'created_at',desc?:'updated_at' | 'created_at'}; + + net_term_days?:number; /** - * @description The unique ID of the [business entity](/docs/api?prod_cat_ver=2#mbe) of this subscription. This is always the same as the [business entity](/docs/api/subscriptions?prod_cat_ver=2#subscription_customer_id) of the customer. -The ID of the business entity created for the site. For Product Catalog 1.0, all the site data is tied to this business entity. -**Note** + * @description The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if `create_pending_invoices` is set to `true`, and if the site is configured to set invoice dates to date of closing, then upon invoice closure, this date is changed to the invoice closing date. taxes and line_item_taxes are computed based on the tax configuration as of `invoice_date`. When passing this parameter, the following prerequisites must be met: -[Multiple Business Entities](/docs/api?prod_cat_ver=2#mbe) is a feature available only on Product Catalog 2.0. +* `invoice_date` must be in the past. +* `invoice_date` is not more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December. +* It is not earlier than `changes_scheduled_at`, `reactivate_from`, or `trial_end`. +* `invoice_immediately` is `true`. +. */ - - business_entity_id?:{is?:string,is_not?:string,starts_with?:string}; + + invoice_date?:number; /** - * @description The subscription channel this object originated from and is maintained in. + * @description The new start date of a `future` subscription. Applicable only for `future` subscriptions. */ - - channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string}; - } - export interface ImportForItemsResponse { - subscription:Subscription; - - customer:Customer; - card?:Card; + start_date?:number; - invoice?:Invoice; - } - export interface ImportForItemsInputParam { - [key : string] : any; /** - * @description A unique and immutable identifier for the subscription. If not provided, it is autogenerated. + * @description The time at which the trial has ended or will end for the subscription. This is only allowed when the subscription `status` is `future`, `in_trial`, or `cancelled`. Also, the value must not be earlier than `changes_scheduled_at` or `start_date`. **Note** : This parameter can be backdated (set to a value in the past) only when the subscription is in `cancelled` or `in_trial` `status`. Do this to keep a record of when the trial ended in case it ended at some point in the past. When `trial_end` is backdated, the subscription immediately goes into `active` or `non_renewing` status. */ - id?:string; + trial_end?:number; /** - * @description End of the trial period for the subscription. This overrides the trial period set for the plan-item. The value must be later than `start_date`. Set it to `0` to have no trial period. + * @description Billing cycles set for plan-item price is used by default. */ - trial_end?:number; + billing_cycles?:number; /** - * @description The number of billing cycles the subscription runs before canceling. If not provided, then the billing cycles [set for the plan-item price](https://apidocs.chargebee.com/docs/api/item_prices?prod_cat_ver=2#item_price_billing_cycles) is used. + * @description The number of subscription billing cycles to [invoice in advance](https://www.chargebee.com/docs/advance-invoices.html). If a new term is started for the subscription due to this API call, then `terms_to_charge` is inclusive of this new term. See description for the `force_term_reset` parameter to learn more about when a subscription term is reset. */ - billing_cycles?:number; + terms_to_charge?:number; /** - * @description Defines [Net D](https://www.chargebee.com/docs/net_d.html) for the subscription. Net D is the number of days within which any invoice raised for the subscription must be paid. + * @description If the subscription `status` is `cancelled` and it is being reactivated via this operation, this is the date/time at which the subscription should be reactivated. +**Note:** It is recommended not to pass this parameter along with `changed_scheduled_at`. `reactivate_from` can be backdated (set to a value in the past). Use backdating when the subscription has been reactivated already but its billing has been delayed. Backdating is allowed only when the following prerequisites are met: -* If a value is provided: Net D is set explicitly for the subscription to the value provided. The value must be one among those defined in the [site configuration](https://www.chargebee.com/docs/net_d.html#enable-net-d-for-chargebee-invoices). -* If not provided: The attribute is not set and therefore not returned by the API. In this case, when an invoice is raised -- whether now or later -- the `net_term_days` defined at the [customer level](customers#customer_net_term_days) is considered. +* Backdating must be enabled for subscription reactivation operations. +* The current day of the month does not exceed the limit set in Chargebee for backdating subscription change. This limit is the day of the month by which the accounting for the previous month must be closed. +* The date is on or after the last date/time any of the product catalog items of the subscription were changed. +* The date is not more than duration X into the past where X is the billing period of the plan. For example, if the period of the plan in the subscription is 2 months and today is 14th April, `changes_scheduled_at` cannot be earlier than 14th February. . */ - net_term_days?:number; + reactivate_from?:number; /** - * @description The date/time at which the subscription is to start or has started. If not provided, the subscription starts immediately. + * @description Override the [billing alignment mode](https://www.chargebee.com/docs/calendar-billing.html#alignment-of-billing-date) chosen for the site for calendar billing. Only applicable when using calendar billing. \* immediate - Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly.. \* delayed - Subscription period will be aligned with the configured billing date at the next renewal. */ - start_date?:number; + billing_alignment_mode?:BillingAlignmentMode; /** * @description Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property. \* on - Whenever an invoice is created for this subscription, an automatic charge will be attempted on the payment method available. \* off - Automatic collection of charges will not be made for this subscription. Use this for offline payments. @@ -1575,147 +1432,159 @@ The ID of the business entity created for the site. For Product Catalog 1.0, all auto_collection?:AutoCollection; /** - * @description Purchase order number for this subscription. + * @description The preferred offline payment method for the subscription. \* sepa_credit - SEPA Credit \* cash - Cash \* no_preference - No Preference \* bank_transfer - Bank Transfer \* check - Check \* boleto - Boleto \* ach_credit - ACH Credit */ - po_number?:string; + offline_payment_method?:OfflinePaymentMethod; /** - * @description List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](./coupon_codes). + * @description Purchase order number for this subscription. */ - coupon_ids?:string[]; + po_number?:string; /** - * @description Id of the payment source to be attached to this subscription. + * @description List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](https://apidocs.chargebee.com/docs/api/coupon_codes). If `changes_scheduled_at` is in the past, then the currently available coupons can be used even if they were not available as of the date for when the change is scheduled. */ - payment_source_id?:string; + coupon_ids?:string[]; /** - * @description Current state of the subscription. \* future - The subscription is scheduled to start at a future date. \* active - The subscription is active and will be charged for automatically based on the items in it. \* cancelled - The subscription has been canceled and is no longer in service. \* in_trial - The subscription is in trial. \* non_renewing - The subscription will be canceled at the end of the current term. \* paused - The subscription is [paused](https://www.chargebee.com/docs/2.0/pause-subscription.html). The subscription will not renew while in this state. + * @description If `true` then the existing `coupon_ids` list for the subscription is replaced by the one provided. If `false` then the provided list gets added to the existing `coupon_ids`. */ - status:'in_trial' | 'paused' | 'future' | 'active' | 'cancelled' | 'non_renewing'; + replace_coupon_list?:boolean; /** - * @description End of the current billing term. Subscription is renewed immediately after this. If not given, this will be calculated based on plan billing cycle. - - - -**Note:** + * @description * When `true`: [Prorated credits or charges](https://www.chargebee.com/docs/2.0/proration.html#proration-mechanism) are created as applicable for this change. +* When `false`: The subscription is changed without creating any credits or charges. +* When not provided, the value configured in the [site settings](https://www.chargebee.com/docs/2.0/proration.html#proration-for-subscription-change) is considered. +**Caveat** -For subscription status: `non_renewing`, `active`, and `paused`, `current_term_end` is required. +For further changes within the same billing term, when `prorate` is set to `true`, **credits** are **not created** when **all** the conditions below hold true: +An immediate previous change was made +* with `prorate` set to `false` and +* no changes were made to the subscription's billing term and +* a change was made to either the subscription's items or their prices. -. + */ + + prorate?:boolean; + + /** + * @description Set this to true if you want the update to be applied at the end of the current subscription billing cycle. */ - current_term_end?:number; + end_of_term?:boolean; /** - * @description Start of the current billing period of the subscription. This is required when the subscription `status` is `paused`. When the `status` is `active` or `non_renewing`, it defaults to the current time. + * @description Say the subscription has the renewal date as 28th of every month. When the plan-item price of the subscription is set to one that has the same billing period as the current plan-item price, the subscription change does not change the term. In other words, the subscription still renews on the 28th. Passing this parameter as `true` will have the subscription reset its term to the current date (provided `end_of_term` is false). +**Note**: When the new plan-item price has a billing period different from the current plan-item price of the subscription, the term is always reset, regardless of the value passed for this parameter. */ - current_term_start?:number; + force_term_reset?:boolean; /** - * @description Start of the trial period for the subscription. When not passed, it is assumed to be current time. When passed for a `future` subscription, it implies that the subscription goes into `in_trial` when it starts. + * @description When the `status` of the subscription is `cancelled`, this parameter determines whether the subscription is reactivated upon making this API request. Unless passed explicitly as `false`, this parameter is implied as `true` when you provide the `subscription_items` parameter. */ - trial_start?:number; + reactivate?:boolean; /** - * @description Time at which subscription was cancelled or is set to be cancelled. + * @description The Chargebee payment token generated by Chargebee JS. */ - cancelled_at?:number; + token_id?:string; /** - * @description Time at which the subscription was started. Is `null` for `future`subscriptions as it is yet to be started. + * @description A customer-facing note added to all invoices associated with this subscription. This note is one among [all the notes](/docs/api/invoices#invoice_notes) displayed on the invoice PDF. */ - started_at?:number; + invoice_notes?:string; /** - * @description The time at which the subscription was activated. A subscription is "activated" when its `status` changes from any other, to either `active` or `non_renewing`. - -The following conditions must be satisfied when passing this parameter: - -* When `status` is `active`, `non_renewing`, or `paused`, `activated_at` must be on or after `trial_end` or `started_at`. Additionally, `activated_at` must be on or before `current_term_start`. -* When `status` is `in_trial`, `activated_at` must precede `trial_start` - -#### Note: - -This parameter should not be provided when passing `status` as `future` or `cancelled`. + * @description A collection of key-value pairs that provides extra information about the subscription. +**Note:** There's a character limit of 65,535. +[Learn more](advanced-features#metadata). */ - activated_at?:number; + meta_data?:object; /** - * @description When a pause has been scheduled, it is the date/time of scheduled pause. When the subscription is in the `paused` state, it is the date/time when the subscription was paused. + * @description If there are charges raised immediately for the subscription, this parameter specifies whether those charges are to be invoiced immediately or added to [unbilled charges](https://www.chargebee.com/docs/unbilled-charges.html). The default value is as per the [site settings](https://www.chargebee.com/docs/unbilled-charges.html#configuration). +**Note:** `invoice_immediately` only affects charges that are raised at the time of execution of this API call. Any charges scheduled to be raised in the future are not affected by this parameter. . */ - pause_date?:number; + invoice_immediately?:boolean; /** - * @description For a paused subscription, it is the date/time when the subscription is scheduled to resume. If the pause is for an indefinite period, this value is not returned. + * @description If `true`, ignores the [hierarchy relationship](./customers?prod_cat_ver=2#customer_relationship) and uses customer as payment and invoice owner. */ - resume_date?:number; + override_relationship?:boolean; /** - * @description Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same as `billing_cycles` or a custom value depending on the [site configuration](https://www.chargebee.com/docs/contract-terms.html#configuring-contract-terms). + * @description When `change_option` is set to `specific_date`, then set the date/time at which the subscription change is to happen or has happened. **Note:** It is recommended not to pass this parameter along with `reactivate_from`. `changes_scheduled_at` can be set to a value in the past. This is called backdating the subscription change and is performed when the subscription change has already been provisioned but its billing has been delayed. Backdating is allowed only when the following prerequisites are met: + +* Backdating must be enabled for subscription change operations. +* Only the following changes can be backdated: + * Changes in the recurring items or their prices. + * Addition of non-recurring items. +* Subscription `status` is `active`, `cancelled`, or `non_renewing`. +* The current day of the month does not exceed the limit set in Chargebee for backdating subscription change. This limit is typically the day of the month by which the accounting for the previous month must be closed. +* The date is on or after `current_term_start`. +* The date is on or after the last date/time any of the following changes were made: + * Changes in the recurring items or their prices. + * Addition of non-recurring items. +* The date is not more than duration X into the past where X is the billing period of the plan. For example, if the period of the plan in the subscription is 2 months and today is 14th April, `changes_scheduled_at` cannot be earlier than 14th February. +. */ - contract_term_billing_cycle_on_renewal?:number; + changes_scheduled_at?:number; /** - * @description Set as `true` if you want an invoice to be created for the subscription. - -* The invoice will be created for the subscription only if it has an `active` or `non_renewing` status. -* The period of the invoice is from `current_term_start` to `current_term_end`. -* The invoice will not be generated if the subscription amount is zero dollars (for that period) and 'Hide Zero Value Line Items' option is enabled in site settings. + * @description When the quote is converted, this attribute determines the date/time as of when the subscription change is to be carried out. \* end_of_term - The change is carried out at the end of the current billing cycle of the subscription. \* specific_date - The change is carried out as of the date specified under `changes_scheduled_at`. \* immediately - The change is carried out immediately. */ - create_current_term_invoice?:boolean; + change_option?:ChangeOption; /** - * @description A customer-facing note added to all invoices associated with this subscription. This note is one among [all the notes](/docs/api/invoices#invoice_notes) displayed on the invoice PDF. + * @description Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same as `billing_cycles` or a custom value depending on the [site configuration](https://www.chargebee.com/docs/contract-terms.html#configuring-contract-terms). */ - invoice_notes?:string; + contract_term_billing_cycle_on_renewal?:number; /** - * @description A set of key-value pairs stored as additional information for the subscription. [Learn more](./#meta_data). + * @description The period of time by which the first term of the subscription is to be extended free-of-charge. The value must be in multiples of free_period_unit. */ - meta_data?:object; + free_period?:number; /** - * @description Imports a subscription into Chargebee. + * @description The unit of time in multiples of which the free_period parameter is expressed. The value must be equal to or lower than the [period_unit](/docs/api/plans#create_a_plan_period_unit) attribute of the [plan](/docs/api/subscriptions#create_a_subscription_plan_id) chosen. \* week - Charge based on week(s) \* month - Charge based on month(s) \* day - Charge based on day(s) \* year - Charge based on year(s) */ - cancel_reason_code?:string; + free_period_unit?:FreePeriodUnit; /** * @description Indicates whether the invoices for this subscription are generated with a `pending` `status`. This attribute is set to `true` automatically when the subscription has item prices that belong to `metered` items. @@ -1740,18 +1609,46 @@ Applicable only when [Metered Billing](https://www.chargebee.com/docs/metered_bi auto_close_invoices?:boolean; /** - * @description Parameters for contract_term + * @description Applicable only when [End-of-trial Action](https://www.chargebee.com/docs/2.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) has been enabled for the site. Whenever the subscription has a trial period, this attribute (parameter) is returned (required) and specifies the operation to be carried out for the subscription once the trial ends. \* activate_subscription - The subscription activates and charges are raised for non-metered items. \* cancel_subscription - The subscription cancels. \* plan_default - The action [configured for the site](https://www.chargebee.com/docs/trial_periods.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect. This is the default value when `trial_end_action` is defined for the plan. \* site_default - The action [configured for the site](https://www.chargebee.com/docs/trial_periods.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect. This is the default value when `trial_end_action` is **not** defined for the plan. */ - contract_term?:{action_at_term_end?:'cancel' | 'renew_once' | 'renew' | 'evergreen',billing_cycle?:number,cancellation_cutoff_period?:number,contract_start?:number,created_at?:number,id?:string,total_amount_raised?:number,total_amount_raised_before_tax?:number}; + trial_end_action?:TrialEndAction; /** - * @description Parameters for transaction + * @description The type of initiator to be used for the payment request triggered by this operation. \* customer - Pass this value to indicate that the request is initiated by the customer \* merchant - Pass this value to indicate that the request is initiated by the merchant */ - transaction?:{amount?:number,date?:number,payment_method?:PaymentMethod,reference_number?:string}; + payment_initiator?:PaymentInitiator; + + /** + * @description Parameters for card + + */ + + card?:{additional_information?:object,billing_addr1?:string,billing_addr2?:string,billing_city?:string,billing_country?:string,billing_state?:string,billing_state_code?:string,billing_zip?:string,cvv?:string,expiry_month?:number,expiry_year?:number,first_name?:string,gateway_account_id?:string,last_name?:string,number?:string}; + + /** + * @description Parameters for payment_method + + */ + + payment_method?:{additional_information?:object,gateway_account_id?:string,issuing_country?:string,reference_id?:string,tmp_token?:string,type?:Type}; + + /** + * @description Parameters for payment_intent + + */ + + payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'faster_payments' | 'sofort' | 'upi' | 'venmo' | 'amazon_payments' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'pay_to' | 'card',reference_id?:string}; + + /** + * @description Parameters for billing_address + + */ + + billing_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}; /** * @description Parameters for shipping_address @@ -1761,25 +1658,41 @@ Applicable only when [Metered Billing](https://www.chargebee.com/docs/metered_bi 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}; /** - * @description Parameters for subscription_items + * @description **Note:** This endpoint optionally supports 3DS. To use it, [create](./payment_intents?prod_cat_ver=2#create_a_payment_intent) a `payment_intent` and provide it via this endpoint. + +Updates the specified subscription by setting the parameters passed. Any parameters not provided are left unmodified. If an invoice is generated for this operation, any available [credits and excess payments](./customers?prod_cat_ver=2#customer_balances) for the customer are automatically applied. */ - subscription_items?:{billing_cycles?:number,charge_on_event?:ChargeOnEvent,charge_once?:boolean,item_price_id:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,trial_end?:number,unit_price?:number,unit_price_in_decimal?:string}[]; + statement_descriptor?:{additional_info?:string,descriptor?:string}; /** - * @description Parameters for discounts + * @description Parameters for customer */ - discounts?:{amount?:number,apply_on:ApplyOn,duration_type:DurationType,included_in_mrr?:boolean,item_price_id?:string,percentage?:number,period?:number,period_unit?:PeriodUnit}[]; + customer?:{business_customer_without_vat_number?:boolean,einvoicing_method?:EinvoicingMethod,entity_identifier_scheme?:string,entity_identifier_standard?:string,is_einvoice_enabled?:boolean,registered_for_gst?:boolean,vat_number?:string,vat_number_prefix?:string}; /** - * @description Parameters for charged_items + * @description Parameters for contract_term */ - charged_items?:{item_price_id?:string,last_charged_at?:number}[]; + contract_term?:{action_at_term_end?:'cancel' | 'renew_once' | 'renew' | 'evergreen',cancellation_cutoff_period?:number}; + + /** + * @description Parameters for subscription_items + + */ + + subscription_items?:{billing_cycles?:number,charge_on_event?:ChargeOnEvent,charge_on_option?:ChargeOnOption,charge_once?:boolean,item_price_id:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,trial_end?:number,unit_price?:number,unit_price_in_decimal?:string}[]; + + /** + * @description Parameters for discounts + + */ + + discounts?:{amount?:number,apply_on:ApplyOn,duration_type:DurationType,id?:string,included_in_mrr?:boolean,item_price_id?:string,operation_type:OperationType,percentage?:number,period?:number,period_unit?:PeriodUnit}[]; /** * @description Parameters for item_tiers @@ -1788,34 +1701,43 @@ Applicable only when [Metered Billing](https://www.chargebee.com/docs/metered_bi item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; } - export interface RetrieveAdvanceInvoiceScheduleResponse { - advance_invoice_schedules:AdvanceInvoiceSchedule[]; - } - - export interface RemoveScheduledCancellationResponse { + export interface ChangeTermEndResponse { subscription:Subscription; customer:Customer; card?:Card; + + invoice?:Invoice; + + unbilled_charges?:UnbilledCharge[]; + + credit_notes?:CreditNote[]; } - export interface RemoveScheduledCancellationInputParam { + export interface ChangeTermEndInputParam { /** - * @description Number of cycles(plan interval) this subscription should be charged. After the billing cycles exhausted, the subscription will be cancelled. + * @description The time at which the current term should end for this subscription. */ - billing_cycles?:number; - } - export interface RetrieveWithScheduledChangesResponse { - subscription:Subscription; + term_ends_at:number; - customer:Customer; + /** + * @description Applicable for *active* / *non_renewing* subscriptions. If specified as *true* prorated charges / credits will be added during this operation. + + */ - card?:Card; + prorate?:boolean; + + /** + * @description If there are charges raised immediately for the subscription, this parameter specifies whether those charges are to be invoiced immediately or added to [unbilled charges](https://www.chargebee.com/docs/unbilled-charges.html). The default value is as per the [site settings](https://www.chargebee.com/docs/unbilled-charges.html#configuration). +**Note:** `invoice_immediately` only affects charges that are raised at the time of execution of this API call. Any charges scheduled to be raised in the future are not affected by this parameter. . + + */ + + invoice_immediately?:boolean; } - export interface ReactivateResponse { subscription:Subscription; @@ -1888,35 +1810,124 @@ Applicable only when [Metered Billing](https://www.chargebee.com/docs/metered_bi */ - invoice_date?:number; + invoice_date?:number; + + /** + * @description Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same as `billing_cycles` or a custom value depending on the [site configuration](https://www.chargebee.com/docs/contract-terms.html#configuring-contract-terms). + + */ + + contract_term_billing_cycle_on_renewal?:number; + + /** + * @description The type of initiator to be used for the payment request triggered by this operation. \* customer - Pass this value to indicate that the request is initiated by the customer \* merchant - Pass this value to indicate that the request is initiated by the merchant + + */ + + payment_initiator?:PaymentInitiator; + + /** + * @description Parameters for contract_term + + */ + + contract_term?:{action_at_term_end?:'cancel' | 'renew' | 'evergreen',cancellation_cutoff_period?:number}; + + /** + * @description **Note:** This operation optionally supports 3DS verification flow. To achieve the same, create the [Payment Intent](/docs/api/#3ds-implementation-guide) and pass it as input parameter to this API. + +This API is used to reactivate a **cancelled** subscription. You may also optionally specify a trial end date, to move the subscription to **In Trial** state. If trial end is not specified, the subscription will be activated and any applicable charges will be initiated. + +Unless the billing cycle is specified, it will be set to plan's default billing cycle. + +During an in-term reactivation^++^, unless the billing cycle is specified, the subscription's remaining billing cycles will be restored. If a trial end date is specified, then the plan's default billing cycle is used. + +**What is an "in-term reactivation"?** +An "in-term reactivation" happens when the billing term of the subscription is retained upon cancellation and reactivation is initiated within that term. + +**When is the 'billing term' retained for a cancelled subscription?** +When dunning (payment failure retry settings) is configured with the last retry configured as + +* cancel subscription and mark invoice as 'Not Paid', or +* cancel subscription and mark the invoice as 'Voided' and the case if any of the current term invoices is partially or fully paid, the invoice is not voided but instead Chargebee marks the invoices as 'Not Paid'. + + + +**Note :** In both cases, the billing term is retained and upon reactivation the subscription will be moved to active state (if the plan does not have a trial period) and no invoice will be generated. Ensure that you collect any unpaid invoices. + +**Example :** A Subscription was billed from 1st to 31st of a month and it was cancelled on the 20th due to one of the above cases (billing term is not reset). If the reactivation happens on 25th then it is considered an in-term reactivation. + + */ + + statement_descriptor?:{additional_info?:string,descriptor?:string}; + + /** + * @description Parameters for payment_intent + + */ + + payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'faster_payments' | 'sofort' | 'upi' | 'venmo' | 'amazon_payments' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'pay_to' | 'card',reference_id?:string}; + } + export interface AddChargeAtTermEndResponse { + estimate:Estimate; + } + export interface AddChargeAtTermEndInputParam { + + /** + * @description The amount to be charged. The unit depends on the [type of currency](/docs/api#md_disabled). + + */ + + amount?:number; + + /** + * @description Description for this charge. + + */ + + description:string; + + /** + * @description The decimal representation of the amount for the [one-time charge](https://www.chargebee.com/docs/charges.html#one-time-charges ). Provide the value in major units of the currency. Can be provided only when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + + amount_in_decimal?:string; + + /** + * @description Indicates the type of sale carried out. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. \* retail - Transaction is a sale to an end user \* wholesale - Transaction is a sale to another company that will resell your product or service to another consumer \* vendor_use - Transaction is for an item that is subject to vendor use tax \* consumed - Transaction is for an item that is consumed directly + + */ + + avalara_sale_type?:AvalaraSaleType; /** - * @description Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same as `billing_cycles` or a custom value depending on the [site configuration](https://www.chargebee.com/docs/contract-terms.html#configuring-contract-terms). + * @description Indicates the type of product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. */ - contract_term_billing_cycle_on_renewal?:number; + avalara_transaction_type?:number; /** - * @description null + * @description Indicates the type of service for the product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. */ - payment_initiator?:PaymentInitiator; + avalara_service_type?:number; /** - * @description Parameters for contract_term + * @description The time when the service period for the charge starts. */ - contract_term?:{action_at_term_end?:'cancel' | 'renew' | 'evergreen',cancellation_cutoff_period?:number}; + date_from?:number; /** - * @description Parameters for payment_intent + * @description The time when the service period for the charge ends. */ - payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'sofort' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'card',reference_id?:string}; + date_to?:number; } export interface ChargeFutureRenewalsResponse { subscription:Subscription; @@ -1968,123 +1979,138 @@ Applicable only when [Metered Billing](https://www.chargebee.com/docs/metered_bi specific_dates_schedule?:{date?:number,terms_to_charge?:number}[]; } - export interface AddChargeAtTermEndResponse { - estimate:Estimate; + export interface EditAdvanceInvoiceScheduleResponse { + advance_invoice_schedules:AdvanceInvoiceSchedule[]; } - export interface AddChargeAtTermEndInputParam { + export interface EditAdvanceInvoiceScheduleInputParam { /** - * @description The amount to be charged. The unit depends on the [type of currency](/docs/api#md_disabled). + * @description The number of billing cycles in one interval. */ - amount?:number; + terms_to_charge?:number; /** - * @description Description for this charge. + * @description The type of advance invoice or advance invoicing schedule. \* specific_dates - Charge on [specific dates](subscriptions#charge_future_renewals_specific_dates_schedule_date). For each date, specify the [number of billing cycles](subscriptions#charge_future_renewals_specific_dates_schedule_terms_to_charge) to charge for. Up to 5 dates can be configured. \* fixed_intervals - Charge at fixed intervals of time. Specify the [number of billing cycles](subscriptions#charge_future_renewals_terms_to_charge) that constitute an interval and the number of [days before each interval](subscriptions#charge_future_renewals_fixed_interval_schedule_days_before_renewal) that the invoice should be generated. Also specify [when the schedule should end](subscriptions#charge_future_renewals_fixed_interval_schedule_end_schedule_on). */ - description:string; + schedule_type?:ScheduleType; /** - * @description The decimal representation of the amount for the [one-time charge](https://www.chargebee.com/docs/charges.html#one-time-charges ). Provide the value in major units of the currency. Can be provided only when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + * @description Parameters for fixed_interval_schedule */ - amount_in_decimal?:string; + fixed_interval_schedule?:{days_before_renewal?:number,end_date?:number,end_schedule_on?:EndScheduleOn,number_of_occurrences?:number}; /** - * @description Indicates the type of sale carried out. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. \* retail - Transaction is a sale to an end user \* wholesale - Transaction is a sale to another company that will resell your product or service to another consumer \* vendor_use - Transaction is for an item that is subject to vendor use tax \* consumed - Transaction is for an item that is consumed directly + * @description Parameters for specific_dates_schedule */ - avalara_sale_type?:AvalaraSaleType; + specific_dates_schedule?:{date?:number,id?:string,terms_to_charge?:number}[]; + } + export interface RetrieveAdvanceInvoiceScheduleResponse { + advance_invoice_schedules:AdvanceInvoiceSchedule[]; + } + + export interface RemoveAdvanceInvoiceScheduleResponse { + subscription:Subscription; + + advance_invoice_schedules?:AdvanceInvoiceSchedule[]; + } + export interface RemoveAdvanceInvoiceScheduleInputParam { /** - * @description Indicates the type of product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. + * @description Parameters for specific_dates_schedule */ - avalara_transaction_type?:number; + specific_dates_schedule?:{id?:string}[]; + } + export interface RegenerateInvoiceResponse { + invoice?:Invoice; + + unbilled_charges?:UnbilledCharge[]; + } + export interface RegenerateInvoiceInputParam { /** - * @description Indicates the type of service for the product to be taxed. Values for this field can be taken from Avalara. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. + * @description The start date of the period being invoiced. The default value is [current_term_start](https://apidocs.chargebee.com/docs/api/subscriptions#subscription_current_term_start ). */ - avalara_service_type?:number; + date_from?:number; /** - * @description The time when the service period for the charge starts. + * @description The end date of the period being invoiced. The default value is [current_term_end](https://apidocs.chargebee.com/docs/api/subscriptions#subscription_current_term_end ). */ - date_from?:number; + date_to?:number; /** - * @description The time when the service period for the charge ends. + * @description Whether the charges should be prorated according to the term specified by `date_from` and `date_to`. Should not be passed without `date_from` and `date_to`. */ - date_to?:number; - } - export interface RemoveScheduledChangesResponse { - subscription:Subscription; - - customer:Customer; + prorate?:boolean; - card?:Card; + /** + * @description Only applicable when [Consolidated Invoicing](https://www.chargebee.com/docs/consolidated-invoicing.html ) is enabled for the customer. Set to `false` to leave the current term charge for the subscription as [unbilled](https://www.chargebee.com/docs/unbilled-charges.html ). Once you have done this for all suitable subscriptions of the customer, call [Create an invoice for unbilled charges](https://apidocs.chargebee.com/docs/api/unbilled_charges#create_an_invoice_for_unbilled_charges ) to invoice them. + + */ - credit_notes?:CreditNote[]; + invoice_immediately?:boolean; } - - export interface ChangeTermEndResponse { - subscription:Subscription; - - customer:Customer; + export interface ImportContractTermResponse { + contract_term:ContractTerm; + } + export interface ImportContractTermInputParam { - card?:Card; + /** + * @description Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same as `billing_cycles` or a custom value depending on the [site configuration](https://www.chargebee.com/docs/contract-terms.html#configuring-contract-terms). + + */ - invoice?:Invoice; + contract_term_billing_cycle_on_renewal?:number; - unbilled_charges?:UnbilledCharge[]; + /** + * @description Parameters for contract_term + + */ - credit_notes?:CreditNote[]; + contract_term?:{action_at_term_end?:'cancel' | 'renew_once' | 'renew' | 'evergreen',billing_cycle?:number,cancellation_cutoff_period?:number,contract_end?:number,contract_start?:number,created_at?:number,id?:string,status?:'active' | 'cancelled' | 'completed' | 'terminated',total_amount_raised?:number,total_amount_raised_before_tax?:number,total_contract_value?:number,total_contract_value_before_tax?:number}; } - export interface ChangeTermEndInputParam { + export interface ImportUnbilledChargesResponse { + unbilled_charges:UnbilledCharge[]; + } + export interface ImportUnbilledChargesInputParam { /** - * @description The time at which the current term should end for this subscription. + * @description Parameters for unbilled_charges */ - term_ends_at:number; + unbilled_charges?:{amount?:number,amount_in_decimal?:string,date_from:number,date_to:number,description?:string,discount_amount?:number,entity_id?:string,entity_type:'addon_item_price' | 'plan_item_price' | 'charge_item_price' | 'adhoc',id?:string,is_advance_charge?:boolean,quantity?:number,quantity_in_decimal?:string,unit_amount?:number,unit_amount_in_decimal?:string,use_for_proration?:boolean}[]; /** - * @description Applicable for *active* / *non_renewing* subscriptions. If specified as *true* prorated charges / credits will be added during this operation. + * @description Parameters for discounts */ - prorate?:boolean; + discounts?:{amount:number,description?:string,entity_id?:string,entity_type?:'item_level_coupon' | 'item_level_discount' | 'document_level_discount' | 'document_level_coupon',unbilled_charge_id?:string}[]; /** - * @description If there are charges raised immediately for the subscription, this parameter specifies whether those charges are to be invoiced immediately or added to [unbilled charges](https://www.chargebee.com/docs/unbilled-charges.html). The default value is as per the [site settings](https://www.chargebee.com/docs/unbilled-charges.html#configuration). -**Note:** `invoice_immediately` only affects charges that are raised at the time of execution of this API call. Any charges scheduled to be raised in the future are not affected by this parameter. . + * @description Parameters for tiers */ - invoice_immediately?:boolean; - } - export interface DeleteResponse { - subscription:Subscription; - - customer:Customer; - - card?:Card; + tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,quantity_used?:number,quantity_used_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string,unbilled_charge_id:string,unit_amount?:number,unit_amount_in_decimal?:string}[]; } - - export interface CreateWithItemsResponse { + export interface ImportForItemsResponse { subscription:Subscription; customer:Customer; @@ -2092,10 +2118,8 @@ Applicable only when [Metered Billing](https://www.chargebee.com/docs/metered_bi card?:Card; invoice?:Invoice; - - unbilled_charges?:UnbilledCharge[]; } - export interface CreateWithItemsInputParam { + export interface ImportForItemsInputParam { [key : string] : any; /** * @description A unique and immutable identifier for the subscription. If not provided, it is autogenerated. @@ -2104,17 +2128,6 @@ Applicable only when [Metered Billing](https://www.chargebee.com/docs/metered_bi id?:string; - /** - * @description The unique ID of the [business entity](/docs/api/advanced-features?prod_cat_ver=2#mbe) this subscription should be [linked](/docs/api/advanced-features?prod_cat_ver=2#mbe-linked-be) to. Applicable only when multiple business entities have been created for the site. This must be the same as the business entity of the `{customer_id}` for the operation to be successful. -**Note** - -An alternative way of passing this parameter is by means of a [custom HTTP header](/docs/api/advanced-features?prod_cat_ver=2#mbe-header-main). -. - - */ - - business_entity_id?:string; - /** * @description End of the trial period for the subscription. This overrides the trial period set for the plan-item. The value must be later than `start_date`. Set it to `0` to have no trial period. @@ -2129,13 +2142,6 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade billing_cycles?:number; - /** - * @description Item ids of [mandatorily attached addons](./attached_items?prod_cat_ver=2) that are to be removed from the subscription. - - */ - - mandatory_items_to_remove?:string[]; - /** * @description Defines [Net D](https://www.chargebee.com/docs/net_d.html) for the subscription. Net D is the number of days within which any invoice raised for the subscription must be paid. @@ -2148,12 +2154,7 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade net_term_days?:number; /** - * @description The date/time at which the subscription is to start. If not provided, the subscription starts immediately. You can provide a value in the past as well. This is called backdating the subscription creation and is done when the subscription has already been provisioned but its billing has been delayed. Backdating is allowed only when the following prerequisites are met: - -* Backdating is enabled for subscription creation operations. -* The current day of the month does not exceed the limit set in Chargebee for backdating such operations. This day is typically the day of the month by which the accounting for the previous month must be closed. -* The date is not more than duration X into the past, where X is the billing period of the plan. For example, if the period of the plan in the subscription is 2 months and today is 14th April, `start_date` cannot be earlier than 14th February. -. + * @description The date/time at which the subscription is to start or has started. If not provided, the subscription starts immediately. */ @@ -2167,109 +2168,147 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade auto_collection?:AutoCollection; /** - * @description The number of subscription billing cycles (including the first one) to [invoice in advance](https://www.chargebee.com/docs/advance-invoices.html). + * @description Purchase order number for this subscription. */ - terms_to_charge?:number; + po_number?:string; /** - * @description Override the [billing alignment mode](https://www.chargebee.com/docs/calendar-billing.html#alignment-of-billing-date) for Calendar Billing. Only applicable when using Calendar Billing. The default value is that which has been configured for the site. \* immediate - Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly.. \* delayed - Subscription period will be aligned with the configured billing date at the next renewal. + * @description List of coupons to be applied to this subscription. You can provide coupon ids or [coupon codes](./coupon_codes). */ - billing_alignment_mode?:BillingAlignmentMode; + coupon_ids?:string[]; /** - * @description Purchase order number for this subscription. + * @description Id of the payment source to be attached to this subscription. */ - po_number?:string; + payment_source_id?:string; /** - * @description List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. + * @description Current state of the subscription. \* future - The subscription is scheduled to start at a future date. \* active - The subscription is active and will be charged for automatically based on the items in it. \* cancelled - The subscription has been canceled and is no longer in service. \* in_trial - The subscription is in trial. \* non_renewing - The subscription will be canceled at the end of the current term. \* paused - The subscription is [paused](https://www.chargebee.com/docs/2.0/pause-subscription.html). The subscription will not renew while in this state. */ - coupon_ids?:string[]; + status:'in_trial' | 'paused' | 'future' | 'active' | 'cancelled' | 'non_renewing'; /** - * @description Id of the payment source to be attached to this subscription. + * @description End of the current billing term. Subscription is renewed immediately after this. If not given, this will be calculated based on plan billing cycle. + + + +**Note:** + + +For subscription status: `non_renewing`, `active`, and `paused`, `current_term_end` is required. + + + +. */ - payment_source_id?:string; + current_term_end?:number; /** - * @description If `true`, ignores the [hierarchy relationship](./customers?prod_cat_ver=2#customer_relationship) and uses customer as payment and invoice owner. + * @description Start of the current billing period of the subscription. This is required when the subscription `status` is `paused`. When the `status` is `active` or `non_renewing`, it defaults to the current time. */ - override_relationship?:boolean; + current_term_start?:number; /** - * @description A customer-facing note added to all invoices associated with this subscription. This note is one among [all the notes](/docs/api/invoices#invoice_notes) displayed on the invoice PDF. + * @description Start of the trial period for the subscription. When not passed, it is assumed to be current time. When passed for a `future` subscription, it implies that the subscription goes into `in_trial` when it starts. */ - invoice_notes?:string; + trial_start?:number; /** - * @description The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if `create_pending_invoices` is set to `true`, and if the site is configured to set invoice dates to the date of closing, then upon invoice closure, this date is changed to the invoice closing date. `taxes` and `line_item_taxes` are computed based on the tax configuration as of `invoice_date`. When passing this parameter, the following prerequisites must be met: + * @description Time at which subscription was cancelled or is set to be cancelled. -* `invoice_date` must be in the past. -* It is not earlier than `start_date`. -* It is not more than one calendar month into the past. Eg. If today is 13th January, then you cannot pass a value that is earlier than 13th December. -* `invoice_immediately` is true. -. + */ + + cancelled_at?:number; + + /** + * @description Time at which the subscription was started. Is `null` for `future`subscriptions as it is yet to be started. */ - invoice_date?:number; + started_at?:number; /** - * @description A set of key-value pairs stored as additional information for the subscription. [Learn more](./#meta_data). + * @description The time at which the subscription was activated. A subscription is "activated" when its `status` changes from any other, to either `active` or `non_renewing`. + +The following conditions must be satisfied when passing this parameter: + +* When `status` is `active`, `non_renewing`, or `paused`, `activated_at` must be on or after `trial_end` or `started_at`. Additionally, `activated_at` must be on or before `current_term_start`. +* When `status` is `in_trial`, `activated_at` must precede `trial_start` + +#### Note: + +This parameter should not be provided when passing `status` as `future` or `cancelled`. */ - meta_data?:object; + activated_at?:number; /** - * @description If there are charges raised immediately for the subscription, this parameter specifies whether those charges are to be invoiced immediately or added to [unbilled charges](https://www.chargebee.com/docs/unbilled-charges.html). The default value is as per the [site settings](https://www.chargebee.com/docs/unbilled-charges.html#configuration). -**Note:** `invoice_immediately` only affects charges that are raised at the time of execution of this API call. Any charges scheduled to be raised in the future are not affected by this parameter. . + * @description When a pause has been scheduled, it is the date/time of scheduled pause. When the subscription is in the `paused` state, it is the date/time when the subscription was paused. */ - invoice_immediately?:boolean; + pause_date?:number; /** - * @description Indicates whether the primary payment source should be replaced with this payment source. In case of Create Subscription for Customer endpoint, the default value is True. Otherwise, the default value is False. + * @description For a paused subscription, it is the date/time when the subscription is scheduled to resume. If the pause is for an indefinite period, this value is not returned. + + */ + + resume_date?:number; + + /** + * @description Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same as `billing_cycles` or a custom value depending on the [site configuration](https://www.chargebee.com/docs/contract-terms.html#configuring-contract-terms). + + */ + + contract_term_billing_cycle_on_renewal?:number; + + /** + * @description Set as `true` if you want an invoice to be created for the subscription. + +* The invoice will be created for the subscription only if it has an `active` or `non_renewing` status. +* The period of the invoice is from `current_term_start` to `current_term_end`. +* The invoice will not be generated if the subscription amount is zero dollars (for that period) and 'Hide Zero Value Line Items' option is enabled in site settings. */ - replace_primary_payment_source?:boolean; + create_current_term_invoice?:boolean; /** - * @description The period of time by which the first term of the subscription is to be extended free-of-charge. The value must be in multiples of free_period_unit. + * @description A customer-facing note added to all invoices associated with this subscription. This note is one among [all the notes](/docs/api/invoices#invoice_notes) displayed on the invoice PDF. */ - free_period?:number; + invoice_notes?:string; /** - * @description The unit of time in multiples of which the free_period parameter is expressed. The value must be equal to or lower than the [period_unit](/docs/api/plans#create_a_plan_period_unit) attribute of the [plan](/docs/api/subscriptions#create_a_subscription_plan_id) chosen. \* week - Charge based on week(s) \* month - Charge based on month(s) \* day - Charge based on day(s) \* year - Charge based on year(s) + * @description A set of key-value pairs stored as additional information for the subscription. [Learn more](./#meta_data). */ - free_period_unit?:FreePeriodUnit; + meta_data?:object; /** - * @description Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same as `billing_cycles` or a custom value depending on the [site configuration](https://www.chargebee.com/docs/contract-terms.html#configuring-contract-terms). + * @description Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Subscriptions \> Subscription Cancellation**. Must be passed if set as mandatory in the app. The codes are case-sensitive. */ - contract_term_billing_cycle_on_renewal?:number; + cancel_reason_code?:string; /** * @description Indicates whether the invoices for this subscription are generated with a `pending` `status`. This attribute is set to `true` automatically when the subscription has item prices that belong to `metered` items. @@ -2294,28 +2333,18 @@ Applicable only when [Metered Billing](https://www.chargebee.com/docs/metered_bi auto_close_invoices?:boolean; /** - * @description If you want to bill the usages from the previous billing cycle, set this parameter to `true`. This is useful if the subscription has moved from another system into Chargebee and you haven't closed the previous cycle's invoice yet. This creates a `pending` invoice immediately on subscription creation, to which you can [add usages](/docs/api/usages#create_a_usage) for the previous cycle. - -If any non-`metered` items are present for the current term, they're also added to this `pending` invoice. As with all `pending` invoices, this invoice is also [closed automatically](https://www.chargebee.com/docs/metered_billing.html#configuring-metered-billing) or via an [API call](/docs/api/invoices#close_a_pending_invoice). This parameter can be passed only when the `create_pending_invoices` is `true` -. - - */ - - first_invoice_pending?:boolean; - - /** - * @description Applicable only when [End-of-trial Action](https://www.chargebee.com/docs/2.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) has been enabled for the site. Whenever the subscription has a trial period, this attribute (parameter) is returned (required) and specifies the operation to be carried out for the subscription once the trial ends. \* cancel_subscription - The subscription cancels. \* activate_subscription - The subscription activates and charges are raised for non-metered items. \* plan_default - The action [configured for the site](https://www.chargebee.com/docs/trial_periods.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect. This is the default value when `trial_end_action` is defined for the plan. \* site_default - The action [configured for the site](https://www.chargebee.com/docs/trial_periods.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect. This is the default value when `trial_end_action` is **not** defined for the plan. + * @description Parameters for contract_term */ - trial_end_action?:TrialEndAction; + contract_term?:{action_at_term_end?:'cancel' | 'renew_once' | 'renew' | 'evergreen',billing_cycle?:number,cancellation_cutoff_period?:number,contract_start?:number,created_at?:number,id?:string,total_amount_raised?:number,total_amount_raised_before_tax?:number}; /** - * @description The type of initiator to be used for the payment request triggered by this operation. \* customer - Pass this value to indicate that the request is initiated by the customer \* merchant - Pass this value to indicate that the request is initiated by the merchant + * @description Parameters for transaction */ - payment_initiator?:PaymentInitiator; + transaction?:{amount?:number,date?:number,payment_method?:PaymentMethod,reference_number?:string}; /** * @description Parameters for shipping_address @@ -2325,32 +2354,25 @@ If any non-`metered` items are present for the current term, they' 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}; /** - * @description Parameters for payment_intent - - */ - - payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'sofort' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'card',reference_id?:string}; - - /** - * @description Parameters for contract_term + * @description Parameters for subscription_items */ - contract_term?:{action_at_term_end?:'cancel' | 'renew' | 'evergreen',cancellation_cutoff_period?:number}; + subscription_items?:{billing_cycles?:number,charge_on_event?:ChargeOnEvent,charge_once?:boolean,item_price_id:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,trial_end?:number,unit_price?:number,unit_price_in_decimal?:string}[]; /** - * @description Parameters for subscription_items + * @description Parameters for discounts */ - subscription_items?:{billing_cycles?:number,charge_on_event?:ChargeOnEvent,charge_on_option?:ChargeOnOption,charge_once?:boolean,item_price_id:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,trial_end?:number,unit_price?:number,unit_price_in_decimal?:string}[]; + discounts?:{amount?:number,apply_on:ApplyOn,duration_type:DurationType,included_in_mrr?:boolean,item_price_id?:string,percentage?:number,period?:number,period_unit?:PeriodUnit}[]; /** - * @description Parameters for discounts + * @description Parameters for charged_items */ - discounts?:{amount?:number,apply_on:ApplyOn,duration_type:DurationType,included_in_mrr?:boolean,item_price_id?:string,percentage?:number,period?:number,period_unit?:PeriodUnit}[]; + charged_items?:{item_price_id?:string,last_charged_at?:number}[]; /** * @description Parameters for item_tiers @@ -2359,33 +2381,28 @@ If any non-`metered` items are present for the current term, they' item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; } - export interface ImportUnbilledChargesResponse { - unbilled_charges:UnbilledCharge[]; - } - export interface ImportUnbilledChargesInputParam { - - /** - * @description Parameters for unbilled_charges - - */ + export interface OverrideBillingProfileResponse { + subscription:Subscription; - unbilled_charges?:{amount?:number,amount_in_decimal?:string,date_from:number,date_to:number,description?:string,discount_amount?:number,entity_id?:string,entity_type:'addon_item_price' | 'plan_item_price' | 'charge_item_price' | 'adhoc',id?:string,is_advance_charge?:boolean,quantity?:number,quantity_in_decimal?:string,unit_amount?:number,unit_amount_in_decimal?:string,use_for_proration?:boolean}[]; + payment_source?:PaymentSource; + } + export interface OverrideBillingProfileInputParam { /** - * @description Parameters for discounts + * @description Unique identifier of the payment source to be attached to this subscription. */ - discounts?:{amount:number,description?:string,entity_id?:string,entity_type?:'item_level_coupon' | 'item_level_discount' | 'document_level_discount' | 'document_level_coupon',unbilled_charge_id?:string}[]; + payment_source_id?:string; /** - * @description Parameters for tiers + * @description Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property. \* off - Automatic collection of charges will not be made for this subscription. Use this for offline payments. \* on - Whenever an invoice is created for this subscription, an automatic charge will be attempted on the payment method available. */ - tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,quantity_used?:number,quantity_used_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string,unbilled_charge_id:string,unit_amount?:number,unit_amount_in_decimal?:string}[]; + auto_collection?:AutoCollection; } - export interface RemoveScheduledResumptionResponse { + export interface DeleteResponse { subscription:Subscription; customer:Customer; @@ -2393,158 +2410,192 @@ If any non-`metered` items are present for the current term, they' card?:Card; } - export interface RetrieveResponse { + export interface PauseResponse { subscription:Subscription; customer:Customer; card?:Card; + + invoice?:Invoice; + + unbilled_charges?:UnbilledCharge[]; + + credit_notes?:CreditNote[]; } - - export interface ImportContractTermResponse { - contract_term:ContractTerm; - } - export interface ImportContractTermInputParam { + export interface PauseInputParam { /** - * @description Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same as `billing_cycles` or a custom value depending on the [site configuration](https://www.chargebee.com/docs/contract-terms.html#configuring-contract-terms). + * @description List of options to pause the subscription. \* billing_cycles - + +Pause at the end of the current term, and resume automatically after the set number of billing cycles (in [skip_billing_cycles](/docs/api/subscriptions#pause_a_subscription_skip_billing_cycles)) have been skipped +\* immediately - Pause immediately +\* end_of_term - Pause at the end of current term +\* specific_date - Pause on a specific date */ - contract_term_billing_cycle_on_renewal?:number; + pause_option?:PauseOption; /** - * @description Parameters for contract_term + * @description Date on which the subscription will be paused. Applicable when `specific_date` option is chosen in the [pause_option](/docs/api/subscriptions#pause_a_subscription_pause_option) field. + +For non-renewing subscriptions, `pause_date` should be before the cancellation date. */ - contract_term?:{action_at_term_end?:'cancel' | 'renew_once' | 'renew' | 'evergreen',billing_cycle?:number,cancellation_cutoff_period?:number,contract_end?:number,contract_start?:number,created_at?:number,id?:string,status?:'active' | 'cancelled' | 'completed' | 'terminated',total_amount_raised?:number,total_amount_raised_before_tax?:number,total_contract_value?:number,total_contract_value_before_tax?:number}; - } - export interface OverrideBillingProfileResponse { - subscription:Subscription; + pause_date?:number; - payment_source?:PaymentSource; - } - export interface OverrideBillingProfileInputParam { + /** + * @description Applicable when unbilled charges are present for the subscription and [pause_option](/docs/api/subscriptions#pause_a_subscription_pause_option) is set as `immediately`. **Note:** On the invoice raised, an automatic charge is attempted on the payment method available, if customer's auto-collection property is set to `on`. +\* invoice - + +Invoice charges + +If `invoice` is chosen, an automatic charge is attempted on the payment method available if the customer has enabled auto-collection. If a payment collection fails or when auto-collection is not enabled, the invoice is closed as unpaid. +\* no_action - + +Retain as unbilled + +If `no_action` is chosen, charges are added to the resumption invoice. + + */ + + unbilled_charges_handling?:UnbilledChargesHandling; /** - * @description Unique identifier of the payment source to be attached to this subscription. + * @description Handles dunning for invoices already in the dunning cycle when a subscription is paused. Applicable when [pause_option](/docs/api/subscriptions#pause_a_subscription_pause_option) is set as `immediately`. + +If invoice is in the dunning cycle, `invoice_dunning_handing` allows you to `stop` or `continue` dunning. +\* continue - Continue dunning \* stop - Stop dunning */ - payment_source_id?:string; + invoice_dunning_handling?:InvoiceDunningHandling; /** - * @description Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property. \* off - Automatic collection of charges will not be made for this subscription. Use this for offline payments. \* on - Whenever an invoice is created for this subscription, an automatic charge will be attempted on the payment method available. + * @description The number of subscription billing cycles that will be skipped. The subscription resumes after the set number of billing cycles have been skipped. This is applicable only when the value of of [pause_option](/docs/api/subscriptions#pause_a_subscription_pause_option) is `billing_cycles`. */ - auto_collection?:AutoCollection; + skip_billing_cycles?:number; + + /** + * @description For a paused subscription, it is the date/time when the subscription is scheduled to resume. If the pause is for an indefinite period, this value is not returned. + +For non-renewing subscriptions,`resume_date` should be before the cancellation date. + + */ + + resume_date?:number; } - export interface RemoveScheduledPauseResponse { + export interface CancelForItemsResponse { subscription:Subscription; customer:Customer; card?:Card; + + invoice?:Invoice; + + unbilled_charges?:UnbilledCharge[]; + + credit_notes?:CreditNote[]; } - - export interface EditAdvanceInvoiceScheduleResponse { - advance_invoice_schedules:AdvanceInvoiceSchedule[]; - } - export interface EditAdvanceInvoiceScheduleInputParam { + export interface CancelForItemsInputParam { /** - * @description The number of billing cycles in one interval. + * @description Set this to `true` if you want to cancel the subscription at the end of the current subscription billing cycle. The subscription `status` changes to `non_renewing`. */ - terms_to_charge?:number; + end_of_term?:boolean; /** - * @description The type of advance invoice or advance invoicing schedule. \* specific_dates - Charge on [specific dates](subscriptions#charge_future_renewals_specific_dates_schedule_date). For each date, specify the [number of billing cycles](subscriptions#charge_future_renewals_specific_dates_schedule_terms_to_charge) to charge for. Up to 5 dates can be configured. \* fixed_intervals - Charge at fixed intervals of time. Specify the [number of billing cycles](subscriptions#charge_future_renewals_terms_to_charge) that constitute an interval and the number of [days before each interval](subscriptions#charge_future_renewals_fixed_interval_schedule_days_before_renewal) that the invoice should be generated. Also specify [when the schedule should end](subscriptions#charge_future_renewals_fixed_interval_schedule_end_schedule_on). + * @description Specify the date/time at which you want to cancel the subscription. This parameter should not be provided when `end_of_term` is passed as `true`. `cancel_at` can be set to a value in the past. This is called backdating. Use backdating when the subscription has been canceled already but its billing has been delayed. The following prerequisites must be met to allow backdating: + +* Backdating must be enabled for subscription cancellation. +* The current day of the month does not exceed the limit set in Chargebee for backdating subscription cancellation. This limit is typically the day of the month by which the accounting for the previous month must be closed. +* The date is on or after `current_term_start`. +* The date is on or after the last date/time any of the following changes were made: + * Changes in the recurring items or their prices. + * Addition of non-recurring items. +* The date is not more than duration X into the past where X is the billing period of the plan. For example, if the period of the subscription's plan is 2 months and today is 14th April, `changes_scheduled_at` cannot be earlier than 14th February. +. */ - schedule_type?:ScheduleType; + cancel_at?:number; /** - * @description Parameters for fixed_interval_schedule + * @description For immediate cancellation (`end_of_term` = `false`), specify how to provide credits for current term charges. When not provided, the [site default](https://www.chargebee.com/docs/cancellations.html#configure-subscription-cancellation) is considered. \* none - No credits notes are created. \* full - Credits are issues for the full value of the current term charges. \* prorate - Prorated credits are issued. */ - fixed_interval_schedule?:{days_before_renewal?:number,end_date?:number,end_schedule_on?:EndScheduleOn,number_of_occurrences?:number}; + credit_option_for_current_term_charges?:CreditOptionForCurrentTermCharges; /** - * @description Parameters for specific_dates_schedule + * @description For immediate cancellation (`end_of_term` = `false`), specify how to handle any unbilled charges. When not provided, the [site default](https://www.chargebee.com/docs/cancellations.html#configure-subscription-cancellation) is considered. \* invoice - An invoice is generated immediately with the unbilled charges. \* delete - The unbilled charges are deleted. */ - specific_dates_schedule?:{date?:number,id?:string,terms_to_charge?:number}[]; - } - export interface ListDiscountsResponse { + unbilled_charges_option?:UnbilledChargesOption; + /** - * @description Returns a list of discounts currently attached to the subscription given by `{subscription_id}`. The list is sorted by date of creation, in descending order. + * @description Applicable when the subscription has past due invoices. Specify this if you want to close the due invoices of the subscription. If specified as schedule_payment_collection/write_off, the due invoices of the subscription will be qualified for the selected operation after the remaining refundable credits and excess payments are applied. **Note:** The payment collection attempt will be asynchronous. Not applicable when 'end_of_term' is true. \* no_action - No action is taken. \* write_off - The amount due in the invoices will be written-off. Credit notes created due to write-off will not be sent in the response. \* schedule_payment_collection - An automatic charge for the due amount of the past invoices will be attempted on the payment method available, if customer's auto-collection property is 'ON'. */ - list:{discount:Discount}[]; + account_receivables_handling?:AccountReceivablesHandling; /** - * @description Returns a list of discounts currently attached to the subscription given by `{subscription_id}`. The list is sorted by date of creation, in descending order. + * @description Applicable when the customer has remaining refundable credits(issued against online payments). If specified as schedule_refund, the refund will be initiated for these credits after they are applied against the subscription's past due invoices if any. **Note:** The refunds initiated will be asynchronous. Not applicable when 'end_of_term' is true. \* schedule_refund - Initiates refund of the remaining credits. \* no_action - No action is taken. */ - next_offset?:string; - } - export interface ListDiscountsInputParam { - [key : string]: any; - /** - * @description The number of resources to be returned. - - */ - - limit?:number; + refundable_credits_handling?:RefundableCreditsHandling; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Cancels the current contract term. - */ - - offset?:string; - } - export interface ContractTermsForSubscriptionResponse { - /** - * @description Retrieves a list of contract term resources for the subscription specified in the path. +* `terminate_immediately` immediately does the following: + * sets the contract term [`status`](contract_terms#contract_term_status) to `terminated`. + * Cancels the subscription. + * Collects any [termination fee](contract_terms#termintation_fee). +* `end_of_contract_term` Sets the [`contract_term[action_at_term_end]`](contract_terms#contract_term_action_at_term_end) to `cancel`. In other words, the contract term is not renewed and the subscription is canceled at the end of the contract term. +. \* terminate_immediately - Terminate immediately \* end_of_contract_term - End of contract term */ - list:{contract_term:ContractTerm}[]; + contract_term_cancel_option?:ContractTermCancelOption; /** - * @description Retrieves a list of contract term resources for the subscription specified in the path. + * @description The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if `create_pending_invoices` is `true`, and if the site is configured to set invoice dates to date of closing, then upon invoice closure, this date is changed to the invoice closing date. `taxes` and `line_item_taxes` are computed based on the `tax` configuration as of `invoice_date`. When passing this parameter, the following prerequisites must be met: + +* `invoice_date` must be in the past. +* `invoice_date` is not more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December. +* It is not earlier than `cancel_at`. +. */ - next_offset?:string; - } - export interface ContractTermsForSubscriptionInputParam { - [key : string]: any; + invoice_date?:number; + /** - * @description The number of resources to be returned. + * @description Reason code for canceling the subscription. Must be one from a list of reason codes set in the Chargebee app in **Settings \> Configure Chargebee \> Reason Codes \> Subscriptions \> Subscription Cancellation**. Must be passed if set as mandatory in the app. The codes are case-sensitive. */ - - limit?:number; + + cancel_reason_code?:string; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Parameters for subscription_items */ - - offset?:string; + + subscription_items?:{item_price_id?:string,quantity?:number,quantity_in_decimal?:string,service_period_days?:number,unit_price?:number,unit_price_in_decimal?:string}[]; } - export interface PauseResponse { + export interface ResumeResponse { subscription:Subscription; customer:Customer; @@ -2554,136 +2605,282 @@ If any non-`metered` items are present for the current term, they' invoice?:Invoice; unbilled_charges?:UnbilledCharge[]; - - credit_notes?:CreditNote[]; } - export interface PauseInputParam { + export interface ResumeInputParam { - /** - * @description List of options to pause the subscription. \* billing_cycles - - -Pause at the end of the current term, and resume automatically after the set number of billing cycles (in [skip_billing_cycles](/docs/api/subscriptions#pause_a_subscription_skip_billing_cycles)) have been skipped -\* immediately - Pause immediately -\* end_of_term - Pause at the end of current term -\* specific_date - Pause on a specific date + /** + * @description List of options to resume the subscription. \* specific_date - Resume on a specific date \* immediately - Resume immediately */ - pause_option?:PauseOption; + resume_option?:ResumeOption; /** - * @description Date on which the subscription will be paused. Applicable when `specific_date` option is chosen in the [pause_option](/docs/api/subscriptions#pause_a_subscription_pause_option) field. - -For non-renewing subscriptions, `pause_date` should be before the cancellation date. + * @description Date on which the subscription will be resumed. Applicable when **resume_option** is set as 'specific_date'. */ - pause_date?:number; + resume_date?:number; /** - * @description Applicable when unbilled charges are present for the subscription and [pause_option](/docs/api/subscriptions#pause_a_subscription_pause_option) is set as `immediately`. **Note:** On the invoice raised, an automatic charge is attempted on the payment method available, if customer's auto-collection property is set to `on`. -\* invoice - - -Invoice charges - -If `invoice` is chosen, an automatic charge is attempted on the payment method available if the customer has enabled auto-collection. If a payment collection fails or when auto-collection is not enabled, the invoice is closed as unpaid. -\* no_action - - -Retain as unbilled - -If `no_action` is chosen, charges are added to the resumption invoice. + * @description Applicable when charges get added during this operation and **resume_option** is set as 'immediately'. Allows to raise invoice immediately or add them to unbilled charges. \* add_to_unbilled_charges - Add to unbilled charges \* invoice_immediately - Invoice immediately */ - unbilled_charges_handling?:UnbilledChargesHandling; + charges_handling?:ChargesHandling; /** - * @description Handles dunning for invoices already in the dunning cycle when a subscription is paused. Applicable when [pause_option](/docs/api/subscriptions#pause_a_subscription_pause_option) is set as `immediately`. - -If invoice is in the dunning cycle, `invoice_dunning_handing` allows you to `stop` or `continue` dunning. -\* continue - Continue dunning \* stop - Stop dunning + * @description Applicable when the subscription has past due invoices and **resume_option** is set as 'immediately'. Allows to collect past due invoices or retain them as unpaid. If 'schedule_payment_collection' option is chosen in this field, remaining refundable credits and excess payments are applied. **Note:** The payment collection attempt will be asynchronous. \* no_action - Retain as unpaid \* schedule_payment_collection - Collect payment */ - invoice_dunning_handling?:InvoiceDunningHandling; + unpaid_invoices_handling?:UnpaidInvoicesHandling; /** - * @description The number of subscription billing cycles that will be skipped. The subscription resumes after the set number of billing cycles have been skipped. This is applicable only when the value of of [pause_option](/docs/api/subscriptions#pause_a_subscription_pause_option) is `billing_cycles`. + * @description The type of initiator to be used for the payment request triggered by this operation. \* customer - Pass this value to indicate that the request is initiated by the customer \* merchant - Pass this value to indicate that the request is initiated by the merchant */ - skip_billing_cycles?:number; + payment_initiator?:PaymentInitiator; /** - * @description For a paused subscription, it is the date/time when the subscription is scheduled to resume. If the pause is for an indefinite period, this value is not returned. - -For non-renewing subscriptions,`resume_date` should be before the cancellation date. + * @description Parameters for payment_intent */ - resume_date?:number; + payment_intent?:{additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'boleto' | 'direct_debit' | 'faster_payments' | 'sofort' | 'upi' | 'venmo' | 'amazon_payments' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'pay_to' | 'card',reference_id?:string}; + } + export interface RemoveScheduledPauseResponse { + subscription:Subscription; + + customer:Customer; + + card?:Card; + } + + export interface RemoveScheduledResumptionResponse { + subscription:Subscription; + + customer:Customer; + + card?:Card; } + export interface SubscriptionItem { - item_price_id?:string; + /** + * @description The unique identifier of the item price. + + */ + + item_price_id:string; + + /** + * @description The type of item. There must be one and only one item of type `plan` in this list. \* plan - Plan \* charge - Charge \* addon - Addon + + */ + + item_type:'charge' | 'addon' | 'plan'; - item_type?:'charge' | 'addon' | 'plan'; + /** + * @description The quantity of the item purchased + + */ quantity?:number; + /** + * @description The decimal representation of the quantity of the item purchased. Can be provided for quantity-based item prices and only when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + quantity_in_decimal?:string; + /** + * @description The price/per unit price of the item. When not provided, [the value set](/docs/api/item_prices?prod_cat_ver=2#item_price_attributes) for the item price is used. This is only applicable when the `pricing_model` of the item price is `flat_fee` or `per_unit`. Also, it is only allowed when [price overriding](https://www.chargebee.com/docs/price-override.html) is enabled for the site. The value depends on the type of currency. If `changes_scheduled_at` is in the past and a `unit_price` is not passed, then the item price's current unit price is considered even if the item price did not exist on the date as of when the change is scheduled. + + */ + unit_price?:number; + /** + * @description The decimal representation of the price or per-unit price of the plan. The value is in major units of the currency. Always returned when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + unit_price_in_decimal?:string; + /** + * @description The total amount for the item as determined from `unit_price`, `free_quantity`, `quantity` and `item_tiers` as applicable. The value depends on the [type of currency](./#handling_currency_units). + + */ + amount?:number; + /** + * @description The decimal representation of the total amount for the item, in major units of the currency. Always returned when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + amount_in_decimal?:string; + /** + * @description The `free_quantity` of the plan-item as [specified](./item_prices?prod_cat_ver=2) for the item price. + + */ + free_quantity?:number; + /** + * @description The `free_quantity_in_decimal` as set for the item price. Returned for quantity-based item prices when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + free_quantity_in_decimal?:string; + /** + * @description The date/time when the trial period of the item ends. Applies to plan-items and----when [enabled](https://www.chargebee.com/docs/2.0/addons-trial.html)----addon-items as well. + + */ + trial_end?:number; + /** + * @description For the plan-item price: +the value determines the number of billing cycles the subscription runs before canceling automatically. If not provided, then [the value set](./item_prices?prod_cat_ver=2#item_price_attributes) for the plan-item price is used. + +For addon-item prices: +If [addon billing cycles](https://www.chargebee.com/docs/2.0/addons-billingcycle.html) are enabled then this is the number of subscription billing cycles for which the addon is included. If not provided, then [the value set under attached addons](./attached_items?prod_cat_ver=2#attached_item_attributes) is used. Further, if that value is not provided, then [the value set for the addon-item price](./item_prices?prod_cat_ver=2#item_price_attributes) is used. + + */ + billing_cycles?:number; + /** + * @description The service period of the item in days from the day of charge. + + */ + service_period_days?:number; + /** + * @description When `charge_on_option` option is set to `on_event`, this parameter specifies the event at which the charge-item is applied to the subscription. This parameter only applies to charge-items. \* contract_termination - when a contract term is [terminated](./subscriptions?prod_cat_ver=2#cancel_subscription_for_items_contract_term_cancel_option). \* subscription_trial_start - the time when the trial period of the subscription begins. \* subscription_activation - the moment a subscription enters an `active` or `non-renewing` state. Also includes reactivations of canceled subscriptions. \* plan_activation - same as subscription activation, but also includes the case when the plan-item of the subscription is changed. \* subscription_creation - the time of creation of the subscription. + + */ + charge_on_event?:'subscription_creation' | 'subscription_activation' | 'subscription_trial_start' | 'contract_termination' | 'plan_activation'; + /** + * @description Indicates if the charge-item is to be charged only once or each time the `charge_on_event` occurs. This parameter only applies to charge-items. + + */ + charge_once?:boolean; + /** + * @description Indicates when the charge-item is to be charged. This parameter only applies to charge-items. \* immediately - The item is charged immediately on being added to the subscription. \* on_event - The item is charged at the occurrence of the event specified as `charge_on_event`. + + */ + charge_on_option?:'on_event' | 'immediately'; } export interface ItemTier { - item_price_id?:string; + /** + * @description The id of the item price to which this tier belongs. + + */ + + item_price_id:string; + + /** + * @description The lowest value in the quantity tier. + + */ + + starting_unit:number; - starting_unit?:number; + /** + * @description The highest value in the quantity tier. + + */ ending_unit?:number; - price?:number; + /** + * @description The per-unit price for the tier when the `pricing_model` is `tiered` or `volume`. The total cost for the item price when the `pricing_model` is `stairstep`. The value is in the minor unit of the currency. + + */ + + price:number; + + /** + * @description The decimal representation of the the lowest value of quantity in this tier. This is zero for the lowest tier. For all other tiers, it is the same as `ending_unit_in_decimal` of the next lower tier. Returned only when the pricing_model is `tiered`, `volume` or `stairstep` and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ starting_unit_in_decimal?:string; + /** + * @description The decimal representation of the highest value of quantity in this tier. This attribute is not applicable for the highest tier. For all other tiers, it must be equal to the `starting_unit_in_decimal` of the next higher tier. Returned only when the pricing_model is `tiered`, `volume` or `stairstep` and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + ending_unit_in_decimal?:string; + /** + * @description The decimal representation of the per-unit price for the tier when the `pricing_model` is `tiered` or `volume`. When the `pricing_model` is `stairstep`, it is the decimal representation of the total price for the item. The value is in major units of the currency. Returned when the plan is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units) is enabled. + + */ + price_in_decimal?:string; - index?:number; + /** + * @description The index number of the subscription to which the item price is added. Provide a unique number between `0` and `4` (inclusive) for each subscription that is to be created. + + */ + + index:number; } export interface ChargedItem { - item_price_id?:string; + /** + * @description A unique ID for your system to identify the item price. + + */ - last_charged_at?:number; + item_price_id:string; + + /** + * @description Timestamp indicating when this charge item_price was last charged for this subscription. + + */ + + last_charged_at:number; } export interface Coupon { - coupon_id?:string; + /** + * @description Used to uniquely identify the coupon + + */ + + coupon_id:string; + + /** + * @description The date till when the coupon can be applied. Applicable for `limited_period` [coupons](./coupons?prod_cat_ver=2) only. + + */ apply_till?:number; - applied_count?:number; + /** + * @description Number of times this coupon has been applied for this subscription + + */ + + applied_count:number; + + /** + * @description The coupon code used to redeem the coupon. Will be present only when associated code for a coupon is used. + + */ coupon_code?:string; } @@ -2798,7 +2995,7 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - index?:number; + index:number; } export interface ReferralInfo { /** @@ -2848,14 +3045,14 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - account_id?:string; + account_id:string; /** * @description Referral campaign id */ - campaign_id?:string; + campaign_id:string; /** * @description Referral external campaign id @@ -2897,7 +3094,7 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - post_purchase_widget_enabled?:boolean; + post_purchase_widget_enabled:boolean; } export interface ContractTerm { /** @@ -2905,7 +3102,7 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - id?:string; + id:string; /** * @description Current status of contract \* terminated - The contract term was terminated ahead of completion. \* completed - The contract term has run its full duration. \* active - An actively running contract term. \* cancelled - The contract term was ended because: @@ -2915,28 +3112,28 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - status?:'active' | 'cancelled' | 'completed' | 'terminated'; + status:'active' | 'cancelled' | 'completed' | 'terminated'; /** * @description The start date of the contract term */ - contract_start?:number; + contract_start:number; /** * @description The end date of the contract term */ - contract_end?:number; + contract_end:number; /** * @description The number of billing cycles of the subscription that the contract term is for. */ - billing_cycle?:number; + billing_cycle:number; /** * @description Action to be taken when the contract term completes. \* renew_once - Used when you want to renew the contract term just once. Does the following: @@ -2949,21 +3146,21 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - action_at_term_end?:'cancel' | 'renew_once' | 'renew' | 'evergreen'; + action_at_term_end:'cancel' | 'renew_once' | 'renew' | 'evergreen'; /** * @description The sum of the [totals](invoices#invoice_total) of all the invoices raised as part of the contract term. For `active` contract terms, this is a predicted value. The value depends on the [type of currency](./#handling_currency_units). If the subscription was [imported](#import_a_subscription) with the contract term, then this value includes the value passed for `total_amount_raised`. */ - total_contract_value?:number; + total_contract_value:number; /** * @description It refers to the total amount of revenue that is expected to be generated from a specific contract term, calculated as the sum of all invoices raised during the term, regardless of payment status. It is based on past performance and the specified currency in the contract. If the subscription was imported, the value for `total_amount_raised_before_tax` is included in the calculation of the total contract value before tax. It's important to note that this value excludes any applicable taxes. */ - total_contract_value_before_tax?:number; + total_contract_value_before_tax:number; /** * @description The number of days before [`contract_end`](contract_terms#contract_term_contract_end), during which the customer is barred from canceling the contract term. The customer is allowed to cancel the contract term via the Self-Serve Portal only before this period. This allows you to have sufficient time for processing the contract term closure @@ -2977,14 +3174,14 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 */ - created_at?:number; + created_at:number; /** * @description The [Id](subscriptions#subscription_id) of the subscription that this contract term is for. */ - subscription_id?:string; + subscription_id:string; /** * @description The number of subscription billing cycles remaining after the current one for the contract term. This attribute is only returned for `active` contract terms. @@ -2994,39 +3191,129 @@ If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 remaining_billing_cycles?:number; } export interface Discount { - id?:string; + /** + * @description An immutable unique id for the discount. It is always auto-generated. + + */ + + id:string; + + /** + * @description The name of the discount as it should appear on customer-facing pages and documents such as [invoices](/docs/api/invoices?prod_cat_ver=2) and [hosted pages](/docs/api/hosted_pages?prod_cat_ver=2). This is auto-generated based on the `type`, `amount`, and `currency_code` of the discount. For example, it can be `10% off` or `10$ off`. + + */ invoice_name?:string; - type?:'fixed_amount' | 'percentage'; + /** + * @description The type of discount. Possible value are: \* percentage - The specified percentage will be given as discount. \* fixed_amount - The specified amount will be given as discount. + + */ + + type:'fixed_amount' | 'percentage'; + + /** + * @description The percentage of the original amount that should be deducted from it. Only applicable when `discount.type` is percentage. + + */ percentage?:number; + /** + * @description The value of the discount. [The format of this value](https://apidocs.chargebee.com/docs/api?prod_cat_ver=2#currencies) depends on the kind of currency. This is only applicable when `discount.type` is `fixed_amount`. + + */ + amount?:number; + /** + * @description The currency code ([ISO 4217 format](https://www.chargebee.com/docs/supported-currencies.html)) of the discount. This is only applicable when `discount.type` is `fixed_amount`. + + */ + currency_code?:string; - duration_type?:'limited_period' | 'one_time' | 'forever'; + /** + * @description Specifies the time duration for which this discount is attached to the subscription. \* limited_period - The discount is attached to the subscription and applied on the invoices for a limited duration. This duration starts from the point it is applied to an invoice for the first time and expires after a period specified by `period` and `period_unit`. \* forever - The discount is attached to the subscription and applied on the invoices till it is [explicitly removed](/docs/api/subscriptions?prod_cat_ver=2#update_subscription_for_items_discounts_operation_type). \* one_time - The discount stays attached to the subscription till it is applied on an invoice **once**. It is removed after that from the subscription. + + */ + + duration_type:'limited_period' | 'one_time' | 'forever'; + + /** + * @description The duration of time for which the discount is attached to the subscription, in `period_units`. Applicable only when `duration_type` is `limited_period`. + + */ period?:number; + /** + * @description The unit of time for `period`. Applicable only when `duration_type` is `limited_period`. \* week - A period of 7 days. \* year - A period of 1 calendar year. \* day - A period of 24 hours. \* month - A period of 1 calendar month. + + */ + period_unit?:'week' | 'month' | 'year' | 'day'; - included_in_mrr?:boolean; + /** + * @description The discount is included in MRR calculations for your site. This attribute is only applicable when `duration_type` is `one_time` and when the [feature is enabled](https://www.chargebee.com/docs/reporting.html#dashboards_flexible-mrr-calculation) in Chargebee. Also, If the [site-level setting](https://www.chargebee.com/docs/reporting.html#chart_flexible-mrr-calculation) is to exclude one-time discounts from MRR calculations, this value is always returned `false`. + + */ + + included_in_mrr:boolean; - apply_on?:'specific_item_price' | 'invoice_amount'; + /** + * @description The amount on the invoice to which the discount is applied. \* invoice_amount - The discount is applied to the invoice `sub_total`. \* specific_item_price - The discount is applied to the `invoice.line_item.amount` that corresponds to the item price specified by `item_price_id`. + + */ + + apply_on:'specific_item_price' | 'invoice_amount'; + + /** + * @description The [id of the item price](/docs/api/subscriptions?prod_cat_ver=2#subscription_subscription_items_item_price_id) in the subscription to which the discount is to be applied. Relevant only when `apply_on` = `specific_item_price`. + + */ item_price_id?:string; - created_at?:number; + /** + * @description Timestamp indicating when this discount is created. + + */ + + created_at:number; + + /** + * @description Specifies till when the limited period discount is applicable. This attribute will be sent in the response only for `limited_period` duration type discount. + + */ apply_till?:number; + /** + * @description Specifies the number of times the discount has been applied. + + */ + applied_count?:number; - coupon_id?:string; + /** + * @description Used to uniquely identify the coupon in your website/application and to integrate with Chargebee. +**Note:** + + +When the coupon ID contains a special character; for example: `#`, the API returns an error. +Make sure that you [encode](https://www.urlencoder.org/) the coupon ID in the path parameter before making an API call. + + */ + + coupon_id:string; + + /** + * @description The index number of the subscription to which the item price is added. Provide a unique number between `0` and `4` (inclusive) for each subscription that is to be created. + + */ - index?:number; + index:number; } } } \ No newline at end of file diff --git a/types/resources/SubscriptionEntitlement.d.ts b/types/resources/SubscriptionEntitlement.d.ts index 04f1e85..363419a 100644 --- a/types/resources/SubscriptionEntitlement.d.ts +++ b/types/resources/SubscriptionEntitlement.d.ts @@ -78,8 +78,6 @@ declare module 'chargebee' { } export namespace SubscriptionEntitlement { export class SubscriptionEntitlementResource { - set_subscription_entitlement_availability(subscription_id:string, input:SetSubscriptionEntitlementAvailabilityInputParam):ChargebeeRequest; - /** * @description Retrieves the list of `subscription_entitlements` for the [subscription](/docs/api/subscriptions). **Note:** @@ -89,15 +87,13 @@ The `components` attribute is not returned for any of the `subscr */ subscription_entitlements_for_subscription(subscription_id:string, input?:SubscriptionEntitlementsForSubscriptionInputParam):ChargebeeRequest; - } - export interface SetSubscriptionEntitlementAvailabilityResponse { - subscription_entitlement:SubscriptionEntitlement; - } - export interface SetSubscriptionEntitlementAvailabilityInputParam { - is_enabled:boolean; - - subscription_entitlements?:{feature_id:string}[]; + /** + * @description Enables or disables specific `subscription_entitlements` for a subscription. + + */ + + set_subscription_entitlement_availability(subscription_id:string, input:SetSubscriptionEntitlementAvailabilityInputParam):ChargebeeRequest; } export interface SubscriptionEntitlementsForSubscriptionResponse { /** @@ -123,19 +119,44 @@ The `components` attribute is not returned for any of the `subscr export interface SubscriptionEntitlementsForSubscriptionInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description Retrieves the list of `subscription_entitlements` for the [subscription](/docs/api/subscriptions). +**Note:** + +The `components` attribute is not returned for any of the `subscription_entitlements`. Use the retrieve operation(coming soon) to obtain the `components`. */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Retrieves the list of `subscription_entitlements` for the [subscription](/docs/api/subscriptions). +**Note:** + +The `components` attribute is not returned for any of the `subscription_entitlements`. Use the retrieve operation(coming soon) to obtain the `components`. */ offset?:string; } + export interface SetSubscriptionEntitlementAvailabilityResponse { + subscription_entitlement:SubscriptionEntitlement; + } + export interface SetSubscriptionEntitlementAvailabilityInputParam { + + /** + * @description Specifies whether the `subscription_entitlements` are to be enabled or disabled. + + */ + + is_enabled:boolean; + + /** + * @description Parameters for subscription_entitlements + + */ + + subscription_entitlements?:{feature_id:string}[]; + } export interface Component { /** * @description When a subscription entitlement has been explicitly overridden, this object contains the details of said override. An `entitlement_override` can be [temporary](/docs/api/entitlement_overrides#entitlement_override_expires_at) such that it expires at some point in time and is no longer returned. diff --git a/types/resources/ThirdPartyPaymentMethod.d.ts b/types/resources/ThirdPartyPaymentMethod.d.ts index 45a79a8..3e7e52d 100644 --- a/types/resources/ThirdPartyPaymentMethod.d.ts +++ b/types/resources/ThirdPartyPaymentMethod.d.ts @@ -10,7 +10,7 @@ declare module 'chargebee' { type:Type; /** - * @description Name of the gateway this card is stored with. \* bluesnap - BlueSnap is a payment gateway. \* tco - 2Checkout is a payment gateway. \* first_data_global - First Data Global Gateway Virtual Terminal Account \* exact - Exact Payments is a payment gateway. \* bluepay - BluePay is a payment gateway. \* paypal_express_checkout - PayPal Express Checkout is a payment gateway. \* eway - eWAY Account is a payment gateway. \* paypal_payflow_pro - PayPal Payflow Pro is a payment gateway. \* razorpay - Razorpay is a fast growing payment service provider in India working with all leading banks and support for major local payment methods including Netbanking, UPI etc. \* global_payments - Global Payments is a payment service provider. \* amazon_payments - Amazon Payments is a payment service provider. \* not_applicable - Indicates that payment gateway is not applicable for this resource. \* checkout_com - Checkout.com is a payment gateway. \* adyen - Adyen is a payment gateway. \* braintree - Braintree is a payment gateway. \* nmi - NMI is a payment gateway. \* quickbooks - Intuit QuickBooks Payments gateway \* wepay - WePay is a payment gateway. \* worldpay - WorldPay is a payment gateway \* wirecard - WireCard Account is a payment service provider. \* chargebee_payments - Chargebee Payments gateway \* sage_pay - Sage Pay is a payment gateway. \* moneris_us - Moneris USA is a payment gateway. \* pin - Pin is a payment gateway \* authorize_net - Authorize.net is a payment gateway \* elavon - Elavon Virtual Merchant is a payment solution. \* paypal_pro - PayPal Pro Account is a payment gateway. \* orbital - Chase Paymentech(Orbital) is a payment gateway. \* paypal - PayPal Commerce is a payment gateway. \* beanstream - Bambora(formerly known as Beanstream) is a payment gateway. \* hdfc - HDFC Account is a payment gateway. \* ingenico_direct - Worldline Online Payments is a payment gateway. \* ogone - Ingenico ePayments (formerly known as Ogone) is a payment gateway. \* migs - MasterCard Internet Gateway Service payment gateway. \* stripe - Stripe is a payment gateway. \* vantiv - Vantiv is a payment gateway. \* moneris - Moneris is a payment gateway. \* chargebee - Chargebee test gateway. \* eway_rapid - eWAY Rapid is a payment gateway. \* gocardless - GoCardless is a payment service provider. \* mollie - Mollie is a payment gateway. \* paymill - PAYMILL is a payment gateway. \* balanced_payments - Balanced is a payment gateway \* cybersource - CyberSource is a payment gateway. + * @description Name of the gateway this card is stored with. \* ecentric - Ecentric provides a seamless payment processing service in South Africa specializing on omnichannel capabilities. \* bluesnap - BlueSnap is a payment gateway. \* tco - 2Checkout is a payment gateway. \* first_data_global - First Data Global Gateway Virtual Terminal Account \* exact - Exact Payments is a payment gateway. \* bluepay - BluePay is a payment gateway. \* paypal_express_checkout - PayPal Express Checkout is a payment gateway. \* eway - eWAY Account is a payment gateway. \* metrics_global - Metrics global is a leading payment service provider providing unified payment services in the US. \* paypal_payflow_pro - PayPal Payflow Pro is a payment gateway. \* razorpay - Razorpay is a fast growing payment service provider in India working with all leading banks and support for major local payment methods including Netbanking, UPI etc. \* global_payments - Global Payments is a payment service provider. \* amazon_payments - Amazon Payments is a payment service provider. \* not_applicable - Indicates that payment gateway is not applicable for this resource. \* windcave - Windcave provides an end to end payment processing solution in ANZ and other leading global markets. \* checkout_com - Checkout.com is a payment gateway. \* adyen - Adyen is a payment gateway. \* braintree - Braintree is a payment gateway. \* nmi - NMI is a payment gateway. \* quickbooks - Intuit QuickBooks Payments gateway \* wepay - WePay is a payment gateway. \* worldpay - WorldPay is a payment gateway \* wirecard - WireCard Account is a payment service provider. \* chargebee_payments - Chargebee Payments gateway \* sage_pay - Sage Pay is a payment gateway. \* moneris_us - Moneris USA is a payment gateway. \* pin - Pin is a payment gateway \* authorize_net - Authorize.net is a payment gateway \* elavon - Elavon Virtual Merchant is a payment solution. \* paypal_pro - PayPal Pro Account is a payment gateway. \* orbital - Chase Paymentech(Orbital) is a payment gateway. \* paypal - PayPal Commerce is a payment gateway. \* beanstream - Bambora(formerly known as Beanstream) is a payment gateway. \* hdfc - HDFC Account is a payment gateway. \* ingenico_direct - Worldline Online Payments is a payment gateway. \* ogone - Ingenico ePayments (formerly known as Ogone) is a payment gateway. \* migs - MasterCard Internet Gateway Service payment gateway. \* stripe - Stripe is a payment gateway. \* vantiv - Vantiv is a payment gateway. \* moneris - Moneris is a payment gateway. \* bank_of_america - Bank of America Gateway \* chargebee - Chargebee test gateway. \* eway_rapid - eWAY Rapid is a payment gateway. \* gocardless - GoCardless is a payment service provider. \* mollie - Mollie is a payment gateway. \* paymill - PAYMILL is a payment gateway. \* balanced_payments - Balanced is a payment gateway \* cybersource - CyberSource is a payment gateway. */ diff --git a/types/resources/TimeMachine.d.ts b/types/resources/TimeMachine.d.ts index 7ca1ff0..246508d 100644 --- a/types/resources/TimeMachine.d.ts +++ b/types/resources/TimeMachine.d.ts @@ -62,49 +62,49 @@ declare module 'chargebee' { retrieve(time_machine_name:string):ChargebeeRequest; /** - * @description Travel forward in time. This operation is **asynchronous** . You need to check if the "start afresh" operation has completed by checking if the time travel status is **successful** by retrieving the time machine in a loop with a minimum delay of 3 secs between two retrieve requests. Use method **waitForTimeTravelCompletion()** on the returned time_machine resource which will block until the time travel completes. + * @description Restart the time machine. This will clear the "customer" data like customer details, subscriptions, invoices, transactions. Also a time travel is initiated to travel back to specified genesis time. + +**Note:** This API call is asynchronous. You need to check if the "start afresh" operation has completed by checking if the time travel status is **successful** by retrieving the time machine in a loop with a minimum delay of 3 secs between two retrieve requests. In case you are using any of the client libraries, use the **wait for time travel completion** function provided as a instance method in the library. Use method **waitForTimeTravelCompletion()** on the returned **time_machine** resource which will block until the time travel completes. Use method **waitForTimeTravelCompletion()** on the returned **time_machine** resource which will block until the time travel completes. Use method **wait_for_time_travel_completion** on the returned **time_machine** resource which will block until the time travel completes. Use method **wait_for_time_travel_completion** on the returned **time_machine** resource which will block until the time travel completes. Use method **WaitForTimeTravelCompletion** on the returned **time_machine** resource which will block until the time travel completes. Use method **wait_for_time_travel_completion** on the returned **time_machine** resource which will block until the time travel completes. Use method **waitForTimeTravelCompletion** on the returned **time_machine** resource which will block until the time travel completes. Use method **wait_for_time_travel_completion** on the returned **time_machine** resource which will block until the time travel completes. */ - travel_forward(time_machine_name:string, input?:TravelForwardInputParam):ChargebeeRequest; + start_afresh(time_machine_name:string, input?:StartAfreshInputParam):ChargebeeRequest; /** - * @description Restart the time machine. This will clear the "customer" data like customer details, subscriptions, invoices, transactions. Also a time travel is initiated to travel back to specified genesis time. - -**Note:** This API call is asynchronous. You need to check if the "start afresh" operation has completed by checking if the time travel status is **successful** by retrieving the time machine in a loop with a minimum delay of 3 secs between two retrieve requests. In case you are using any of the client libraries, use the **wait for time travel completion** function provided as a instance method in the library. Use method **waitForTimeTravelCompletion()** on the returned **time_machine** resource which will block until the time travel completes. Use method **waitForTimeTravelCompletion()** on the returned **time_machine** resource which will block until the time travel completes. Use method **wait_for_time_travel_completion** on the returned **time_machine** resource which will block until the time travel completes. Use method **wait_for_time_travel_completion** on the returned **time_machine** resource which will block until the time travel completes. Use method **WaitForTimeTravelCompletion** on the returned **time_machine** resource which will block until the time travel completes. Use method **wait_for_time_travel_completion** on the returned **time_machine** resource which will block until the time travel completes. Use method **waitForTimeTravelCompletion** on the returned **time_machine** resource which will block until the time travel completes. Use method **wait_for_time_travel_completion** on the returned **time_machine** resource which will block until the time travel completes. + * @description Travel forward in time. This operation is **asynchronous** . You need to check if the "start afresh" operation has completed by checking if the time travel status is **successful** by retrieving the time machine in a loop with a minimum delay of 3 secs between two retrieve requests. Use method **waitForTimeTravelCompletion()** on the returned time_machine resource which will block until the time travel completes. */ - start_afresh(time_machine_name:string, input?:StartAfreshInputParam):ChargebeeRequest; + travel_forward(time_machine_name:string, input?:TravelForwardInputParam):ChargebeeRequest; } export interface RetrieveResponse { time_machine:TimeMachine; } - export interface TravelForwardResponse { + export interface StartAfreshResponse { time_machine:TimeMachine; } - export interface TravelForwardInputParam { + export interface StartAfreshInputParam { /** - * @description The **time** to travel to. Should be between the 'current' destination time of the time machine and present time. + * @description The genesis time to travel back as part of the reset operation. If not provided, then the travel is set to 6 months in the past. +**Note:** Can only be in the past. */ - destination_time?:number; + genesis_time?:number; } - export interface StartAfreshResponse { + export interface TravelForwardResponse { time_machine:TimeMachine; } - export interface StartAfreshInputParam { + export interface TravelForwardInputParam { /** - * @description The genesis time to travel back as part of the reset operation. If not provided, then the travel is set to 6 months in the past. -**Note:** Can only be in the past. + * @description The **time** to travel to. Should be between the 'current' destination time of the time machine and present time. */ - genesis_time?:number; + destination_time?:number; } } diff --git a/types/resources/Token.d.ts b/types/resources/Token.d.ts index fc9a618..b4b1df6 100644 --- a/types/resources/Token.d.ts +++ b/types/resources/Token.d.ts @@ -89,18 +89,18 @@ declare module 'chargebee' { export namespace Token { export class TokenResource { /** - * @description Generate a token using the one time token created by payment gateways for any specific payment method. + * @description Generate a token that holds card related information. */ - create_using_temp_token(input:CreateUsingTempTokenInputParam):ChargebeeRequest; + create_for_card(input?:CreateForCardInputParam):ChargebeeRequest; /** - * @description Generate a token that holds card related information. + * @description Generate a token using the one time token created by payment gateways for any specific payment method. */ - create_for_card(input?:CreateForCardInputParam):ChargebeeRequest; + create_using_temp_token(input:CreateUsingTempTokenInputParam):ChargebeeRequest; /** * @description Retrieve a token using token ID. @@ -109,6 +109,18 @@ declare module 'chargebee' { retrieve(cb_token_id:string):ChargebeeRequest; } + export interface CreateForCardResponse { + token:Token; + } + export interface CreateForCardInputParam { + + /** + * @description Parameters for card + + */ + + card?:{additional_information?:object,billing_addr1?:string,billing_addr2?:string,billing_city?:string,billing_country?:string,billing_state?:string,billing_state_code?:string,billing_zip?:string,card_type?:'discover' | 'bancontact' | 'other' | 'visa' | 'jcb' | 'diners_club' | 'mastercard' | 'not_applicable' | 'american_express',cvv?:string,expiry_month:number,expiry_year:number,first_name?:string,gateway_account_id?:string,last_name?:string,number:string}; + } export interface CreateUsingTempTokenResponse { token:Token; } @@ -150,17 +162,17 @@ declare module 'chargebee' { currency_code?:string; /** - * @description * `checkout_com`: While adding a new payment method using [permanent token](./payment_sources?#create_using_permanent_token) or passing raw card details to Checkout.com, `document` ID and `country_of_residence` are required to support payments through [dLocal](https://docs.checkout.com/payment-methods/cards/dlocal). + * @description * `checkout_com`: While adding a new payment method using [permanent token](./payment_sources?#create_using_permanent_token) or passing raw card details to Checkout.com, `document` ID and `country_of_residence` are required to support payments through [dLocal](https://www.checkout.com/docs/previous/payments/payment-methods/cards/dlocal). * `payer`: User related information. - * `country_of_residence`: This is required since the billing country associated with the user's payment method may not be the same as their country of residence. Hence the user's country of residence needs to be specified. The country code should be a [two-character ISO code](https://docs.checkout.com/resources/codes/country-codes). - * `document`: Document ID is the user's [identification number](https://docs.dlocal.com/api-documentation/payins-api-reference/country-reference#documents) based on their country. -* `bluesnap`: While passing raw card details to BlueSnap, if `fraud_session_id` is added, [additional validation](https://developers.bluesnap.com/docs/fraud-prevention) is performed to avoid fraudulent transactions. + * `country_of_residence`: This is required since the billing country associated with the user's payment method may not be the same as their country of residence. Hence the user's country of residence needs to be specified. The country code should be a [two-character ISO code](https://www.checkout.com/docs/developer-resources/testing/codes/country-codes). + * `document`: Document ID is the user's [identification number](https://docs.dlocal.com/reference/country-reference#documents) based on their country. +* `bluesnap`: While passing raw card details to BlueSnap, if `fraud_session_id` is added, [additional validation](https://developers.bluesnap.com/reference/fraud-prevention) is performed to avoid fraudulent transactions. * `fraud`: Fraud identification related information. - * `fraud_session_id`: Your [BlueSnap fraud session ID](https://developers.bluesnap.com/docs/fraud-prevention#section-implementing-device-data-collector) required to perform anti-fraud validation. -* `braintree`: While passing raw card details to Braintree, your `fraud_merchant_id` and the user's `device_session_id` can be added to perform [additional validation](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) and avoid fraudulent transactions. + * `fraud_session_id`: Your [BlueSnap fraud session ID](https://developers.bluesnap.com/reference/fraud-prevention#section-implementing-device-data-collector) required to perform anti-fraud validation. +* `braintree`: While passing raw card details to Braintree, your `fraud_merchant_id` and the user's `device_session_id` can be added to perform [additional validation](https://developer.paypal.com/braintree/docs/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) and avoid fraudulent transactions. * `fraud`: Fraud identification related information. * `device_session_id`: Session ID associated with the user's device. - * `fraud_merchant_id`: Your [merchant ID](https://developers.braintreepayments.com/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) for fraud detection. + * `fraud_merchant_id`: Your [merchant ID](https://developer.paypal.com/braintree/docs/guides/premium-fraud-management-tools/device-data-collection/javascript/v3#collecting-device-data) for fraud detection. * `chargebee_payments`: While passing raw card details to Chargebee Payments, if `fraud_session_id` is added, additional validation is performed to avoid fraudulent transactions. * `fraud`: Fraud identification related information. * `fraud_session_id`: Your Chargebee Payments fraud session ID required to perform anti-fraud validation. @@ -184,18 +196,6 @@ declare module 'chargebee' { token_billing_address?:{city?:string,country_code?:string,line1?:string,line2?:string,state?:string,state_code?:string,zip?:string}; } - export interface CreateForCardResponse { - token:Token; - } - export interface CreateForCardInputParam { - - /** - * @description Parameters for card - - */ - - card?:{additional_information?:object,billing_addr1?:string,billing_addr2?:string,billing_city?:string,billing_country?:string,billing_state?:string,billing_state_code?:string,billing_zip?:string,card_type?:'discover' | 'bancontact' | 'other' | 'visa' | 'jcb' | 'diners_club' | 'mastercard' | 'not_applicable' | 'american_express',cvv?:string,expiry_month:number,expiry_year:number,first_name?:string,gateway_account_id?:string,last_name?:string,number:string}; - } export interface RetrieveResponse { token:Token; } diff --git a/types/resources/Transaction.d.ts b/types/resources/Transaction.d.ts index 90d88bc..843ebe0 100644 --- a/types/resources/Transaction.d.ts +++ b/types/resources/Transaction.d.ts @@ -38,7 +38,7 @@ declare module 'chargebee' { payment_source_id?:string; /** - * @description The payment method of this transaction \* unionpay - Unionpay \* bank_transfer - Bank Transfer \* paypal_express_checkout - Paypal Express Checkout \* other - Payment Methods other than the above types \* upi - upi \* ach_credit - ACH Credit \* sepa_credit - SEPA Credit \* check - Check \* card - Card \* amazon_payments - Amazon Payments \* ideal - IDEAL \* chargeback - Only applicable for a transaction of [type](transactions#transaction_type) = `refund`. This value is set by Chargebee when an automated [chargeback](https://www.chargebee.com/docs/chargeback.html#chargeback-process) occurs. You can also set this explicitly when [recording a refund](transactions#record_an_offline_refund). \* google_pay - Google Pay \* netbanking_emandates - netbanking_emandates \* direct_debit - Direct Debit \* dotpay - Dotpay \* alipay - Alipay \* sofort - Sofort \* apple_pay - Apple Pay \* giropay - giropay \* wechat_pay - WeChat Pay \* cash - Cash \* bancontact - Bancontact + * @description The payment method of this transaction \* unionpay - Unionpay \* upi - upi \* check - Check \* custom - Custom \* amazon_payments - Amazon Payments \* boleto - boleto \* direct_debit - Direct Debit \* apple_pay - Apple Pay \* wechat_pay - WeChat Pay \* bancontact - Bancontact \* bank_transfer - Bank Transfer \* paypal_express_checkout - Paypal Express Checkout \* other - Payment Methods other than the above types \* ach_credit - ACH Credit \* sepa_credit - SEPA Credit \* card - Card \* ideal - IDEAL \* chargeback - Only applicable for a transaction of [type](transactions#transaction_type) = `refund`. This value is set by Chargebee when an automated [chargeback](https://www.chargebee.com/docs/chargeback.html#chargeback-process) occurs. You can also set this explicitly when [recording a refund](transactions#record_an_offline_refund). \* google_pay - Google Pay \* netbanking_emandates - netbanking_emandates \* dotpay - Dotpay \* alipay - Alipay \* sofort - Sofort \* giropay - giropay \* cash - Cash */ @@ -52,14 +52,14 @@ declare module 'chargebee' { reference_number?:string; /** - * @description Gateway through which this transaction was done. Applicable only for 'Card' Payment Method \* bluesnap - BlueSnap is a payment gateway. \* tco - 2Checkout is a payment gateway. \* bluepay - BluePay is a payment gateway. \* paypal_express_checkout - PayPal Express Checkout is a payment gateway. \* paypal_payflow_pro - PayPal Payflow Pro is a payment gateway. \* razorpay - Razorpay is a fast growing payment service provider in India working with all leading banks and support for major local payment methods including Netbanking, UPI etc. \* global_payments - Global Payments is a payment service provider. \* not_applicable - Indicates that payment gateway is not applicable for this resource. \* checkout_com - Checkout.com is a payment gateway. \* adyen - Adyen is a payment gateway. \* braintree - Braintree is a payment gateway. \* nmi - NMI is a payment gateway. \* worldpay - WorldPay is a payment gateway \* moneris_us - Moneris USA is a payment gateway. \* pin - Pin is a payment gateway \* authorize_net - Authorize.net is a payment gateway \* stripe - Stripe is a payment gateway. \* moneris - Moneris is a payment gateway. \* chargebee - Chargebee test gateway. \* cybersource - CyberSource is a payment gateway. \* first_data_global - First Data Global Gateway Virtual Terminal Account \* exact - Exact Payments is a payment gateway. \* eway - eWAY Account is a payment gateway. \* amazon_payments - Amazon Payments is a payment service provider. \* quickbooks - Intuit QuickBooks Payments gateway \* wepay - WePay is a payment gateway. \* wirecard - WireCard Account is a payment service provider. \* chargebee_payments - Chargebee Payments gateway \* sage_pay - Sage Pay is a payment gateway. \* elavon - Elavon Virtual Merchant is a payment solution. \* paypal_pro - PayPal Pro Account is a payment gateway. \* orbital - Chase Paymentech(Orbital) is a payment gateway. \* paypal - PayPal Commerce is a payment gateway. \* beanstream - Bambora(formerly known as Beanstream) is a payment gateway. \* hdfc - HDFC Account is a payment gateway. \* ingenico_direct - Worldline Online Payments is a payment gateway. \* ogone - Ingenico ePayments (formerly known as Ogone) is a payment gateway. \* migs - MasterCard Internet Gateway Service payment gateway. \* vantiv - Vantiv is a payment gateway. \* eway_rapid - eWAY Rapid is a payment gateway. \* gocardless - GoCardless is a payment service provider. \* mollie - Mollie is a payment gateway. \* paymill - PAYMILL is a payment gateway. \* balanced_payments - Balanced is a payment gateway + * @description Gateway through which this transaction was done. Applicable only for 'Card' Payment Method \* bluesnap - BlueSnap is a payment gateway. \* tco - 2Checkout is a payment gateway. \* razorpay - Razorpay is a fast growing payment service provider in India working with all leading banks and support for major local payment methods including Netbanking, UPI etc. \* checkout_com - Checkout.com is a payment gateway. \* adyen - Adyen is a payment gateway. \* braintree - Braintree is a payment gateway. \* moneris_us - Moneris USA is a payment gateway. \* pin - Pin is a payment gateway \* moneris - Moneris is a payment gateway. \* chargebee - Chargebee test gateway. \* cybersource - CyberSource is a payment gateway. \* ecentric - Ecentric provides a seamless payment processing service in South Africa specializing on omnichannel capabilities. \* first_data_global - First Data Global Gateway Virtual Terminal Account \* exact - Exact Payments is a payment gateway. \* eway - eWAY Account is a payment gateway. \* amazon_payments - Amazon Payments is a payment service provider. \* sage_pay - Sage Pay is a payment gateway. \* elavon - Elavon Virtual Merchant is a payment solution. \* orbital - Chase Paymentech(Orbital) is a payment gateway. \* beanstream - Bambora(formerly known as Beanstream) is a payment gateway. \* hdfc - HDFC Account is a payment gateway. \* bank_of_america - Bank of America Gateway \* gocardless - GoCardless is a payment service provider. \* paymill - PAYMILL is a payment gateway. \* balanced_payments - Balanced is a payment gateway \* bluepay - BluePay is a payment gateway. \* paypal_express_checkout - PayPal Express Checkout is a payment gateway. \* paypal_payflow_pro - PayPal Payflow Pro is a payment gateway. \* global_payments - Global Payments is a payment service provider. \* not_applicable - Indicates that payment gateway is not applicable for this resource. \* nmi - NMI is a payment gateway. \* worldpay - WorldPay is a payment gateway \* authorize_net - Authorize.net is a payment gateway \* stripe - Stripe is a payment gateway. \* metrics_global - Metrics global is a leading payment service provider providing unified payment services in the US. \* windcave - Windcave provides an end to end payment processing solution in ANZ and other leading global markets. \* quickbooks - Intuit QuickBooks Payments gateway \* wepay - WePay is a payment gateway. \* wirecard - WireCard Account is a payment service provider. \* chargebee_payments - Chargebee Payments gateway \* paypal_pro - PayPal Pro Account is a payment gateway. \* paypal - PayPal Commerce is a payment gateway. \* ingenico_direct - Worldline Online Payments is a payment gateway. \* ogone - Ingenico ePayments (formerly known as Ogone) is a payment gateway. \* migs - MasterCard Internet Gateway Service payment gateway. \* vantiv - Vantiv is a payment gateway. \* eway_rapid - eWAY Rapid is a payment gateway. \* mollie - Mollie is a payment gateway. */ gateway:Gateway; /** - * @description Type of the transaction. \* refund - The transaction represents a refund of [amount](transactions#transaction_amount) to the customer's [payment_source](payment_sources). \* authorization - The transaction represents an authorization for capturing the [amount](transactions#transaction_amount) from the customer's [payment_source](payment_sources). \* payment_reversal - Indicates a reversal transaction. \* payment - The transaction represents capture of [amount](transactions#transaction_amount) from the customer's [payment_source](payment_sources). + * @description Type of the transaction. \* authorization - The transaction represents an authorization for capturing the [amount](transactions#transaction_amount) from the customer's [payment_source](payment_sources). \* payment - The transaction represents capture of [amount](transactions#transaction_amount) from the customer's [payment_source](payment_sources). \* refund - The transaction represents a refund of [amount](transactions#transaction_amount) to the customer's [payment_source](payment_sources). \* payment_reversal - Indicates a reversal transaction. */ @@ -108,21 +108,21 @@ declare module 'chargebee' { id_at_gateway?:string; /** - * @description The status of this transaction. \* in_progress - Transaction is being processed by the gateway. This typically happens for [direct debit transactions](https://www.chargebee.com/docs/direct-debit-payments.html) or, in case of cards, refund transactions. Such transactions can take 2-7 days to complete, depending on the gateway and payment method. \* timeout - Transaction failed because of Gateway not accepting the connection. \* failure - Transaction failed. Refer the 'error_code' and 'error_text' fields to know the reason for failure \* success - The transaction is successful. \* voided - The transaction got voided or authorization expired at gateway. \* needs_attention - Connection with Gateway got terminated abruptly. So, status of this transaction needs to be resolved manually + * @description The status of this transaction. \* in_progress - Transaction is being processed by the gateway. This typically happens for [direct debit transactions](https://www.chargebee.com/docs/direct-debit-payments.html) or, in case of cards, refund transactions. Such transactions can take 2-7 days to complete, depending on the gateway and payment method. \* timeout - Transaction failed because of Gateway not accepting the connection. \* success - The transaction is successful. \* voided - The transaction got voided or authorization expired at gateway. \* needs_attention - Connection with Gateway got terminated abruptly. So, status of this transaction needs to be resolved manually \* failure - Transaction failed. Refer the 'error_code' and 'error_text' fields to know the reason for failure */ status?:'in_progress' | 'success' | 'failure' | 'voided' | 'timeout' | 'needs_attention'; /** - * @description Indicates whether or not the transaction has been identified as fraudulent. \* fraudulent - The transaction has been marked as fraudulent \* suspicious - The transaction has been identified as potentially fraudulent by the gateway \* safe - The transaction has been marked as safe + * @description Indicates whether or not the transaction has been identified as fraudulent. \* suspicious - The transaction has been identified as potentially fraudulent by the gateway \* safe - The transaction has been marked as safe \* fraudulent - The transaction has been marked as fraudulent */ fraud_flag?:'safe' | 'suspicious' | 'fraudulent'; /** - * @description Marker for on-session payments (3DS). null indicates 'merchant'. \* customer - Customer initiated 3DS payment \* merchant - Payment initiated on stored payment method by the merchant + * @description Marker for on-session payments (3DS). null indicates 'merchant'. \* merchant - Payment initiated on stored payment method by the merchant \* customer - Customer initiated 3DS payment */ @@ -306,39 +306,39 @@ declare module 'chargebee' { export namespace Transaction { export class TransactionResource { /** - * @description Records a refund made offline. Applicable only for `transaction`s of [type](transactions#transaction_type) = `payment`. + * @description Authorizes a specific amount in customer's Credit card, which can be collected within a span of time. Read more on authorization and capture [here](https://www.chargebee.com/docs/stripe.html#auth-and-capture). */ - record_refund(transaction_id:string, input:RecordRefundInputParam):ChargebeeRequest; + create_authorization(input:CreateAuthorizationInputParam):ChargebeeRequest; /** - * @description Lists all the transactions. + * @description This API voids the specific authorization transaction in order to release the blocked funds from the customer's card. Voiding an already captured or voided transaction is not possible. */ - list(input?:ListInputParam):ChargebeeRequest; + void_transaction(transaction_id:string):ChargebeeRequest; /** - * @description This API voids the specific authorization transaction in order to release the blocked funds from the customer's card. Voiding an already captured or voided transaction is not possible. + * @description Records a refund made offline. Applicable only for `transaction`s of [type](transactions#transaction_type) = `payment`. */ - void_transaction(transaction_id:string):ChargebeeRequest; + record_refund(transaction_id:string, input:RecordRefundInputParam):ChargebeeRequest; /** - * @description Authorizes a specific amount in customer's Credit card, which can be collected within a span of time. Read more on authorization and capture [here](https://www.chargebee.com/docs/stripe.html#auth-and-capture). + * @description Refunds an online payment. Applicable only for `transaction`s of [type](transactions#transaction_type) = `payment`. You can only refund a `transaction` whose [status](transactions#transaction_status)` ` is `success`. */ - create_authorization(input:CreateAuthorizationInputParam):ChargebeeRequest; + refund(transaction_id:string, input?:RefundInputParam):ChargebeeRequest; /** - * @description Retrieve a transaction identified by its unique id. + * @description Lists all the transactions. */ - retrieve(transaction_id:string):ChargebeeRequest; + list(input?:ListInputParam):ChargebeeRequest; /** * @description Retrieves the payments for an invoice with the recent ones on top. This returns all the payment attempts(manual \& automatic) made for this invoice. @@ -347,20 +347,57 @@ declare module 'chargebee' { payments_for_invoice(invoice_id:string, input?:PaymentsForInvoiceInputParam):ChargebeeRequest; + /** + * @description Retrieve a transaction identified by its unique id. + + */ + + retrieve(transaction_id:string):ChargebeeRequest; + /** * @description This API deletes an offline transaction. However, to delete an offline transaction all payment allocations associated with the transaction must be removed. */ delete_offline_transaction(transaction_id:string, input?:DeleteOfflineTransactionInputParam):ChargebeeRequest; + } + export interface CreateAuthorizationResponse { + transaction:Transaction; + } + export interface CreateAuthorizationInputParam { /** - * @description Refunds an online payment. Applicable only for `transaction`s of [type](transactions#transaction_type) = `payment`. You can only refund a `transaction` whose [status](transactions#transaction_status)` ` is `success`. + * @description Identifier of the customer. */ - - refund(transaction_id:string, input?:RefundInputParam):ChargebeeRequest; + + customer_id:string; + + /** + * @description Payment source to be used for authorizing the transaction. + + */ + + payment_source_id?:string; + + /** + * @description The currency code (ISO 4217 format) of the transaction amount. + + */ + + currency_code?:string; + + /** + * @description The amount to be blocked. + + */ + + amount:number; + } + export interface VoidTransactionResponse { + transaction:Transaction; } + export interface RecordRefundResponse { transaction:Transaction; } @@ -374,7 +411,7 @@ declare module 'chargebee' { amount?:number; /** - * @description The payment method used to make the refund. \* card - Card \* alipay - Alipay \* sofort - Sofort \* play_store - Play Store \* upi - upi \* ach_credit - ACH Credit \* amazon_payments - Amazon Payments \* apple_pay - Apple Pay \* ideal - IDEAL \* giropay - giropay \* chargeback - Only applicable for a transaction of [type](transactions#transaction_type) = `refund`. This value is set by Chargebee when an automated [chargeback](https://www.chargebee.com/docs/chargeback.html#chargeback-process) occurs. You can also set this explicitly when [recording a refund](transactions#record_an_offline_refund). \* wechat_pay - WeChat Pay \* sepa_credit - SEPA Credit \* google_pay - Google Pay \* cash - Cash \* netbanking_emandates - netbanking_emandates \* unionpay - Unionpay \* bancontact - Bancontact \* bank_transfer - Bank Transfer \* paypal_express_checkout - Paypal Express Checkout \* app_store - App Store \* check - Check \* direct_debit - Direct Debit \* dotpay - Dotpay \* other - Payment Methods other than the above types + * @description The payment method used to make the refund. \* card - Card \* alipay - Alipay \* sofort - Sofort \* play_store - Play Store \* custom - Custom \* upi - upi \* ach_credit - ACH Credit \* amazon_payments - Amazon Payments \* apple_pay - Apple Pay \* ideal - IDEAL \* giropay - giropay \* boleto - boleto \* chargeback - Only applicable for a transaction of [type](transactions#transaction_type) = `refund`. This value is set by Chargebee when an automated [chargeback](https://www.chargebee.com/docs/chargeback.html#chargeback-process) occurs. You can also set this explicitly when [recording a refund](transactions#record_an_offline_refund). \* wechat_pay - WeChat Pay \* sepa_credit - SEPA Credit \* google_pay - Google Pay \* cash - Cash \* netbanking_emandates - netbanking_emandates \* unionpay - Unionpay \* bancontact - Bancontact \* bank_transfer - Bank Transfer \* paypal_express_checkout - Paypal Express Checkout \* app_store - App Store \* check - Check \* direct_debit - Direct Debit \* dotpay - Dotpay \* other - Payment Methods other than the above types */ @@ -401,6 +438,25 @@ declare module 'chargebee' { comment?:string; } + export interface RefundResponse { + transaction:Transaction; + } + export interface RefundInputParam { + + /** + * @description The amount to be refunded. Must not exceed [amount_unused](transactions#transaction_amount_unused). If not passed then all of [amount_unused](transactions#transaction_amount_unused) is refunded. + + */ + + amount?:number; + + /** + * @description Remarks, if any, on the refund. + + */ + + comment?:string; + } export interface ListResponse { /** * @description Lists all the transactions. @@ -419,126 +475,126 @@ declare module 'chargebee' { export interface ListInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description Lists all the transactions. */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Lists all the transactions. */ offset?:string; /** - * @description Indicates whether to include deleted objects in the list. The deleted objects have the attribute \`deleted\` as \`true\`. + * @description Lists all the transactions. */ include_deleted?:boolean; /** - * @description Uniquely identifies the transaction. + * @description Lists all the transactions. */ id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description Identifier of the customer for which this transaction is made + * @description Lists all the transactions. */ customer_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string}; /** - * @description Identifier of the subscription for which this transaction is made. + * @description Lists all the transactions. */ subscription_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string}; /** - * @description To filter based on Transaction payment source id. + * @description Lists all the transactions. */ payment_source_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string}; /** - * @description The payment method of this transaction + * @description Lists all the transactions. */ - payment_method?:{in?:string,is?:'other' | 'netbanking_emandates' | 'ach_credit' | 'dotpay' | 'boleto' | 'direct_debit' | 'chargeback' | 'wechat_pay' | 'cash' | 'giropay' | 'bank_transfer' | 'alipay' | 'ideal' | 'google_pay' | 'custom' | 'unionpay' | 'check' | 'sofort' | 'amazon_payments' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'sepa_credit' | 'card',is_not?:'other' | 'netbanking_emandates' | 'ach_credit' | 'dotpay' | 'boleto' | 'direct_debit' | 'chargeback' | 'wechat_pay' | 'cash' | 'giropay' | 'bank_transfer' | 'alipay' | 'ideal' | 'google_pay' | 'custom' | 'unionpay' | 'check' | 'sofort' | 'amazon_payments' | 'upi' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'sepa_credit' | 'card',not_in?:string}; + payment_method?:{in?:string,is?:'other' | 'netbanking_emandates' | 'ach_credit' | 'dotpay' | 'boleto' | 'direct_debit' | 'chargeback' | 'wechat_pay' | 'pay_to' | 'cash' | 'giropay' | 'bank_transfer' | 'alipay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'custom' | 'unionpay' | 'check' | 'faster_payments' | 'sofort' | 'amazon_payments' | 'upi' | 'venmo' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'sepa_credit' | 'card',is_not?:'other' | 'netbanking_emandates' | 'ach_credit' | 'dotpay' | 'boleto' | 'direct_debit' | 'chargeback' | 'wechat_pay' | 'pay_to' | 'cash' | 'giropay' | 'bank_transfer' | 'alipay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'custom' | 'unionpay' | 'check' | 'faster_payments' | 'sofort' | 'amazon_payments' | 'upi' | 'venmo' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'sepa_credit' | 'card',not_in?:string}; /** - * @description Gateway through which this transaction was done. Applicable only for 'Card' Payment Method + * @description Lists all the transactions. */ - gateway?:{in?:string,is?:'bluepay' | 'beanstream' | 'elavon' | 'orbital' | 'hdfc' | 'nmi' | 'moneris' | 'metrics_global' | 'pin' | 'stripe' | 'quickbooks' | 'razorpay' | 'eway_rapid' | 'balanced_payments' | 'ecentric' | 'wepay' | 'chargebee_payments' | 'bank_of_america' | 'braintree' | 'first_data_global' | 'paypal_express_checkout' | 'ingenico_direct' | 'moneris_us' | 'exact' | 'migs' | 'checkout_com' | 'not_applicable' | 'paypal_pro' | 'ogone' | 'eway' | 'gocardless' | 'global_payments' | 'paymill' | 'adyen' | 'paypal' | 'chargebee' | 'authorize_net' | 'tco' | 'bluesnap' | 'windcave' | 'paypal_payflow_pro' | 'amazon_payments' | 'mollie' | 'cybersource' | 'wirecard' | 'sage_pay' | 'vantiv' | 'worldpay',is_not?:'bluepay' | 'beanstream' | 'elavon' | 'orbital' | 'hdfc' | 'nmi' | 'moneris' | 'metrics_global' | 'pin' | 'stripe' | 'quickbooks' | 'razorpay' | 'eway_rapid' | 'balanced_payments' | 'ecentric' | 'wepay' | 'chargebee_payments' | 'bank_of_america' | 'braintree' | 'first_data_global' | 'paypal_express_checkout' | 'ingenico_direct' | 'moneris_us' | 'exact' | 'migs' | 'checkout_com' | 'not_applicable' | 'paypal_pro' | 'ogone' | 'eway' | 'gocardless' | 'global_payments' | 'paymill' | 'adyen' | 'paypal' | 'chargebee' | 'authorize_net' | 'tco' | 'bluesnap' | 'windcave' | 'paypal_payflow_pro' | 'amazon_payments' | 'mollie' | 'cybersource' | 'wirecard' | 'sage_pay' | 'vantiv' | 'worldpay',not_in?:string}; + gateway?:{in?:string,is?:'bluepay' | 'beanstream' | 'elavon' | 'orbital' | 'hdfc' | 'nmi' | 'moneris' | 'metrics_global' | 'ebanx' | 'pin' | 'stripe' | 'quickbooks' | 'razorpay' | 'eway_rapid' | 'balanced_payments' | 'ecentric' | 'wepay' | 'chargebee_payments' | 'bank_of_america' | 'braintree' | 'first_data_global' | 'paypal_express_checkout' | 'ingenico_direct' | 'moneris_us' | 'exact' | 'migs' | 'checkout_com' | 'not_applicable' | 'paypal_pro' | 'ogone' | 'eway' | 'gocardless' | 'global_payments' | 'paymill' | 'adyen' | 'paypal' | 'chargebee' | 'authorize_net' | 'tco' | 'bluesnap' | 'windcave' | 'paypal_payflow_pro' | 'amazon_payments' | 'mollie' | 'cybersource' | 'wirecard' | 'sage_pay' | 'vantiv' | 'worldpay' | 'pay_com',is_not?:'bluepay' | 'beanstream' | 'elavon' | 'orbital' | 'hdfc' | 'nmi' | 'moneris' | 'metrics_global' | 'ebanx' | 'pin' | 'stripe' | 'quickbooks' | 'razorpay' | 'eway_rapid' | 'balanced_payments' | 'ecentric' | 'wepay' | 'chargebee_payments' | 'bank_of_america' | 'braintree' | 'first_data_global' | 'paypal_express_checkout' | 'ingenico_direct' | 'moneris_us' | 'exact' | 'migs' | 'checkout_com' | 'not_applicable' | 'paypal_pro' | 'ogone' | 'eway' | 'gocardless' | 'global_payments' | 'paymill' | 'adyen' | 'paypal' | 'chargebee' | 'authorize_net' | 'tco' | 'bluesnap' | 'windcave' | 'paypal_payflow_pro' | 'amazon_payments' | 'mollie' | 'cybersource' | 'wirecard' | 'sage_pay' | 'vantiv' | 'worldpay' | 'pay_com',not_in?:string}; /** - * @description The gateway account used for this transaction + * @description Lists all the transactions. */ gateway_account_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description The id with which this transaction is referred in gateway. + * @description Lists all the transactions. */ id_at_gateway?:{is?:string,is_not?:string,starts_with?:string}; /** - * @description The reference number for this transaction. For example, the check number when [payment_method](transactions#transaction_payment_method) = `check`. + * @description Lists all the transactions. */ reference_number?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string}; /** - * @description Type of the transaction. + * @description Lists all the transactions. */ type?:{in?:string,is?:'authorization' | 'payment_reversal' | 'payment' | 'refund',is_not?:'authorization' | 'payment_reversal' | 'payment' | 'refund',not_in?:string}; /** - * @description Indicates when this transaction occurred. + * @description Lists all the transactions. */ date?:{after?:string,before?:string,between?:string,on?:string}; /** - * @description Amount for this transaction. + * @description Lists all the transactions. */ amount?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; /** - * @description To filter based on transaction's unused authorized/blocked amount. + * @description Lists all the transactions. */ amount_capturable?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,lt?:string,lte?:string}; /** - * @description The status of this transaction. + * @description Lists all the transactions. */ status?:{in?:string,is?:'in_progress' | 'success' | 'failure' | 'voided' | 'timeout' | 'needs_attention',is_not?:'in_progress' | 'success' | 'failure' | 'voided' | 'timeout' | 'needs_attention',not_in?:string}; /** - * @description To filter based on `updated_at`. This attribute will be present only if the resource has been updated after 2016-09-28. It is advisable when using this filter, to pass the `sort_by` input parameter as `updated_at` for a faster response. + * @description Lists all the transactions. */ @@ -551,47 +607,6 @@ declare module 'chargebee' { sort_by?:{asc?:'date' | 'updated_at',desc?:'date' | 'updated_at'}; } - export interface VoidTransactionResponse { - transaction:Transaction; - } - - export interface CreateAuthorizationResponse { - transaction:Transaction; - } - export interface CreateAuthorizationInputParam { - - /** - * @description Identifier of the customer. - - */ - - customer_id:string; - - /** - * @description Payment source to be used for authorizing the transaction. - - */ - - payment_source_id?:string; - - /** - * @description The currency code (ISO 4217 format) of the transaction amount. - - */ - - currency_code?:string; - - /** - * @description The amount to be blocked. - - */ - - amount:number; - } - export interface RetrieveResponse { - transaction:Transaction; - } - export interface PaymentsForInvoiceResponse { /** * @description Retrieves the payments for an invoice with the recent ones on top. This returns all the payment attempts(manual \& automatic) made for this invoice. @@ -610,19 +625,23 @@ declare module 'chargebee' { export interface PaymentsForInvoiceInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description Retrieves the payments for an invoice with the recent ones on top. This returns all the payment attempts(manual \& automatic) made for this invoice. */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Retrieves the payments for an invoice with the recent ones on top. This returns all the payment attempts(manual \& automatic) made for this invoice. */ offset?:string; } + export interface RetrieveResponse { + transaction:Transaction; + } + export interface DeleteOfflineTransactionResponse { transaction:Transaction; } @@ -635,73 +654,171 @@ declare module 'chargebee' { comment?:string; } - export interface RefundResponse { - transaction:Transaction; - } - export interface RefundInputParam { - - /** - * @description The amount to be refunded. Must not exceed [amount_unused](transactions#transaction_amount_unused). If not passed then all of [amount_unused](transactions#transaction_amount_unused) is refunded. + export interface InvoiceTransaction { + /** + * @description Identifier for the invoice. - */ + */ - amount?:number; + invoice_id:string; - /** - * @description Remarks, if any, on the refund. + /** + * @description The transaction amount applied to this invoice - */ + */ - comment?:string; - } - export interface InvoiceTransaction { - invoice_id?:string; + applied_amount:number; - applied_amount?:number; + /** + * @description Timestamp at which the transaction is applied. + + */ + + applied_at:number; - applied_at?:number; + /** + * @description The date this invoice is issued. + + */ invoice_date?:number; + /** + * @description Total amount of the invoice + + */ + invoice_total?:number; - invoice_status?:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due'; + /** + * @description Current status of this invoice. \* pending - +The [invoice](/docs/api/invoices?prod_cat_ver=2#invoice_status) is yet to be closed (sent for payment collection). An invoice is generated with this `status` when it has line items that belong to items that are `metered` or when the `subscription.create_pending_invoices`attribute is set to `true`. +The [invoice](/docs/api/invoices?prod_cat_ver=1#invoice_status) is yet to be closed (sent for payment collection). All invoices are generated with this `status` when [Metered Billing](https://www.chargebee.com/docs/1.0/metered_billing.html) is enabled for the site. \* voided - Indicates a voided invoice. \* payment_due - Indicates the payment is not yet collected and is being retried as per retry settings. \* paid - Indicates a paid invoice. \* posted - Indicates the payment is not yet collected and will be in this state till the due date to indicate the due period \* not_paid - Indicates the payment is not made and all attempts to collect is failed. + + */ + + invoice_status:'pending' | 'paid' | 'voided' | 'not_paid' | 'posted' | 'payment_due'; } export interface CreditNoteTransaction { - cn_id?:string; + /** + * @description Identifier for the credit-notes. + + */ + + cn_id:string; - applied_amount?:number; + /** + * @description The transaction amount applied to this invoice + + */ - applied_at?:number; + applied_amount:number; + + /** + * @description Timestamp at which the transaction is applied. + + */ + + applied_at:number; + + /** + * @description Credit note reason code. Deprecated use the cn_create_reason_code parameter instead \* service_unsatisfactory - Service Unsatisfactory \* other - Can be set when none of the above reason codes are applicable \* subscription_cancellation - This reason will be set automatically for Credit Notes created during cancel subscription operation \* fraudulent - FRAUDULENT \* order_change - Order Change \* subscription_pause - This reason will be automatically set to credit notes created during pause/resume subscription operation. \* write_off - This reason will be set automatically for the Credit Notes created during invoice [Write Off](https://www.chargebee.com/docs/invoice-operations.html#write-off) operation. \* subscription_change - This reason will be set automatically for Credit Notes created during Change Subscription operation when [proration](https://www.chargebee.com/docs/proration.html) is enabled \* chargeback - Can be set when you are recording your customer Chargebacks \* waiver - Waiver \* order_cancellation - Order Cancellation \* product_unsatisfactory - Product Unsatisfactory + + */ cn_reason_code?:'other' | 'product_unsatisfactory' | 'subscription_pause' | 'order_cancellation' | 'service_unsatisfactory' | 'subscription_cancellation' | 'chargeback' | 'order_change' | 'write_off' | 'waiver' | 'subscription_change' | 'fraudulent'; + /** + * @description Credit note reason code + + */ + cn_create_reason_code?:string; + /** + * @description The date this credit note is created. + + */ + cn_date?:number; + /** + * @description Total amount of the credit note + + */ + cn_total?:number; - cn_status?:'refund_due' | 'adjusted' | 'refunded' | 'voided'; + /** + * @description The status of this Credit Note. \* voided - When the Credit Note has been cancelled. \* refund_due - When the credits are yet to be used, or have been partially used. \* refunded - When the entire credits (Credit Note amount) have been used (i.e either allocated to invoices or refunded). \* adjusted - When the Credit Note has been adjusted against an invoice. + + */ + + cn_status:'refund_due' | 'adjusted' | 'refunded' | 'voided'; - cn_reference_invoice_id?:string; + /** + * @description The invoice number. Acts as a identifier for invoice and typically generated sequentially. + + */ + + cn_reference_invoice_id:string; } export interface TxnRefundsAndReversal { - txn_id?:string; + /** + * @description Uniquely identifies the transaction. + + */ - txn_status?:'in_progress' | 'success' | 'failure' | 'voided' | 'timeout' | 'needs_attention'; + txn_id:string; - txn_date?:number; + /** + * @description The status of this transaction. \* needs_attention - Connection with Gateway got terminated abruptly. So, status of this transaction needs to be resolved manually \* voided - The transaction got voided or authorization expired at gateway. \* timeout - Transaction failed because of Gateway not accepting the connection. \* success - The transaction is successful. \* failure - Transaction failed. Refer the 'error_code' and 'error_text' fields to know the reason for failure \* in_progress - Transaction is being processed by the gateway. This typically happens for [direct debit transactions](https://www.chargebee.com/docs/direct-debit-payments.html) or, in case of cards, refund transactions. Such transactions can take 2-7 days to complete, depending on the gateway and payment method. + + */ + + txn_status:'in_progress' | 'success' | 'failure' | 'voided' | 'timeout' | 'needs_attention'; - txn_amount?:number; + /** + * @description Indicates when this refund occured. + + */ + + txn_date:number; + + /** + * @description Amount of this refund transaction. + + */ + + txn_amount:number; } export interface LinkedPayment { - id?:string; + /** + * @description Uniquely identifies the transaction. + + */ + + id:string; + + /** + * @description The status of this transaction. \* needs_attention - Connection with Gateway got terminated abruptly. So, status of this transaction needs to be resolved manually \* success - The transaction is successful. \* voided - The transaction got voided or authorization expired at gateway. \* in_progress - Transaction is being processed by the gateway. This typically happens for [direct debit transactions](https://www.chargebee.com/docs/direct-debit-payments.html) or, in case of cards, refund transactions. Such transactions can take 2-7 days to complete, depending on the gateway and payment method. \* failure - Transaction failed. Refer the 'error_code' and 'error_text' fields to know the reason for failure \* timeout - Transaction failed because of Gateway not accepting the connection. + + */ status?:'in_progress' | 'success' | 'failure' | 'voided' | 'timeout' | 'needs_attention'; + /** + * @description Amount for this transaction. + + */ + amount?:number; + /** + * @description Indicates when this transaction occurred. + + */ + date?:number; } } diff --git a/types/resources/UnbilledCharge.d.ts b/types/resources/UnbilledCharge.d.ts index 0764275..c09f31e 100644 --- a/types/resources/UnbilledCharge.d.ts +++ b/types/resources/UnbilledCharge.d.ts @@ -45,7 +45,7 @@ declare module 'chargebee' { unit_amount?:number; /** - * @description The pricing scheme for this line item. \* tiered - The per unit price is based on the tier that the total quantity falls in. \* volume - There are quantity tiers for which per unit prices are set. Quantities are purchased from successive tiers. \* per_unit - A fixed price per unit quantity. \* flat_fee - A fixed price that is not quantity-based. \* stairstep - A quantity-based pricing scheme. The item is charged a fixed price based on the tier that the total quantity falls in. + * @description The pricing scheme for this line item. \* tiered - The per unit price is based on the tier that the total quantity falls in. \* per_unit - A fixed price per unit quantity. \* flat_fee - A fixed price that is not quantity-based. \* volume - There are quantity tiers for which per unit prices are set. Quantities are purchased from successive tiers. \* stairstep - A quantity-based pricing scheme. The item is charged a fixed price based on the tier that the total quantity falls in. */ @@ -87,7 +87,7 @@ declare module 'chargebee' { description?:string; /** - * @description Specifies the modelled entity this line item is based on. \* plan_setup - Indicates that this lineitem is based on 'Plan Setup' charge. The 'entity_id' attribute specifies the [plan](/docs/api/plans#plan_attributes) id \* charge_item_price - Indicates that this line item is based on charge Item Price \* plan - Indicates that this lineitem is based on 'Plan' entity. The 'entity_id' attribute specifies the [plan](/docs/api/plans#plan_attributes) id \* addon_item_price - Indicates that this line item is based on addon Item Price \* plan_item_price - Indicates that this line item is based on plan Item Price \* adhoc - Indicates that this lineitem is not modelled. i.e created adhoc. So the 'entity_id' attribute will be null in this case \* addon - Indicates that this lineitem is based on 'Addon' entity. The 'entity_id' attribute specifies the [addon](/docs/api/addons#addon_attributes) id + * @description Specifies the modelled entity this line item is based on. \* plan_setup - Indicates that this lineitem is based on 'Plan Setup' charge. The 'entity_id' attribute specifies the [plan](/docs/api/plans#plan_attributes) id \* plan - Indicates that this lineitem is based on 'Plan' entity. The 'entity_id' attribute specifies the [plan](/docs/api/plans#plan_attributes) id \* addon_item_price - Indicates that this line item is based on addon Item Price \* plan_item_price - Indicates that this line item is based on plan Item Price \* adhoc - Indicates that this lineitem is not modelled. i.e created adhoc. So the 'entity_id' attribute will be null in this case \* addon - Indicates that this lineitem is based on 'Addon' entity. The 'entity_id' attribute specifies the [addon](/docs/api/addons#addon_attributes) id \* charge_item_price - Indicates that this line item is based on charge Item Price */ @@ -142,6 +142,11 @@ declare module 'chargebee' { updated_at:number; + /** + * @description The value of this parameter will be true if it is a recurring unbilled charge for a future term. + + */ + is_advance_charge?:boolean; /** @@ -161,30 +166,11 @@ declare module 'chargebee' { export namespace UnbilledCharge { export class UnbilledChargeResource { /** - * @description Use this API to delete an unbilled charge by specifying the id of the charge. - - */ - - delete(unbilled_charge_id:string):ChargebeeRequest; - - /** - * @description This is similar to the "Create an invoice for unbilled charges" API but no invoice will be created, only an estimate for this operation is created. - -In the estimate response, - -* **estimate.invoice_estimates** is an array of **estimate.invoice_estimate**. This has the details of the invoices that will be generated now. - -**Note:** - -* This API when invoked does not perform the actual operation. It just generates an estimate. -* Both *subscription_id* and *customer_id* parameters should not be given at the same time. - - - + * @description This endpoint creates unbilled charges for a subscription. */ - invoice_now_estimate(input?:InvoiceNowEstimateInputParam):ChargebeeRequest; + create(input:CreateInputParam):ChargebeeRequest; /** * @description Use this API to bill the [unbilled charges](https://www.chargebee.com/docs/unbilled-charges.html). Available Credits and Excess Payments will automatically be applied while creating the invoice. @@ -207,6 +193,13 @@ If consolidated invoicing is enabled and the parameter 'customer_id' i invoice_unbilled_charges(input?:InvoiceUnbilledChargesInputParam):ChargebeeRequest; + /** + * @description Use this API to delete an unbilled charge by specifying the id of the charge. + + */ + + delete(unbilled_charge_id:string):ChargebeeRequest; + /** * @description This endpoint lists all the unbilled charges. @@ -215,34 +208,63 @@ If consolidated invoicing is enabled and the parameter 'customer_id' i list(input?:ListInputParam):ChargebeeRequest; /** - * @description This endpoint creates unbilled charges for a subscription. + * @description This is similar to the "Create an invoice for unbilled charges" API but no invoice will be created, only an estimate for this operation is created. + +In the estimate response, + +* **estimate.invoice_estimates** is an array of **estimate.invoice_estimate**. This has the details of the invoices that will be generated now. + +**Note:** + +* This API when invoked does not perform the actual operation. It just generates an estimate. +* Both *subscription_id* and *customer_id* parameters should not be given at the same time. + + + */ - create(input:CreateInputParam):ChargebeeRequest; - } - export interface DeleteResponse { - unbilled_charge:UnbilledCharge; + invoice_now_estimate(input?:InvoiceNowEstimateInputParam):ChargebeeRequest; } - - export interface InvoiceNowEstimateResponse { - estimate:Estimate; + export interface CreateResponse { + unbilled_charges:UnbilledCharge[]; } - export interface InvoiceNowEstimateInputParam { + export interface CreateInputParam { /** - * @description Identifier of the subscription for which this estimate needs to be created. Should be given if 'customer_id' is not specified. + * @description Identifier of the subscription for which this unbilled charges needs to be created. */ - subscription_id?:string; + subscription_id:string; /** - * @description Identifier of the customer for whom this estimate is created. Is given if 'subscription_id' is not specified. Applicable only if the 'Consolidated Invoicing' is enabled. If 'Consolidated Invoicing' is not enabled, an invoice will be generated for every subscription. + * @description The currency code (ISO 4217 format) of the unbilled_charge. */ - customer_id?:string; + currency_code?:string; + + /** + * @description Parameters for item_prices + + */ + + item_prices?:{date_from?:number,date_to?:number,item_price_id?:string,quantity?:number,quantity_in_decimal?:string,unit_price?:number,unit_price_in_decimal?:string}[]; + + /** + * @description Parameters for item_tiers + + */ + + item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; + + /** + * @description Parameters for charges + + */ + + charges?:{amount?:number,amount_in_decimal?:string,avalara_sale_type?:AvalaraSaleType,avalara_service_type?:number,avalara_tax_code?:string,avalara_transaction_type?:number,date_from?:number,date_to?:number,description?:string,hsn_code?:string,tax_profile_id?:string,taxable?:boolean,taxjar_product_code?:string}[]; } export interface InvoiceUnbilledChargesResponse { invoices:Invoice[]; @@ -263,6 +285,10 @@ If consolidated invoicing is enabled and the parameter 'customer_id' i customer_id?:string; } + export interface DeleteResponse { + unbilled_charge:UnbilledCharge; + } + export interface ListResponse { /** * @description This endpoint lists all the unbilled charges. @@ -281,21 +307,21 @@ If consolidated invoicing is enabled and the parameter 'customer_id' i export interface ListInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description This endpoint lists all the unbilled charges. */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description This endpoint lists all the unbilled charges. */ offset?:string; /** - * @description Indicates whether to include deleted objects in the list. The deleted objects have the attribute \`deleted\` as \`true\`. + * @description This endpoint lists all the unbilled charges. */ @@ -309,74 +335,93 @@ If consolidated invoicing is enabled and the parameter 'customer_id' i is_voided?:boolean; /** - * @description A unique identifier for the subscription this charge belongs to. + * @description This endpoint lists all the unbilled charges. */ subscription_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string}; /** - * @description A unique identifier for the customer being charged. + * @description This endpoint lists all the unbilled charges. */ customer_id?:{in?:string,is?:string,is_not?:string,is_present?:'true' | 'false',not_in?:string,starts_with?:string}; } - export interface CreateResponse { - unbilled_charges:UnbilledCharge[]; + export interface InvoiceNowEstimateResponse { + estimate:Estimate; } - export interface CreateInputParam { + export interface InvoiceNowEstimateInputParam { /** - * @description Identifier of the subscription for which this unbilled charges needs to be created. + * @description Identifier of the subscription for which this estimate needs to be created. Should be given if 'customer_id' is not specified. */ - subscription_id:string; + subscription_id?:string; /** - * @description The currency code (ISO 4217 format) of the unbilled_charge. + * @description Identifier of the customer for whom this estimate is created. Is given if 'subscription_id' is not specified. Applicable only if the 'Consolidated Invoicing' is enabled. If 'Consolidated Invoicing' is not enabled, an invoice will be generated for every subscription. */ - currency_code?:string; - - /** - * @description Parameters for item_prices + customer_id?:string; + } + export interface LineItemTier { + /** + * @description The lower limit of a range of units for the tier - */ + */ - item_prices?:{date_from?:number,date_to?:number,item_price_id?:string,quantity?:number,quantity_in_decimal?:string,unit_price?:number,unit_price_in_decimal?:string}[]; + starting_unit:number; - /** - * @description Parameters for item_tiers + /** + * @description The upper limit of a range of units for the tier - */ + */ - item_tiers?:{ending_unit?:number,ending_unit_in_decimal?:string,item_price_id?:string,price?:number,price_in_decimal?:string,starting_unit?:number,starting_unit_in_decimal?:string}[]; + ending_unit?:number; - /** - * @description Parameters for charges + /** + * @description The number of units purchased in a range. - */ + */ - charges?:{amount?:number,amount_in_decimal?:string,avalara_sale_type?:AvalaraSaleType,avalara_service_type?:number,avalara_tax_code?:string,avalara_transaction_type?:number,date_from?:number,date_to?:number,description?:string,hsn_code?:string,tax_profile_id?:string,taxable?:boolean,taxjar_product_code?:string}[]; - } - export interface LineItemTier { - starting_unit?:number; + quantity_used:number; - ending_unit?:number; + /** + * @description The price of the tier if the charge model is a `stairtstep` pricing , or the price of each unit in the tier if the charge model is `tiered`/`volume` pricing. + + */ - quantity_used?:number; + unit_amount:number; - unit_amount?:number; + /** + * @description The decimal representation of the the lowest value of quantity in this tier. This is zero for the lowest tier. For all other tiers, it is the same as `ending_unit_in_decimal` of the next lower tier. Returned only when the `line_items.pricing_model` is `tiered`, `volume` or `stairstep` and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ starting_unit_in_decimal?:string; + /** + * @description The decimal representation of the highest value of quantity in this tier. This attribute is not applicable for the highest tier. For all other tiers, it must be equal to the `starting_unit_in_decimal` of the next higher tier. Returned only when the `line_items.pricing_model` is `tiered`, `volume` or stairstep and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + ending_unit_in_decimal?:string; + /** + * @description The decimal representation of the quantity purchased from this tier. Returned when the `line_item` is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + quantity_used_in_decimal?:string; + /** + * @description The decimal representation of the per-unit price for the tier when the `pricing_model` is `tiered` or `volume`. When the `pricing_model` is `stairstep`, it is the decimal representation of the total price for `line_item`. The value is in major units of the currency. Returned when the `line_item` is quantity-based and [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + unit_amount_in_decimal?:string; } } diff --git a/types/resources/Usage.d.ts b/types/resources/Usage.d.ts index cb7c1fe..2482eb5 100644 --- a/types/resources/Usage.d.ts +++ b/types/resources/Usage.d.ts @@ -90,11 +90,13 @@ declare module 'chargebee' { export namespace Usage { export class UsageResource { /** - * @description Retrieves usages record for an invoice in PDF file format. + * @description Creates a usage record for an item price in a subscription. The item price must belong to a [metered](/docs/api/items?prod_cat_ver=2#item_metered) item. +**Max Usages** +The maximum number of usages that can be recorded for the entire lifetime of a subscription is 5000. [Contact Support](https://chargebee.freshdesk.com/support/home) if you want this limit to be increased for your site. */ - pdf(input?:PdfInputParam):ChargebeeRequest; + create(subscription_id:string, input:CreateInputParam):ChargebeeRequest; /** * @description Retrieves a usage record of a specific subscription. @@ -103,15 +105,6 @@ declare module 'chargebee' { retrieve(subscription_id:string, input:RetrieveInputParam):ChargebeeRequest; - /** - * @description Creates a usage record for an item price in a subscription. The item price must belong to a [metered](/docs/api/items?prod_cat_ver=2#item_metered) item. -**Max Usages** -The maximum number of usages that can be recorded for the entire lifetime of a subscription is 5000. [Contact Support](https://chargebee.freshdesk.com/support/home) if you want this limit to be increased for your site. - - */ - - create(subscription_id:string, input:CreateInputParam):ChargebeeRequest; - /** * @description Deletes a usage record. This operation cannot be invoked for a usage record that has been [invoiced](usages?prod_cat_ver=2#invoicing_usages). @@ -125,37 +118,13 @@ The maximum number of usages that can be recorded for the entire lifetime of a s */ list(input:ListInputParam):ChargebeeRequest; - } - export interface PdfResponse { - download:Download; - } - export interface PdfInputParam { - - /** - * @description Determines the pdf should be rendered as inline or attachment in the browser. \* attachment - PDF is rendered as attachment in the browser \* inline - PDF is rendered as inline in the browser - - */ - - disposition_type?:DispositionType; - - /** - * @description Parameters for invoice - - */ - - invoice?:{id:string}; - } - export interface RetrieveResponse { - usage:Usage; - } - export interface RetrieveInputParam { /** - * @description Retrieves a usage record of a specific subscription. + * @description Retrieves usages record for an invoice in PDF file format. */ - - id:string; + + pdf(input?:PdfInputParam):ChargebeeRequest; } export interface CreateResponse { usage:Usage; @@ -198,6 +167,18 @@ The maximum number of usages that can be recorded for the entire lifetime of a s note?:string; } + export interface RetrieveResponse { + usage:Usage; + } + export interface RetrieveInputParam { + + /** + * @description Retrieves a usage record of a specific subscription. + + */ + + id:string; + } export interface DeleteResponse { usage:Usage; } @@ -228,57 +209,56 @@ The maximum number of usages that can be recorded for the entire lifetime of a s export interface ListInputParam { [key : string]: any; /** - * @description The number of resources to be returned. + * @description Retrieves the list of usages. */ limit?:number; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Retrieves the list of usages. */ offset?:string; /** - * @description A unique and immutable id for the usage. If not provided, it is autogenerated. + * @description Retrieves the list of usages. */ id?:{is?:string,is_not?:string,starts_with?:string}; /** - * @description The id of the [subscription](/docs/api/subscriptions?prod_cat_ver=2) to which this usage record belongs. + * @description Retrieves the list of usages. */ subscription_id:{is?:string,is_not?:string,starts_with?:string}; /** - * @description The time at which this usage occurred. Chargebee bills only those usages whose `usage_date` falls within a time when the subscription `status` was `active` or `non_renewing`. However, the remaining usage records are still stored and are [retrievable](/docs/api/usages?prod_cat_ver=2#retrieve_a_usage). -**Note:** If `usage_date` corresponds to a time already invoiced, then it is stored but never invoiced unless the [invoice is regenerated](/docs/api/subscriptions?prod_cat_ver=2#regenerate_an_invoice). + * @description Retrieves the list of usages. */ usage_date?:{after?:string,before?:string,between?:string,on?:string}; /** - * @description The id of the [item price](/docs/api/item_prices?prod_cat_ver=2) to which this usage belongs. The item price must be a part of the subscription or should have been part of it historically. + * @description Retrieves the list of usages. */ item_price_id?:{is?:string,is_not?:string,starts_with?:string}; /** - * @description When the usage has been invoiced, this is the `id` of the [invoice](/docs/api/invoices?prod_cat_ver=2). This is cleared when the invoice is `voided` or deleted. + * @description Retrieves the list of usages. */ invoice_id?:{is?:string,is_not?:string,is_present?:'true' | 'false',starts_with?:string}; /** - * @description The source from which the usage record was created. + * @description Retrieves the list of usages. */ @@ -291,6 +271,25 @@ The maximum number of usages that can be recorded for the entire lifetime of a s sort_by?:{asc?:'usage_date',desc?:'usage_date'}; } + export interface PdfResponse { + download:Download; + } + export interface PdfInputParam { + + /** + * @description Determines the pdf should be rendered as inline or attachment in the browser. \* attachment - PDF is rendered as attachment in the browser \* inline - PDF is rendered as inline in the browser + + */ + + disposition_type?:DispositionType; + + /** + * @description Parameters for invoice + + */ + + invoice?:{id:string}; + } } } \ No newline at end of file diff --git a/types/resources/VirtualBankAccount.d.ts b/types/resources/VirtualBankAccount.d.ts index 6ed3ea1..5edcba7 100644 --- a/types/resources/VirtualBankAccount.d.ts +++ b/types/resources/VirtualBankAccount.d.ts @@ -59,7 +59,7 @@ declare module 'chargebee' { swift_code:string; /** - * @description Name of the gateway this virtual bank account is stored in. \* bluesnap - BlueSnap is a payment gateway. \* tco - 2Checkout is a payment gateway. \* first_data_global - First Data Global Gateway Virtual Terminal Account \* exact - Exact Payments is a payment gateway. \* bluepay - BluePay is a payment gateway. \* paypal_express_checkout - PayPal Express Checkout is a payment gateway. \* eway - eWAY Account is a payment gateway. \* paypal_payflow_pro - PayPal Payflow Pro is a payment gateway. \* razorpay - Razorpay is a fast growing payment service provider in India working with all leading banks and support for major local payment methods including Netbanking, UPI etc. \* global_payments - Global Payments is a payment service provider. \* amazon_payments - Amazon Payments is a payment service provider. \* not_applicable - Indicates that payment gateway is not applicable for this resource. \* checkout_com - Checkout.com is a payment gateway. \* adyen - Adyen is a payment gateway. \* braintree - Braintree is a payment gateway. \* nmi - NMI is a payment gateway. \* quickbooks - Intuit QuickBooks Payments gateway \* wepay - WePay is a payment gateway. \* worldpay - WorldPay is a payment gateway \* wirecard - WireCard Account is a payment service provider. \* chargebee_payments - Chargebee Payments gateway \* sage_pay - Sage Pay is a payment gateway. \* moneris_us - Moneris USA is a payment gateway. \* pin - Pin is a payment gateway \* authorize_net - Authorize.net is a payment gateway \* elavon - Elavon Virtual Merchant is a payment solution. \* paypal_pro - PayPal Pro Account is a payment gateway. \* orbital - Chase Paymentech(Orbital) is a payment gateway. \* paypal - PayPal Commerce is a payment gateway. \* beanstream - Bambora(formerly known as Beanstream) is a payment gateway. \* hdfc - HDFC Account is a payment gateway. \* ingenico_direct - Worldline Online Payments is a payment gateway. \* ogone - Ingenico ePayments (formerly known as Ogone) is a payment gateway. \* migs - MasterCard Internet Gateway Service payment gateway. \* stripe - Stripe is a payment gateway. \* vantiv - Vantiv is a payment gateway. \* moneris - Moneris is a payment gateway. \* chargebee - Chargebee test gateway. \* eway_rapid - eWAY Rapid is a payment gateway. \* gocardless - GoCardless is a payment service provider. \* mollie - Mollie is a payment gateway. \* paymill - PAYMILL is a payment gateway. \* balanced_payments - Balanced is a payment gateway \* cybersource - CyberSource is a payment gateway. + * @description Name of the gateway this virtual bank account is stored in. \* ecentric - Ecentric provides a seamless payment processing service in South Africa specializing on omnichannel capabilities. \* bluesnap - BlueSnap is a payment gateway. \* tco - 2Checkout is a payment gateway. \* first_data_global - First Data Global Gateway Virtual Terminal Account \* exact - Exact Payments is a payment gateway. \* bluepay - BluePay is a payment gateway. \* paypal_express_checkout - PayPal Express Checkout is a payment gateway. \* eway - eWAY Account is a payment gateway. \* metrics_global - Metrics global is a leading payment service provider providing unified payment services in the US. \* paypal_payflow_pro - PayPal Payflow Pro is a payment gateway. \* razorpay - Razorpay is a fast growing payment service provider in India working with all leading banks and support for major local payment methods including Netbanking, UPI etc. \* global_payments - Global Payments is a payment service provider. \* amazon_payments - Amazon Payments is a payment service provider. \* not_applicable - Indicates that payment gateway is not applicable for this resource. \* windcave - Windcave provides an end to end payment processing solution in ANZ and other leading global markets. \* checkout_com - Checkout.com is a payment gateway. \* adyen - Adyen is a payment gateway. \* braintree - Braintree is a payment gateway. \* nmi - NMI is a payment gateway. \* quickbooks - Intuit QuickBooks Payments gateway \* wepay - WePay is a payment gateway. \* worldpay - WorldPay is a payment gateway \* wirecard - WireCard Account is a payment service provider. \* chargebee_payments - Chargebee Payments gateway \* sage_pay - Sage Pay is a payment gateway. \* moneris_us - Moneris USA is a payment gateway. \* pin - Pin is a payment gateway \* authorize_net - Authorize.net is a payment gateway \* elavon - Elavon Virtual Merchant is a payment solution. \* paypal_pro - PayPal Pro Account is a payment gateway. \* orbital - Chase Paymentech(Orbital) is a payment gateway. \* paypal - PayPal Commerce is a payment gateway. \* beanstream - Bambora(formerly known as Beanstream) is a payment gateway. \* hdfc - HDFC Account is a payment gateway. \* ingenico_direct - Worldline Online Payments is a payment gateway. \* ogone - Ingenico ePayments (formerly known as Ogone) is a payment gateway. \* migs - MasterCard Internet Gateway Service payment gateway. \* stripe - Stripe is a payment gateway. \* vantiv - Vantiv is a payment gateway. \* moneris - Moneris is a payment gateway. \* bank_of_america - Bank of America Gateway \* chargebee - Chargebee test gateway. \* eway_rapid - eWAY Rapid is a payment gateway. \* gocardless - GoCardless is a payment service provider. \* mollie - Mollie is a payment gateway. \* paymill - PAYMILL is a payment gateway. \* balanced_payments - Balanced is a payment gateway \* cybersource - CyberSource is a payment gateway. */ @@ -110,106 +110,74 @@ declare module 'chargebee' { export namespace VirtualBankAccount { export class VirtualBankAccountResource { /** - * @description Deletes virtual bank accounts from Chargebee. Payment method in the payment gateway, and Auto Collection settings in Chargebee are not affected. + * @description Creates a virtual bank account using the identifier provided by the gateway. */ - delete_local(virtual_bank_account_id:string):ChargebeeRequest; + create_using_permanent_token(input:CreateUsingPermanentTokenInputParam):ChargebeeRequest; /** - * @description Deletes a virtual bank account. If there is no virtual bank account present in the gateway for the customer, this API will return successfully without throwing an error. + * @description Creates a virtual bank account for a customer. Email address is mandatory for virtual bank account creation. All notifications related to this virtual bank account will be sent to the email address you specify. */ - delete(virtual_bank_account_id:string):ChargebeeRequest; + create(input:CreateInputParam):ChargebeeRequest; /** - * @description Lists all the virtual bank accounts. + * @description Retrieves the virtual bank account identified by the unique identifier. */ - list(input?:ListInputParam):ChargebeeRequest; + retrieve(virtual_bank_account_id:string):ChargebeeRequest; /** - * @description Creates a virtual bank account for a customer. Email address is mandatory for virtual bank account creation. All notifications related to this virtual bank account will be sent to the email address you specify. + * @description Lists all the virtual bank accounts. */ - create(input:CreateInputParam):ChargebeeRequest; + list(input?:ListInputParam):ChargebeeRequest; /** - * @description Retrieves the virtual bank account identified by the unique identifier. + * @description Deletes a virtual bank account. If there is no virtual bank account present in the gateway for the customer, this API will return successfully without throwing an error. */ - retrieve(virtual_bank_account_id:string):ChargebeeRequest; + delete(virtual_bank_account_id:string):ChargebeeRequest; /** - * @description Creates a virtual bank account using the identifier provided by the gateway. + * @description Deletes virtual bank accounts from Chargebee. Payment method in the payment gateway, and Auto Collection settings in Chargebee are not affected. */ - create_using_permanent_token(input:CreateUsingPermanentTokenInputParam):ChargebeeRequest; - } - export interface DeleteLocalResponse { - virtual_bank_account:VirtualBankAccount; + delete_local(virtual_bank_account_id:string):ChargebeeRequest; } - - export interface DeleteResponse { + export interface CreateUsingPermanentTokenResponse { virtual_bank_account:VirtualBankAccount; - } - - export interface ListResponse { - /** - * @description Lists all the virtual bank accounts. - - */ - list:{virtual_bank_account:VirtualBankAccount}[]; + customer?:Customer; + } + export interface CreateUsingPermanentTokenInputParam { /** - * @description Lists all the virtual bank accounts. + * @description Identifier of the customer. */ - next_offset?:string; - } - export interface ListInputParam { - [key : string]: any; - /** - * @description The number of resources to be returned. - - */ - - limit?:number; + customer_id:string; /** - * @description Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set \`offset\` to the value of \`next_offset\` obtained in the previous iteration of the API call. + * @description Identifier provided by the gateway for the virtual bank account source. In case of Stripe, the reference_id consists of a combination of Stripe Customer ID and Stripe Source ID separated by a forward slash (e.g. cus_63MnDn0t6kfDW7/src_6WjCF20vT9WN1G). */ - - offset?:string; - /** - * @description Identifier of the customer. - - */ - - customer_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + reference_id:string; /** - * @description Timestamp indicating when this virtual bank account resource was last updated. + * @description type of the credit transfer. \* sepa_credit - SEPA Credit Transfer \* ach_credit - ACH Credit Transfer */ - - updated_at?:{after?:string,before?:string,between?:string,on?:string}; - /** - * @description Timestamp indicating when this virtual bank account resource is created. - - */ - - created_at?:{after?:string,before?:string,between?:string,on?:string}; + scheme?:'ach_credit' | 'sepa_credit'; } export interface CreateResponse { virtual_bank_account:VirtualBankAccount; @@ -243,34 +211,66 @@ declare module 'chargebee' { virtual_bank_account:VirtualBankAccount; } - export interface CreateUsingPermanentTokenResponse { - virtual_bank_account:VirtualBankAccount; + export interface ListResponse { + /** + * @description Lists all the virtual bank accounts. + + */ - customer?:Customer; - } - export interface CreateUsingPermanentTokenInputParam { + list:{virtual_bank_account:VirtualBankAccount}[]; /** - * @description Identifier of the customer. + * @description Lists all the virtual bank accounts. */ - customer_id:string; + next_offset?:string; + } + export interface ListInputParam { + [key : string]: any; + /** + * @description Lists all the virtual bank accounts. + + */ + + limit?:number; /** - * @description Identifier provided by the gateway for the virtual bank account source. In case of Stripe, the reference_id consists of a combination of Stripe Customer ID and Stripe Source ID separated by a forward slash (e.g. cus_63MnDn0t6kfDW7/src_6WjCF20vT9WN1G). + * @description Lists all the virtual bank accounts. */ + + offset?:string; - reference_id:string; + /** + * @description Lists all the virtual bank accounts. + + */ + + customer_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; /** - * @description type of the credit transfer. \* sepa_credit - SEPA Credit Transfer \* ach_credit - ACH Credit Transfer + * @description Lists all the virtual bank accounts. */ + + updated_at?:{after?:string,before?:string,between?:string,on?:string}; - scheme?:'ach_credit' | 'sepa_credit'; + /** + * @description Lists all the virtual bank accounts. + + */ + + created_at?:{after?:string,before?:string,between?:string,on?:string}; } + export interface DeleteResponse { + virtual_bank_account:VirtualBankAccount; + } + + export interface DeleteLocalResponse { + virtual_bank_account:VirtualBankAccount; + } + } } \ No newline at end of file