From a3caa6f82d1d9e8d220a95512daa645cc039420d Mon Sep 17 00:00:00 2001 From: cb-thushitamariaselvan Date: Wed, 20 Mar 2024 06:14:04 +0000 Subject: [PATCH] Releasing v2.34.0. Please check the changelog for the updates. --- CHANGELOG.md | 43 + lib/chargebee.js | 2 +- lib/resources/api_endpoints.js | 48 + package.json | 2 +- types/core.d.ts | 10 +- types/index.d.ts | 6 + types/resources/Attribute.d.ts | 9 + types/resources/Customer.d.ts | 4 +- types/resources/Estimate.d.ts | 305 ++++- types/resources/Export.d.ts | 2 +- types/resources/Gift.d.ts | 88 +- types/resources/ImpactedItemPrice.d.ts | 22 + types/resources/Installment.d.ts | 121 ++ types/resources/InstallmentConfig.d.ts | 162 +++ types/resources/Invoice.d.ts | 201 +++- types/resources/ItemPrice.d.ts | 7 - types/resources/PaymentIntent.d.ts | 8 +- types/resources/PaymentSource.d.ts | 4 +- types/resources/Purchase.d.ts | 96 +- types/resources/Subscription.d.ts | 1461 ++++++++++++++++++++---- types/resources/Transaction.d.ts | 2 +- 21 files changed, 2362 insertions(+), 241 deletions(-) create mode 100644 types/resources/Attribute.d.ts create mode 100644 types/resources/ImpactedItemPrice.d.ts create mode 100644 types/resources/Installment.d.ts create mode 100644 types/resources/InstallmentConfig.d.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index eb0d409..0e44189 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,46 @@ +### v2.34.0 (2024-03-20) +* * * + +#### New resources: +* Attribute has been added. +* ImpactedItemPrice has been added. +* InstallmentConfig has been added. +* Installment has been added. + +#### Removed attributes: +* product_id has been removed from ItemPrice resource. + +#### New Enum values: +* klarna_pay_now has been added to TypeEnum in Customer resource. +* klarna_pay_now has been added to PaymentMethodEnum. +* klarna_pay_now has been added to PaymentMethodTypeEnum enum. +* klarna_pay_now has been added to TypeEnum. +* price_variant has been added to EntityTypeEnum. +* price_variant_created has been added in EventType enum. +* price_variant_updated has been added in EventType enum. +* price_variant_deleted has been added in EventType enum. + +#### Removed Enum values: +* product and variant have been removed from EntityTypeEnum. + +#### New Input parameters: +* config_id has been added to Invoice#InstallmentsRequest. +* amount has been added to Invoice#InstallmentsRequest. +* payment_source_id has been added to Purchase#CreateRequest. +* installment_info[config_id] has been added to Purchase#CreateRequest. +* installment_info[amount] has been added to Purchase#CreateRequest. +* subscription_info[contract_term_billing_cycle_on_renewal] has been added to Purchase#CreateRequest. +* contract_terms[index] has been added to Purchase#CreateRequest. +* contract_terms[action_at_term_end] has been added to Purchase#CreateRequest. +* contract_terms[cancellation_cutoff_period] has been added to Purchase#CreateRequest. +* subscription_info[contract_term_billing_cycle_on_renewal] has been added to Purchase#EstimateRequest. +* contract_terms[index] has been added to Purchase#EstimateRequest. +* contract_terms[action_at_term_end] has been added to Purchase#EstimateRequest. +* contract_terms[cancellation_cutoff_period] has been added to Purchase#EstimateRequest. + +#### Deprecated input parameters: +* product_created, product_updated, product_deleted, variant_created, variant_updated, variant_deleted has been deprecated in EventTypeEnum. + ### v2.33.1 (2024-03-06) * * * * NonSubscription has been added. diff --git a/lib/chargebee.js b/lib/chargebee.js index 5d08504..d2444f9 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.33.1', + clientVersion: 'v2.34.0', port: 443, timemachineWaitInMillis: 3000, exportWaitInMillis: 3000 diff --git a/lib/resources/api_endpoints.js b/lib/resources/api_endpoints.js index 1ff410e..b8e68bc 100644 --- a/lib/resources/api_endpoints.js +++ b/lib/resources/api_endpoints.js @@ -908,6 +908,13 @@ var _endpoints = { "/update_details", true ], + [ + "installments", + "POST", + "/invoices", + "/installments", + true + ], [ "resend_einvoice", "POST", @@ -2352,6 +2359,7 @@ var _endpoints = { true ] ], + "attribute": [], "item_price": [ [ "create", @@ -2537,6 +2545,7 @@ var _endpoints = { ], "impacted_subscription": [], "impacted_item": [], + "impacted_item_price": [], "subscription_entitlement": [ [ "subscription_entitlements_for_subscription", @@ -2699,6 +2708,45 @@ var _endpoints = { "/payment_vouchers", true ] + ], + "installment_config": [ + [ + "create", + "POST", + "/installment_configs", + null, + false + ], + [ + "retrieve", + "GET", + "/installment_configs", + null, + true + ], + [ + "delete", + "POST", + "/installment_configs", + "/delete", + true + ] + ], + "installment": [ + [ + "retrieve", + "GET", + "/installments", + null, + true + ], + [ + "list", + "GET", + "/installments", + null, + false + ] ] }; module.exports = _endpoints; \ No newline at end of file diff --git a/package.json b/package.json index b1a0bba..e5b8f3d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name":"chargebee", - "version":"2.33.1", + "version":"2.34.0", "description":"A library for integrating with ChargeBee.", "keywords":[ "payments", diff --git a/types/core.d.ts b/types/core.d.ts index bd1c60d..3c45a1d 100644 --- a/types/core.d.ts +++ b/types/core.d.ts @@ -40,9 +40,9 @@ declare module 'chargebee' { type EinvoicingMethod = 'automatic' | 'manual' | 'site_default' type EndScheduleOn = 'after_number_of_intervals' | 'specific_date' | 'subscription_end' type EntityCode = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'p' | 'q' | 'r' | 'med2' | 'med1' - type EntityType = 'item' | 'product' | 'coupon' | 'addon' | 'item_price' | 'business_entity' | 'subscription' | 'item_family' | 'credit_note' | 'quote' | 'variant' | 'invoice' | 'plan' | 'transaction' | 'customer' | 'order' + type EntityType = 'item' | 'product' | 'coupon' | 'addon' | 'item_price' | 'business_entity' | 'subscription' | 'item_family' | 'credit_note' | 'quote' | 'variant' | 'invoice' | 'plan' | 'transaction' | 'customer' | 'order' | 'price_variant' type EventName = 'cancellation_page_loaded' - type EventType = 'subscription_pause_scheduled' | 'order_delivered' | 'customer_business_entity_changed' | '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_business_entity_changed' | '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_entitlements_updated' | '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' | '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' | 'subscription_created_with_backdating' | 'order_deleted' | 'item_entitlements_updated' | 'token_consumed' | 'hierarchy_deleted' | 'subscription_cancellation_scheduled' | 'gift_updated' | 'subscription_trial_extended' | 'subscription_renewed' | 'feature_updated' | 'feature_deleted' | 'item_family_created' | 'card_expiry_reminder' | 'token_created' | 'purchase_created' | 'entitlement_overrides_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' | 'item_price_entitlements_removed' | 'card_updated' | 'customer_created' | 'pending_invoice_updated' | 'quote_updated' | 'subscription_renewal_reminder' | 'attached_item_updated' | 'payment_source_updated' | 'business_entity_deleted' | 'authorization_voided' | 'plan_deleted' | 'addon_deleted' | 'addon_updated' | 'addon_created' | 'plan_created' | 'entitlement_overrides_updated' | 'plan_updated' + type EventType = 'subscription_pause_scheduled' | 'order_delivered' | 'customer_business_entity_changed' | '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_business_entity_changed' | '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_entitlements_updated' | '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' | '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' | 'subscription_created_with_backdating' | 'order_deleted' | 'item_entitlements_updated' | 'token_consumed' | 'hierarchy_deleted' | 'subscription_cancellation_scheduled' | 'gift_updated' | 'subscription_trial_extended' | 'subscription_renewed' | 'feature_updated' | 'feature_deleted' | 'item_family_created' | 'card_expiry_reminder' | 'token_created' | 'purchase_created' | 'entitlement_overrides_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' | 'item_price_entitlements_removed' | 'card_updated' | 'customer_created' | 'pending_invoice_updated' | 'quote_updated' | 'subscription_renewal_reminder' | 'attached_item_updated' | 'payment_source_updated' | 'business_entity_deleted' | 'authorization_voided' | 'plan_deleted' | 'addon_deleted' | 'addon_updated' | 'addon_created' | 'plan_created' | 'entitlement_overrides_updated' | 'plan_updated' | 'price_variant_deleted' | 'price_variant_updated' | 'price_variant_created' type ExportType = 'data' | 'import_friendly_data' type FreePeriodUnit = 'week' | 'month' | 'year' | 'day' type FriendOfferType = 'coupon_code' | 'coupon' | 'none' @@ -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' | 'automated_bank_transfer' | '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' | 'automated_bank_transfer' | 'paypal_express_checkout' | 'wechat_pay' | 'pay_to' | 'card' + type PaymentMethod = 'other' | 'netbanking_emandates' | 'klarna_pay_now' | 'ach_credit' | 'dotpay' | 'boleto' | 'direct_debit' | 'automated_bank_transfer' | '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' | 'klarna_pay_now' | 'dotpay' | 'unionpay' | 'direct_debit' | 'faster_payments' | 'generic' | 'sofort' | 'amazon_payments' | 'upi' | 'venmo' | 'apple_pay' | 'bancontact' | 'automated_bank_transfer' | 'paypal_express_checkout' | 'wechat_pay' | 'pay_to' | 'card' type PaymentVoucherType = 'boleto' type PeriodUnit = 'week' | 'month' | 'year' | 'day' type PriceType = 'tax_exclusive' | 'tax_inclusive' @@ -79,7 +79,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' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'dotpay' | 'unionpay' | 'direct_debit' | 'faster_payments' | 'generic' | 'sofort' | 'amazon_payments' | 'upi' | 'venmo' | 'apple_pay' | 'bancontact' | 'automated_bank_transfer' | 'paypal_express_checkout' | 'wechat_pay' | 'pay_to' | 'card' + type Type = 'giropay' | 'alipay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'klarna_pay_now' | 'dotpay' | 'unionpay' | 'direct_debit' | 'faster_payments' | 'generic' | 'sofort' | 'amazon_payments' | 'upi' | 'venmo' | 'apple_pay' | 'bancontact' | 'automated_bank_transfer' | '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/index.d.ts b/types/index.d.ts index da90b06..5e068e1 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -1,6 +1,7 @@ /// /// /// +/// /// /// /// @@ -25,8 +26,11 @@ /// /// /// +/// /// /// +/// +/// /// /// /// @@ -83,6 +87,8 @@ declare module 'chargebee' { static gift: Gift.GiftResource; static hosted_page: HostedPage.HostedPageResource; static in_app_subscription: InAppSubscription.InAppSubscriptionResource; + static installment: Installment.InstallmentResource; + static installment_config: InstallmentConfig.InstallmentConfigResource; static invoice: Invoice.InvoiceResource; static item: Item.ItemResource; static item_entitlement: ItemEntitlement.ItemEntitlementResource; diff --git a/types/resources/Attribute.d.ts b/types/resources/Attribute.d.ts new file mode 100644 index 0000000..adbace0 --- /dev/null +++ b/types/resources/Attribute.d.ts @@ -0,0 +1,9 @@ +/// +declare module 'chargebee' { + export interface Attribute { + + name:string; + + value:string; + } +} \ No newline at end of file diff --git a/types/resources/Customer.d.ts b/types/resources/Customer.d.ts index 831a87d..ca55fdf 100644 --- a/types/resources/Customer.d.ts +++ b/types/resources/Customer.d.ts @@ -1049,7 +1049,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' | '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}; + 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' | 'klarna_pay_now' | '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 @@ -1694,7 +1694,7 @@ It is possible to set a value for this flag even when E-Invoicing is disabled. H */ - 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}; + 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' | 'klarna_pay_now' | '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 diff --git a/types/resources/Estimate.d.ts b/types/resources/Estimate.d.ts index 4739eca..f89cd58 100644 --- a/types/resources/Estimate.d.ts +++ b/types/resources/Estimate.d.ts @@ -246,6 +246,117 @@ In the response, create_invoice_for_items(input:CreateInvoiceForItemsInputParam):ChargebeeRequest; } + export interface CreateSubscriptionResponse { + estimate:Estimate; + } + export interface CreateSubscriptionInputParam { + + /** + * @description Number of cycles(plan interval) this subscription should be charged. After the billing cycles exhausted, the subscription will be cancelled. + + */ + + billing_cycles?:number; + + /** + * @description List of addons IDs that are mandatory to the plan and has to be removed from the subscription. + + */ + + mandatory_addons_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. + + */ + + coupon_ids?: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. . + + */ + + invoice_immediately?:boolean; + + /** + * @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 Indicates the Client profile id for the customer. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. + + */ + + client_profile_id?:string; + + /** + * @description Parameters for subscription + + */ + + subscription:{contract_term_billing_cycle_on_renewal?:number,free_period?:number,free_period_unit?:FreePeriodUnit,id?:string,offline_payment_method?:OfflinePaymentMethod,plan_id:string,plan_quantity?:number,plan_quantity_in_decimal?:string,plan_unit_price?:number,plan_unit_price_in_decimal?:string,setup_fee?:number,start_date?:number,trial_end?:number,trial_end_action?:TrialEndAction}; + + /** + * @description Parameters for billing_address + + */ + + billing_address?:{city?:string,country?:string,line1?:string,line2?:string,line3?:string,state_code?:string,validation_status?:ValidationStatus,zip?:string}; + + /** + * @description Parameters for shipping_address + + */ + + shipping_address?:{city?:string,country?:string,line1?:string,line2?:string,line3?:string,state_code?:string,validation_status?:ValidationStatus,zip?:string}; + + /** + * @description Parameters for customer + + */ + + customer?:{customer_type?:CustomerType,entity_code?:EntityCode,exempt_number?:string,exemption_details?:any[],registered_for_gst?:boolean,taxability?:Taxability,vat_number?:string,vat_number_prefix?:string}; + + /** + * @description Parameters for contract_term + + */ + + contract_term?:{action_at_term_end?:'cancel' | 'renew' | 'evergreen',cancellation_cutoff_period?:number}; + + /** + * @description Parameters for addons + + */ + + addons?:{billing_cycles?:number,id?:string,quantity?:number,quantity_in_decimal?:string,trial_end?:number,unit_price?:number,unit_price_in_decimal?:string}[]; + + /** + * @description Parameters for event_based_addons + + */ + + event_based_addons?:{charge_on?:ChargeOn,charge_once?:boolean,id?:string,on_event?:OnEvent,quantity?:number,quantity_in_decimal?:string,service_period_in_days?:number,unit_price?:number,unit_price_in_decimal?:string}[]; + } export interface CreateSubItemEstimateResponse { estimate:Estimate; } @@ -364,6 +475,102 @@ 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 CreateSubForCustomerEstimateResponse { + estimate:Estimate; + } + export interface CreateSubForCustomerEstimateInputParam { + + /** + * @description Create a subscription for the existing estimate of a customer. + + */ + + use_existing_balances?:boolean; + + /** + * @description Create a subscription for the existing estimate of a customer. + + */ + + invoice_immediately?:boolean; + + /** + * @description Create a subscription for the existing estimate of a customer. + + */ + + billing_cycles?:number; + + /** + * @description Create a subscription for the existing estimate of a customer. + + */ + + mandatory_addons_to_remove?:string[]; + + /** + * @description Create a subscription for the existing estimate of a customer. + + */ + + terms_to_charge?:number; + + /** + * @description Create a subscription for the existing estimate of a customer. + + */ + + billing_alignment_mode?:'immediate' | 'delayed'; + + /** + * @description Create a subscription for the existing estimate of a customer. + + */ + + invoice_date?:number; + + /** + * @description Create a subscription for the existing estimate of a customer. + + */ + + coupon_ids?:string[]; + + /** + * @description Create a subscription for the existing estimate of a customer. + + */ + + subscription?:{contract_term_billing_cycle_on_renewal?:number,free_period?:number,free_period_unit?:FreePeriodUnit,id?:string,offline_payment_method?:OfflinePaymentMethod,plan_id:string,plan_quantity?:number,plan_quantity_in_decimal?:string,plan_unit_price?:number,plan_unit_price_in_decimal?:string,setup_fee?:number,start_date?:number,trial_end?:number,trial_end_action?:TrialEndAction}; + + /** + * @description Create a subscription for the existing estimate of a customer. + + */ + + shipping_address?:{city?:string,country?:string,line1?:string,line2?:string,line3?:string,state_code?:string,validation_status?:ValidationStatus,zip?:string}; + + /** + * @description Create a subscription for the existing estimate of a customer. + + */ + + contract_term?:{action_at_term_end?:'cancel' | 'renew' | 'evergreen',cancellation_cutoff_period?:number}; + + /** + * @description Create a subscription for the existing estimate of a customer. + + */ + + addons?:{billing_cycles?:number,id?:string,quantity?:number,quantity_in_decimal?:string,trial_end?:number,unit_price?:number,unit_price_in_decimal?:string}[]; + + /** + * @description Create a subscription for the existing estimate of a customer. + + */ + + event_based_addons?:{charge_on?:ChargeOn,charge_once?:boolean,id?:string,on_event?:OnEvent,quantity?:number,quantity_in_decimal?:string,service_period_in_days?:number,unit_price?:number,unit_price_in_decimal?:string}[]; + } export interface CreateSubItemForCustomerEstimateResponse { estimate:Estimate; } @@ -874,6 +1081,102 @@ In the response, invoice_immediately?:boolean; } + export interface CancelSubscriptionResponse { + estimate:Estimate; + } + export interface CancelSubscriptionInputParam { + + /** + * @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 event_based_addons + + */ + + event_based_addons?:{id?:string,quantity?:number,service_period_in_days?:number,unit_price?:number}[]; + } export interface CancelSubscriptionForItemsResponse { estimate:Estimate; } @@ -1075,7 +1378,7 @@ If `no_action` is chosen, charges are added to the resumption invoice. */ - 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}; + 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' | 'klarna_pay_now' | '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 diff --git a/types/resources/Export.d.ts b/types/resources/Export.d.ts index 62aed3e..24c048b 100644 --- a/types/resources/Export.d.ts +++ b/types/resources/Export.d.ts @@ -592,7 +592,7 @@ Payment owner of an invoice. */ - 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' | 'dlocal' | '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' | 'dlocal' | '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' | 'automated_bank_transfer' | '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' | 'automated_bank_transfer' | '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}}; + 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' | 'dlocal' | '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' | 'dlocal' | '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' | 'klarna_pay_now' | 'ach_credit' | 'dotpay' | 'boleto' | 'direct_debit' | 'automated_bank_transfer' | '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' | 'automated_bank_transfer' | '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; diff --git a/types/resources/Gift.d.ts b/types/resources/Gift.d.ts index 7567895..14bd0c5 100644 --- a/types/resources/Gift.d.ts +++ b/types/resources/Gift.d.ts @@ -123,6 +123,92 @@ declare module 'chargebee' { update_gift(gift_id:string, input:UpdateGiftInputParam):ChargebeeRequest; } + export interface CreateResponse { + gift:Gift; + + subscription:Subscription; + + invoice?:Invoice; + } + export interface CreateInputParam { + + /** + * @description Indicates the date on which the gift notification is sent to the receiver. If not passed, the receiver is notified immediately. + + */ + + scheduled_at?:number; + + /** + * @description When `true`, the claim happens automatically. When not passed, the default value in the site settings is used. + + */ + + auto_claim?:boolean; + + /** + * @description When `true`, indicates that the gift does not expire. Do not pass or pass as `false` when `auto_claim` is set. . + + */ + + no_expiry?:boolean; + + /** + * @description The date until which the gift can be claimed. Must be set to a value after `scheduled_at`. If the gift is not claimed within `claim_expiry_date`, it will expire and the subscription will move to `cancelled` state. When not passed, the value specified in the site settings will be used. Pass as `NULL` or do not pass when `auto_claim` or `no_expiry` are set. + + */ + + claim_expiry_date?:number; + + /** + * @description List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. + + */ + + coupon_ids?:string[]; + + /** + * @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' | 'klarna_pay_now' | '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 + + */ + + subscription:object; + + /** + * @description Parameters for addons + + */ + + addons?:{id?:string,quantity?:number,quantity_in_decimal?:string}[]; + } export interface CreateForItemsResponse { gift:Gift; @@ -186,7 +272,7 @@ declare module 'chargebee' { */ - 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}; + 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' | 'klarna_pay_now' | '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 diff --git a/types/resources/ImpactedItemPrice.d.ts b/types/resources/ImpactedItemPrice.d.ts new file mode 100644 index 0000000..d5693f3 --- /dev/null +++ b/types/resources/ImpactedItemPrice.d.ts @@ -0,0 +1,22 @@ +/// +declare module 'chargebee' { + export interface ImpactedItemPrice { + + count?:number; + + download?:ImpactedItemPrice.Download; + + item_prices?:any[]; + } + export namespace ImpactedItemPrice { + + + export interface Download { + download_url:string; + + valid_till:number; + + mime_type?:string; + } + } +} \ No newline at end of file diff --git a/types/resources/Installment.d.ts b/types/resources/Installment.d.ts new file mode 100644 index 0000000..c5c0b50 --- /dev/null +++ b/types/resources/Installment.d.ts @@ -0,0 +1,121 @@ +/// +declare module 'chargebee' { + export interface Installment { + + /** + * @description An auto-generated unique identifier for the Payment installment. + + */ + + id:string; + + /** + * @description The ID of the invoice to which this installment belongs. + + */ + + invoice_id:string; + + /** + * @description The date when this installment is in effect. + + */ + + date:number; + + /** + * @description The part of invoice.amount_due allocated to this installment. + + */ + + amount:number; + + /** + * @description The payment status of the installment. Possible values are paid, payment_due: The payment is due, posted. \* posted - The invoice is finalized but the payment is not due yet. \* payment_due - The payment is due. One or more payments were attempted for the installment but were unsuccessful. \* paid - The installment has been paid. + + */ + + status:'paid' | 'posted' | 'payment_due'; + + /** + * @description The time when this resource was created. + + */ + + created_at:number; + + /** + * @description The time when this resource was last updated. + + */ + + updated_at?:number; + } + export namespace Installment { + export class InstallmentResource { + /** + * @description Retrieves a specific installment resource. + + */ + + retrieve(installment_id:string):ChargebeeRequest; + + /** + * @description Lists the installments that match the criteria provided in the filter parameters. + + */ + + list(input:ListInputParam):ChargebeeRequest; + } + export interface RetrieveResponse { + installment:Installment; + } + + export interface ListResponse { + /** + * @description Lists the installments that match the criteria provided in the filter parameters. + + */ + + list:{installment:Installment}[]; + + /** + * @description Lists the installments that match the criteria provided in the filter parameters. + + */ + + next_offset?:string; + } + export interface ListInputParam { + [key : string]: any; + /** + * @description Lists the installments that match the criteria provided in the filter parameters. + + */ + + limit?:number; + + /** + * @description Lists the installments that match the criteria provided in the filter parameters. + + */ + + offset?:string; + + /** + * @description Lists the installments that match the criteria provided in the filter parameters. + + */ + + sort_by?:string; + + /** + * @description Lists the installments that match the criteria provided in the filter parameters. + + */ + + invoice_id:{in?:string,is?:string}; + } + + } +} \ No newline at end of file diff --git a/types/resources/InstallmentConfig.d.ts b/types/resources/InstallmentConfig.d.ts new file mode 100644 index 0000000..3031369 --- /dev/null +++ b/types/resources/InstallmentConfig.d.ts @@ -0,0 +1,162 @@ +/// +declare module 'chargebee' { + export interface InstallmentConfig { + + /** + * @description An auto-generated unique identifier for the Payment installment Configuration. + + */ + + id:string; + + /** + * @description A brief description for this installment configuration. + + */ + + description?:string; + + /** + * @description Specifies the total number of installments for the invoice. + + */ + + number_of_installments:number; + + /** + * @description Defines the time unit for intervals between installments.Possible values are: day, week, month \* month - month \* week - week \* day - day + + */ + + period_unit:'week' | 'month' | 'day'; + + /** + * @description The time period between the effective dates of two consecutive installments, expressed in period_units. + + */ + + period?:number; + + /** + * @description The day of the week (or month) when the installment is in effect. For week: A value between 1 (Sunday) and 7 (Saturday) indicating the preferred day of the week for the installment dates. For example, 2 represents Monday. For month: A value from 1 to 31, indicating the preferred day of the month for installment dates. For example, 15 represents the 15th day of the month. If the month has fewer days than the specified preferred_day, the installment date is the last day of the month. + + */ + + preferred_day?:number; + + /** + * @description The timestamp at which the installment_config was created. + + */ + + created_at:number; + + /** + * @description The timestamp at which the installment_config was last updated at. + + */ + + updated_at?:number; + + /** + * @description Defines the details for each installment individually. + + */ + + installments?:InstallmentConfig.Installment[]; + } + export namespace InstallmentConfig { + export class InstallmentConfigResource { + /** + * @description Creates an installment configuration. After creating an installment_config, you can use it to generate installments for multiple invoices. + + */ + + create(input:CreateInputParam):ChargebeeRequest; + + /** + * @description This endpoint retrieves an installment_config resource. + + */ + + retrieve(installment_config_id:string):ChargebeeRequest; + + /** + * @description This endpoint deletes an installment_config resource. + + */ + + delete(installment_config_id:string):ChargebeeRequest; + } + export interface CreateResponse { + installment_config:InstallmentConfig; + } + export interface CreateInputParam { + + /** + * @description Specifies the total number of installments for the invoice. + + */ + + number_of_installments:number; + + /** + * @description Defines the time unit for intervals between installments.Possible values are: day, week, month \* month - month \* week - week \* day - day + + */ + + period_unit:'week' | 'month' | 'day'; + + /** + * @description The time period between the effective dates of two consecutive installments, expressed in period_units. + + */ + + period?:number; + + /** + * @description The day of the week (or month) when the installment is in effect. For week: A value between 1 (Sunday) and 7 (Saturday) indicating the preferred day of the week for the installment dates. For example, 2 represents Monday. For month: A value from 1 to 31, indicating the preferred day of the month for installment dates. For example, 15 represents the 15th day of the month. If the month has fewer days than the specified preferred_day, the installment date is the last day of the month. + + */ + + preferred_day?:number; + + /** + * @description A brief description for this installment configuration. + + */ + + description?:string; + + /** + * @description Parameters for installments + + */ + + installments?:{amount_percentage?:number,period?:number}[]; + } + export interface RetrieveResponse { + installment_config:InstallmentConfig; + } + + export interface DeleteResponse { + installment_config:InstallmentConfig; + } + + export interface Installments { + /** + * @description The period of time (expressed in period_units) after the invoice.date, marking the date when installment is in effect. For example, when installments.period is 3 and period_unit is month, this installment is effective 3 months after the invoice.date + + */ + + period?:number; + + /** + * @description The percentage of invoice.amount_due allocated to this installment. If unspecified, the invoice.amount_due is distributed equally among the installments. + + */ + + amount_percentage?:number; + } + } +} \ No newline at end of file diff --git a/types/resources/Invoice.d.ts b/types/resources/Invoice.d.ts index 504b219..1a20902 100644 --- a/types/resources/Invoice.d.ts +++ b/types/resources/Invoice.d.ts @@ -743,6 +743,13 @@ All associated [usages](/docs/api/usages?prod_cat_ver=2) are permanently de update_details(invoice_id:string, input?:UpdateDetailsInputParam):ChargebeeRequest; + /** + * @description Creates installments for an invoice, enabling the invoice to be paid in multiple, scheduled payments. **Note: The invoice must be in payment_due.** + + */ + + installments(invoice_id:string, input:InstallmentsInputParam):ChargebeeRequest; + /** * @description Resend failed einvoice of an invoice to the customer using this API. @@ -772,6 +779,179 @@ This endpoint schedules e-invoices manually. This operation is not allowed when send_einvoice(invoice_id:string):ChargebeeRequest; } + export interface CreateResponse { + invoice:Invoice; + } + export interface CreateInputParam { + + /** + * @description Identifier of the customer for which this invoice needs to be created. Should be specified if 'subscription_id' is not specified. + + */ + + customer_id?:string; + + /** + * @description Identifier of the subscription for which this invoice needs to be created. Should be specified if 'customer_id' is not specified.(not applicable for consolidated invoice). + + */ + + subscription_id?:string; + + /** + * @description The currency code (ISO 4217 format) of the invoice amount. + + */ + + currency_code?:string; + + /** + * @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 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 Purchase Order Number for this invoice. + + */ + + po_number?:string; + + /** + * @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 If specified, the customer level auto collection will be overridden. \* 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 Token generated by Chargebee JS representing payment method details. + + */ + + token_id?:string; + + /** + * @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. + + */ + + replace_primary_payment_source?:boolean; + + /** + * @description Indicates whether the payment source should be retained for the customer. + + */ + + retain_payment_source?:boolean; + + /** + * @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 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 statement_descriptor + + */ + + statement_descriptor?:{additional_info?:string,descriptor?:string}; + + /** + * @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 bank_account + + */ + + 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 + + */ + + 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' | 'klarna_pay_now' | '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 addons + + */ + + addons?:{date_from?:number,date_to?:number,id?:string,quantity?:number,quantity_in_decimal?:string,unit_price?:number,unit_price_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}[]; + } export interface CreateForChargeItemsAndChargesResponse { invoice:Invoice; } @@ -930,7 +1110,7 @@ The invoice is [linked](/docs/api?prod_cat_ver=2#mbe-linked-be) to the same */ - 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}; + 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' | 'klarna_pay_now' | '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 item_prices @@ -1984,6 +2164,25 @@ Ireland** . The first two characters of the VAT number in such a case is `X statement_descriptor?:{additional_info?:string,descriptor?:string}; } + export interface InstallmentsResponse { + invoice:Invoice; + } + export interface InstallmentsInputParam { + + /** + * @description The identifier of the installment_config used to create the installments. + + */ + + config_id:string; + + /** + * @description The part of the invoice.amount_due to be distributed across the installments. If unspecified, the full invoice.amount_due is considered by default. + + */ + + amount?:number; + } export interface ResendEinvoiceResponse { invoice:Invoice; } diff --git a/types/resources/ItemPrice.d.ts b/types/resources/ItemPrice.d.ts index ff9a93f..fc98827 100644 --- a/types/resources/ItemPrice.d.ts +++ b/types/resources/ItemPrice.d.ts @@ -23,13 +23,6 @@ declare module 'chargebee' { item_family_id?:string; - /** - * @description Identifier of the product - - */ - - product_id?:string; - /** * @description The id of the item that the item price belongs to. diff --git a/types/resources/PaymentIntent.d.ts b/types/resources/PaymentIntent.d.ts index ae45401..8f77ee1 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' | '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'; + payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'klarna_pay_now' | '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`. @@ -226,7 +226,7 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade */ - 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'; + payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'klarna_pay_now' | '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`. @@ -273,7 +273,7 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade */ - 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'; + payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'klarna_pay_now' | '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`. @@ -313,7 +313,7 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade */ - 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'; + payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'klarna_pay_now' | '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/PaymentSource.d.ts b/types/resources/PaymentSource.d.ts index 40d2238..4869346 100644 --- a/types/resources/PaymentSource.d.ts +++ b/types/resources/PaymentSource.d.ts @@ -646,7 +646,7 @@ Currently, the `skip_retrieval` value as `true` is only supp */ - payment_intent?:{additional_info?:object,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}; + payment_intent?:{additional_info?:object,additional_information?:object,gateway_account_id?:string,gw_token?:string,id?:string,payment_method_type?:'giropay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'klarna_pay_now' | '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 CreateVoucherPaymentSourceResponse { customer:Customer; @@ -847,7 +847,7 @@ Currently, the `skip_retrieval` value as `true` is only supp */ - type?:{in?:string,is?:'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' | 'automated_bank_transfer' | 'paypal_express_checkout' | 'wechat_pay' | 'pay_to' | 'card',is_not?:'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' | 'automated_bank_transfer' | 'paypal_express_checkout' | 'wechat_pay' | 'pay_to' | 'card',not_in?:string}; + type?:{in?:string,is?:'giropay' | 'alipay' | 'ideal' | 'sepa_instant_transfer' | 'google_pay' | 'netbanking_emandates' | 'klarna_pay_now' | 'dotpay' | 'unionpay' | 'direct_debit' | 'faster_payments' | 'generic' | 'sofort' | 'amazon_payments' | 'upi' | 'venmo' | 'apple_pay' | 'bancontact' | 'automated_bank_transfer' | 'paypal_express_checkout' | 'wechat_pay' | 'pay_to' | 'card',is_not?:'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' | 'automated_bank_transfer' | 'paypal_express_checkout' | 'wechat_pay' | 'pay_to' | 'card',not_in?:string}; /** * @description Lists all the payment sources diff --git a/types/resources/Purchase.d.ts b/types/resources/Purchase.d.ts index 770d727..fd93a16 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/support/home). +* with a recommended subscription group of 5. To increase this limit to a maximum of 8, contact eap@chargebee.com. * 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/support/home). +A subscription group can have up to 20 non-plan item prices. To increase this limit to a maximum of 60, contact eap@chargebee.com. #### 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/support/home). +* A one-time charge group can have up to 20 item prices. To increase this limit to a maximum of 60, contact eap@chargebee.com. * 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} @@ -130,6 +130,13 @@ Discounts, both [manual discounts](discounts) and <coupons>, can be applie customer_id:string; + /** + * @description Payment source attached to this purchase. If present, the customer's payment sources won't be used to collect any payment for this purchase. + + */ + + payment_source_id?:string; + /** * @description Parameters for invoice_info @@ -137,6 +144,13 @@ Discounts, both [manual discounts](discounts) and <coupons>, can be applie invoice_info?:{notes?:string,po_number?:string}; + /** + * @description Parameters for installment_info + + */ + + installment_info?:{amount?:number,config_id?:string}; + /** * @description Parameters for purchase_items @@ -170,7 +184,72 @@ Discounts, both [manual discounts](discounts) and <coupons>, can be applie */ - subscription_info:{billing_cycles?:number,index:number,meta_data?:object,subscription_id?:string}[]; + subscription_info:{billing_cycles?:number,contract_term_billing_cycle_on_renewal?:number,index:number,meta_data?:object,subscription_id?:string}[]; + + /** + * @description Creates a `purchase` resource. A purchase can contain one or more of the following: + +* subscriptions (a [subscription](subscriptions) resource consists of item prices such that at least one of the item prices belongs to an [item](items) of `type` `plan`.) +* group of one-time charges (aka [charge item prices](item_prices#types)) + +When you call this API, the invoices for the subscription(s) and one-time charge(s) are created immediately and not left [unbilled](subscriptions?prod_cat_ver=2#create_subscription_for_items_invoice_immediately). +**Note** + +Providing `shipping_addresses[]` is required when the [Orders feature](https://www.chargebee.com/docs/2.0/orders.html#configuration_step-1-configure-site-wide-settings) has been enabled. + +### Specifying `purchase_item` groups {#groups} + + +When creating a purchase, you must specify the *group* or `index` to which each item price belongs. You can do this by setting the `purchase_items[index]` for each item price. Item prices with the same `purchase_items[index]` belong to the same group. + + +The grouping of item prices allows you to specify the `discounts[]` applicable for each group and indicate which item prices should be added to any subscriptions you want to create. Groups can be one of two types: + +* Subscription groups +* One-time charge groups + +The following subsections describe the types of groups in detail. +**Note** + +You can specify up to 10 groups, + +* with a recommended subscription group of 5. To increase this limit to a maximum of 8, contact eap@chargebee.com. +* with a maximum of 10 one-time charge groups by default. + +The total limit for group items for a single purchase is 60. + +#### Subscription groups {#subscription} + +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 eap@chargebee.com. + +#### Custom Fields {#custom-fields} + +Purchase API supports custom fields of Subscriptions, use the following format to specify custom fields in Purchase API: **`subscription_info[custom_field]`**. + +#### One-time charge groups {#one-time} + +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 eap@chargebee.com. +* 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} + +Discounts, both [manual discounts](discounts) and <coupons>, can be applied to groups by specifying the `discounts[]` array. The following table describes the method of application based on whether `discounts[index][i]` is provided: + +| | **`discounts[index][i]` is provided** | **`discounts[index][i]` is not provided** | +|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **Coupons** | * The coupon is applied exclusively to the invoice for group `i`. * The coupon is applied exclusively to the invoice created immediately upon invoking this API. * If group `i` is a [subscription group](#subscription), then the coupon is applied to invoices for subscription renewals based on coupon attributes such as `duration_type` and `max_redemptions`. | * The coupon is applied to all the invoices immediately generated upon invoking this API. * The coupon is not applied to subsequent invoices, such as those generated upon subscription renewal. | +| **Manual discounts** | * The manual discount is applied exclusively to the invoice for group `i`. * The manual discount is applied exclusively to the invoice created immediately upon invoking this API. * The manual discount is not applied to subsequent invoices, such as those generated upon subscription renewal. | * The manual discount is applied to all the invoices immediately generated upon invoking this API. * The manual discount is not applied to subsequent invoices, such as those generated upon subscription renewal. | + + + */ + + contract_terms:{action_at_term_end?:'cancel' | 'renew_once' | 'renew' | 'evergreen',cancellation_cutoff_period?:number,index:number}[]; } export interface EstimateResponse { estimate:Estimate; @@ -238,7 +317,14 @@ Discounts, both [manual discounts](discounts) and <coupons>, can be applie */ - subscription_info:{billing_cycles?:number,index:number,subscription_id?:string}[]; + subscription_info:{billing_cycles?:number,contract_term_billing_cycle_on_renewal?:number,index:number,subscription_id?:string}[]; + + /** + * @description Returns an estimate for creating a `purchase` resource. The operation works exactly like [Create a purchase](purchases#create_a_purchase), except that only an [estimate](estimates) resource is returned without an actual `purchase` resource being created. + + */ + + contract_terms:{action_at_term_end?:'cancel' | 'renew_once' | 'renew' | 'evergreen',cancellation_cutoff_period?:number,index:number}[]; } } diff --git a/types/resources/Subscription.d.ts b/types/resources/Subscription.d.ts index 18370a1..cd7597e 100644 --- a/types/resources/Subscription.d.ts +++ b/types/resources/Subscription.d.ts @@ -336,6 +336,13 @@ declare module 'chargebee' { changes_scheduled_at?:number; + /** + * @description Contract terms for this subscription + + */ + + contract_term?:Subscription.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 @@ -746,7 +753,7 @@ If specified as **schedule_payment_collection**, payment collection for the amou remove_scheduled_resumption(subscription_id:string):ChargebeeRequest; } - export interface CreateWithItemsResponse { + export interface CreateResponse { subscription:Subscription; customer:Customer; @@ -757,7 +764,7 @@ If specified as **schedule_payment_collection**, payment collection for the amou unbilled_charges?:UnbilledCharge[]; } - export interface CreateWithItemsInputParam { + export interface CreateInputParam { [key : string] : any; /** * @description A unique and immutable identifier for the subscription. If not provided, it is autogenerated. @@ -767,47 +774,70 @@ If specified as **schedule_payment_collection**, payment collection for the amou 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** + * @description Identifier of the plan for this subscription. -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). -. + */ + + plan_id:string; + + /** + * @description Plan quantity for this subscription. */ - business_entity_id?:string; + plan_quantity?: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 The decimal representation of the quantity of the plan purchased. Can be provided for quantity-based plans and only when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. */ - trial_end?:number; + plan_quantity_in_decimal?: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 Plan Unit Amount for create subscription. */ - billing_cycles?:number; + plan_unit_price?:number; /** - * @description Item ids of [mandatorily attached addons](./attached_items?prod_cat_ver=2) that are to be removed from the subscription. + * @description Plan Unit Amount in Decimal for create subscription. */ - mandatory_items_to_remove?:string[]; + plan_unit_price_in_decimal?: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. + * @description Amount that will override the default setup fee. The unit depends on the [type of currency](/docs/api?prod_cat_ver=1#md_disabled). -* 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. -. + */ + + setup_fee?:number; + + /** + * @description The time at which the trial ends for this subscription. Can be specified to override the default trial period.If **'0'** is passed, the subscription will be activated immediately. */ - net_term_days?:number; + trial_end?:number; + + /** + * @description Specifies the number of billing cycles for the subscription. The behavior of the subscription after the billing cycles have completed depends on whether the subscription is on a [contract term](contract_terms?prod_cat_ver=1) or not. + +* When the subscription is not on a contract term: if `billing_cycles` is not provided, then the billing cycles [set for the plan](plans?prod_cat_ver=1&lang=curl#plan_billing_cycles) is used. Moreover, once the `billing_cycles` have completed, the subscription cancels. +* When the subscription is on a contract term: Providing `billing_cycles` is mandatory. Moreover, once the `billing_cycles` have completed, the behavior of the subscription is determined by the `contract_term[action_at_term_end]` parameter. + + */ + + billing_cycles?:number; + + /** + * @description List of addons IDs that are mandatory to the plan and has to be removed from the subscription. + + */ + + mandatory_addons_to_remove?:string[]; /** * @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: @@ -842,6 +872,13 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade billing_alignment_mode?:BillingAlignmentMode; + /** + * @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. @@ -857,18 +894,18 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade coupon_ids?:string[]; /** - * @description Id of the payment source to be attached to this subscription. + * @description The Chargebee payment token generated by Chargebee JS. */ - payment_source_id?:string; + token_id?:string; /** - * @description If `true`, ignores the [hierarchy relationship](./customers?prod_cat_ver=2#customer_relationship) and uses customer as payment and invoice owner. + * @description A unique tracking token. */ - override_relationship?:boolean; + affiliate_token?: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. @@ -893,7 +930,7 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade /** * @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). +[Learn more](advanced-features?prod_cat_ver=1#metadata). */ @@ -907,13 +944,6 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade invoice_immediately?:boolean; - /** - * @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. - - */ - - replace_primary_payment_source?: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. @@ -936,395 +966,535 @@ An alternative way of passing this parameter is by means of a [custom HTTP heade contract_term_billing_cycle_on_renewal?:number; /** - * @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. - -You can also set this to `true` explicitly using the [create](/docs/api/subscriptions#create_subscription_for_items_create_pending_invoices)/[update](/docs/api/subscriptions#update_subscription_for_items_create_pending_invoices) subscription operations. This is useful in the following scenarios: - -* When tracking usages and calculating usage-based charges on your end. You can then add them to the subscription as a [one-time charge](https://www.chargebee.com/docs/charges.html) at the end of the billing term. -* When you need to inspect all charges before closing invoices for this subscription. - -Applicable only when [Metered Billing](https://www.chargebee.com/docs/metered_billing.html) is enabled for the site -. + * @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. */ - create_pending_invoices?:boolean; + trial_end_action?:TrialEndAction; /** - * @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 Indicates the Client profile id for the customer. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. */ - auto_close_invoices?:boolean; + client_profile_id?:string; /** - * @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` -. + * @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 */ - first_invoice_pending?:boolean; + payment_initiator?:PaymentInitiator; /** - * @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 customer */ - trial_end_action?:TrialEndAction; + customer?:object; /** - * @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 card */ - payment_initiator?:PaymentInitiator; + 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 shipping_address + * @description Parameters for bank_account */ - 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}; + 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 **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 Parameters for payment_method */ - statement_descriptor?:{additional_info?:string,descriptor?:string}; + 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}; + 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' | 'klarna_pay_now' | '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 + * @description Parameters for billing_address */ - contract_term?:{action_at_term_end?:'cancel' | 'renew' | 'evergreen',cancellation_cutoff_period?: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 Parameters for subscription_items + * @description Parameters for shipping_address */ - 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}[]; + 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 discounts + * @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. + +Creates a new subscription along with the customer. You can attach a plan, plan quantity, one or more addons and coupon while creating this subscription. + +#### Future Subscriptions + +If the **start_date** is specified, the subscription will be created in 'future' state (.ie, instead of starting immediately it will be scheduled to start at the specified 'start_date'). Besides if 'trial' is specified (plan configuration or specified explicitly using trial_end), the subscription will go into 'trial' state when it starts. Otherwise it will directly become 'active' when it starts. + +#### Trial Period + +If the plan has trial period or if the trial_end is specified explicitly, the subscription will be created in 'in_trial' state. + +If the card details are passed, it is not charged until the end of the trial period. Incase you need to verify the card you could enable the ['card verification option'](https://www.chargebee.com/docs/cards.html#card-verification) in the gateway settings. + +#### Invoice + +If the plan does not have a trial period and if any of the recurring items has charges, then a invoice would be raised immediately. If 'auto_collection' is turned 'on', then card attributes are mandatory and subscription will be created only if the payment was successful. + +#### Card details + +Passing card details to this API involves PCI liability at your end as sensitive card information passes through your servers. If you wish to avoid that, you can use one of the following integration methodologies if applicable + +* If you are using Stripe gateway, you can use [Stripe.js](https://stripe.com/docs/stripe.js) with your checkout form. Take a look at this [Stripe tutorial](https://stripe.com/docs/payments/accept-a-payment-charges) for more details. +* If you are using Braintree gateway, you can use [Braintree.js](//www.braintreepayments.com/docs/javascript) with your checkout form. Please refer this [tutorial](https://www.chargebee.com/tutorials/braintree-js-example.html) for more details. +* If you are using Authorize.Net gateway, you use [Accept.js](https://developer.authorize.net/api/reference/features/acceptjs.html) with your checkout form. +* 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. + + + +**Legacy behavior:** + +* **For [sites](https://www.chargebee.com/docs/sites-intro.html) created before March 1st, 2014:** On making this request, the `billing_address` and `vat_number` of the customer are **deleted** and replaced by the values passed with this request. Ensure that you pass the [billing address parameters](/docs/api/subscriptions?prod_cat_ver=1#create_a_subscription_card_billing_addr1) and the `vat_number` parameters each time you make this request, to avoid losing the same information at the customer-level. +* **For [sites](https://www.chargebee.com/docs/sites-intro.html) created on or after March 1st, 2014:** This request does not alter the `billing_address` and `vat_number` of the customer. + + + +#### Related Tutorials + +* [Check out this tutorial to create trial signup with custom fields.](//www.chargebee.com/tutorials/custom-fields-recurring-billing-example.html) +* [Learn how to implement a in-app checkout flow that allows your customers to select addons and apply coupons. Estimate API is used to dynamically calculate the order summary shown to the customer.](https://www.chargebee.com/tutorials/in-app-checkout-page-using-estimate-api-example.html) + + + */ - discounts:{amount?:number,apply_on:ApplyOn,duration_type:DurationType,included_in_mrr?:boolean,item_price_id?:string,percentage?:number,period?:number,period_unit?:PeriodUnit}[]; + statement_descriptor?:{additional_info?:string,descriptor?:string}; /** - * @description Parameters for item_tiers + * @description Parameters for contract_term */ - 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 { + contract_term?:{action_at_term_end?:'cancel' | 'renew' | 'evergreen',cancellation_cutoff_period?:number}; + /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description Parameters for entity_identifiers */ - list:{subscription:Subscription,customer:Customer,card?:Card}[]; + entity_identifiers?:{id?:string,scheme?:string,standard?:string,value?:string}[]; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description Parameters for addons */ - next_offset?:string; - } - export interface ListInputParam { - [key : string]: any; + addons?:{billing_cycles?:number,id?:string,quantity?:number,quantity_in_decimal?:string,trial_end?:number,unit_price?:number,unit_price_in_decimal?:string}[]; + /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description Parameters for event_based_addons */ - - limit?:number; + event_based_addons?:{charge_on?:ChargeOn,charge_once?:boolean,id?:string,on_event?:OnEvent,quantity?:number,quantity_in_decimal?:string,service_period_in_days?:number,unit_price?:number,unit_price_in_decimal?:string}[]; + } + export interface CreateForCustomerResponse { + subscription:Subscription; + + customer:Customer; + + card?:Card; + + invoice?:Invoice; + + unbilled_charges?:UnbilledCharge[]; + } + export interface CreateForCustomerInputParam { + [key : string] : any; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description A unique and immutable identifier for the subscription. If not provided, it is autogenerated. */ - - offset?:string; + + id?:string; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description Identifier of the plan for this subscription. */ - - include_deleted?:boolean; + + plan_id:string; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description Plan quantity for this subscription. */ - - id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + + plan_quantity?:number; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description The decimal representation of the quantity of the plan purchased. Can be provided for quantity-based plans and only when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. */ - - customer_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + + plan_quantity_in_decimal?:string; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description Amount that will override the Plan's default price. The unit depends on the [type of currency](/docs/api?prod_cat_ver=1#md_disabled). */ - - item_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + + plan_unit_price?:number; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description When [price overriding](http://chargebee.com/docs/price-override.html )is enabled for the site, the price or per-unit price of the plan can be set here. The value [set for the plan](https://apidocs.chargebee.com/docs/api/plans#plan_price ) is used by default. Provide the value as a decimal string 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. */ - - item_price_id?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + + plan_unit_price_in_decimal?:string; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description Amount that will override the default setup fee. The unit depends on the [type of currency](/docs/api?prod_cat_ver=1#md_disabled). */ - - status?:{in?:string,is?:'in_trial' | 'paused' | 'transferred' | 'future' | 'active' | 'cancelled' | 'non_renewing',is_not?:'in_trial' | 'paused' | 'transferred' | 'future' | 'active' | 'cancelled' | 'non_renewing',not_in?:string}; + + setup_fee?:number; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description The time at which the trial ends for this subscription. Can be specified to override the default trial period.If **'0'** is passed, the subscription will be activated immediately. */ - - 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}; + + trial_end?:number; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description Specifies the number of billing cycles for the subscription. The behavior of the subscription after the billing cycles have completed depends on whether the subscription is on a [contract term](contract_terms?prod_cat_ver=1) or not. + +* When the subscription is not on a contract term: if `billing_cycles` is not provided, then the billing cycles [set for the plan](plans?prod_cat_ver=1&lang=curl#plan_billing_cycles) is used. Moreover, once the `billing_cycles` have completed, the subscription cancels. +* When the subscription is on a contract term: Providing `billing_cycles` is mandatory. Moreover, once the `billing_cycles` have completed, the behavior of the subscription is determined by the `contract_term[action_at_term_end]` parameter. */ - - cancel_reason_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + + billing_cycles?:number; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description List of addons IDs that are mandatory to the plan and has to be removed from the subscription. */ - - remaining_billing_cycles?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,is_present?:'true' | 'false',lt?:string,lte?:string}; + + mandatory_addons_to_remove?:string[]; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @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. +. */ - - created_at?:{after?:string,before?:string,between?:string,on?:string}; + + start_date?:number; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @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. */ - - activated_at?:{after?:string,before?:string,between?:string,is_present?:'true' | 'false',on?:string}; + + auto_collection?:AutoCollection; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description The number of subscription billing cycles (including the first one) to [invoice in advance](https://www.chargebee.com/docs/advance-invoices.html). */ - - next_billing_at?:{after?:string,before?:string,between?:string,on?:string}; + + terms_to_charge?:number; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @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. */ - - cancelled_at?:{after?:string,before?:string,between?:string,on?:string}; + + billing_alignment_mode?:BillingAlignmentMode; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description The preferred offline payment method for the subscription. \* sepa_credit - SEPA Credit \* cash - Cash \* no_preference - No Preference \* bank_transfer - Bank Transfer \* boleto - Boleto \* check - Check \* ach_credit - ACH Credit */ - - has_scheduled_changes?:{is?:'true' | 'false'}; + + offline_payment_method?:OfflinePaymentMethod; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description Purchase order number for this subscription. */ - - updated_at?:{after?:string,before?:string,between?:string,on?:string}; + + po_number?:string; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. */ - - offline_payment_method?:{in?:string,is?:'eu_automated_bank_transfer' | 'bank_transfer' | 'mx_automated_bank_transfer' | 'custom' | 'ach_credit' | 'boleto' | 'check' | 'uk_automated_bank_transfer' | 'no_preference' | 'us_automated_bank_transfer' | 'jp_automated_bank_transfer' | 'sepa_credit' | 'cash',is_not?:'eu_automated_bank_transfer' | 'bank_transfer' | 'mx_automated_bank_transfer' | 'custom' | 'ach_credit' | 'boleto' | 'check' | 'uk_automated_bank_transfer' | 'no_preference' | 'us_automated_bank_transfer' | 'jp_automated_bank_transfer' | 'sepa_credit' | 'cash',not_in?:string}; + + coupon_ids?:string[]; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description Id of the payment source to be attached to this subscription. */ - - auto_close_invoices?:{is?:'true' | 'false'}; + + payment_source_id?:string; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @description If `true`, ignores the [hierarchy relationship](./customers?prod_cat_ver=2#customer_relationship) and uses customer as payment and invoice owner. */ - - override_relationship?:{is?:'true' | 'false'}; + + override_relationship?:boolean; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @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. */ - - sort_by?:{asc?:'updated_at' | 'created_at',desc?:'updated_at' | 'created_at'}; + + invoice_notes?:string; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @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: + +* `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. +. */ - - business_entity_id?:{is?:string,is_not?:string,starts_with?:string}; + + invoice_date?:number; /** - * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + * @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=1#metadata). */ - - channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string}; - } - export interface ContractTermsForSubscriptionResponse { + + meta_data?:object; + /** - * @description Retrieves a list of contract term resources for the subscription specified in the path. + * @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. . */ - list:{contract_term:ContractTerm}[]; + invoice_immediately?:boolean; /** - * @description Retrieves a list of contract term resources for the subscription specified in the path. + * @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. */ - next_offset?:string; - } - export interface ContractTermsForSubscriptionInputParam { - [key : string]: any; + replace_primary_payment_source?:boolean; + /** - * @description Retrieves a list of contract term resources for the subscription specified in the path. + * @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. */ - - limit?:number; + + free_period?:number; /** - * @description Retrieves a list of contract term resources for the subscription specified in the path. + * @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) */ - - offset?:string; - } - export interface ListDiscountsResponse { + + free_period_unit?:FreePeriodUnit; + /** - * @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 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). */ - list:{discount:Discount}[]; + contract_term_billing_cycle_on_renewal?:number; /** - * @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 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. */ - next_offset?:string; - } - export interface ListDiscountsInputParam { - [key : string]: any; + trial_end_action?:TrialEndAction; + /** - * @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 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 */ - - limit?:number; + + payment_initiator?:PaymentInitiator; /** - * @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 Parameters for shipping_address */ - - offset?:string; - } - export interface RetrieveResponse { - subscription:Subscription; - customer: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}; - card?:Card; - } - - export interface RetrieveWithScheduledChangesResponse { - subscription:Subscription; + /** + * @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. + +Creates a new subscription for an existing customer. You can attach a plan, plan quantity, one or more addons and coupon while creating this subscription. + +If the plan does not have a trial period and if any of the recurring-item has charges, then the customer is charged immediately if auto_collection is turned 'on'. In that case, subscription is created only if the customer has a payment method on file and attempted payment is successful. + + */ - customer:Customer; + statement_descriptor?:{additional_info?:string,descriptor?:string}; - card?:Card; - } - - export interface RemoveScheduledChangesResponse { - subscription:Subscription; + /** + * @description Parameters for payment_intent + + */ - customer:Customer; + 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' | 'klarna_pay_now' | 'dotpay' | 'boleto' | 'direct_debit' | 'faster_payments' | 'sofort' | 'upi' | 'venmo' | 'amazon_payments' | 'apple_pay' | 'bancontact' | 'paypal_express_checkout' | 'pay_to' | 'card',reference_id?:string}; - card?:Card; + /** + * @description Parameters for contract_term + + */ - credit_notes?:CreditNote[]; + contract_term?:{action_at_term_end?:'cancel' | 'renew' | 'evergreen',cancellation_cutoff_period?:number}; + + /** + * @description Parameters for addons + + */ + + addons?:{billing_cycles?:number,id?:string,quantity?:number,quantity_in_decimal?:string,trial_end?:number,unit_price?:number,unit_price_in_decimal?:string}[]; + + /** + * @description Parameters for event_based_addons + + */ + + event_based_addons?:{charge_on?:ChargeOn,charge_once?:boolean,id?:string,on_event?:OnEvent,quantity?:number,quantity_in_decimal?:string,service_period_in_days?:number,unit_price?:number,unit_price_in_decimal?:string}[]; } - - export interface RemoveScheduledCancellationResponse { + export interface CreateWithItemsResponse { subscription:Subscription; customer:Customer; card?:Card; + + invoice?:Invoice; + + unbilled_charges?:UnbilledCharge[]; } - export interface RemoveScheduledCancellationInputParam { + export interface CreateWithItemsInputParam { + [key : string] : any; + /** + * @description A unique and immutable identifier for the subscription. If not provided, it is autogenerated. + + */ + + id?:string; /** - * @description Number of cycles(plan interval) this subscription should be charged. After the billing cycles exhausted, the subscription will be cancelled. + * @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. + + */ + + trial_end?: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. */ billing_cycles?:number; - } - export interface RemoveCouponsResponse { - subscription:Subscription; - customer:Customer; + /** + * @description Item ids of [mandatorily attached addons](./attached_items?prod_cat_ver=2) that are to be removed from the subscription. + + */ - card?:Card; - } - export interface RemoveCouponsInputParam { + 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. + +* 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. +. + + */ + + 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. +. + + */ + + 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. + + */ + + 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). + + */ + + 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 Purchase order number for this subscription. + + */ + + po_number?:string; /** * @description List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. @@ -1332,6 +1502,879 @@ Creates a new subscription for an existing customer in Chargebee. Any available */ coupon_ids?:string[]; + + /** + * @description Id of the payment source to be attached to this subscription. + + */ + + payment_source_id?:string; + + /** + * @description If `true`, ignores the [hierarchy relationship](./customers?prod_cat_ver=2#customer_relationship) and uses customer as payment and invoice owner. + + */ + + override_relationship?:boolean; + + /** + * @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_notes?: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 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: + +* `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_date?:number; + + /** + * @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). + + */ + + meta_data?:object; + + /** + * @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; + + /** + * @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. + + */ + + replace_primary_payment_source?: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. + + */ + + 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 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 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. + +You can also set this to `true` explicitly using the [create](/docs/api/subscriptions#create_subscription_for_items_create_pending_invoices)/[update](/docs/api/subscriptions#update_subscription_for_items_create_pending_invoices) subscription operations. This is useful in the following scenarios: + +* When tracking usages and calculating usage-based charges on your end. You can then add them to the subscription as a [one-time charge](https://www.chargebee.com/docs/charges.html) at the end of the billing term. +* When you need to inspect all charges before closing invoices for this subscription. + +Applicable only when [Metered Billing](https://www.chargebee.com/docs/metered_billing.html) is enabled for the site +. + + */ + + create_pending_invoices?:boolean; + + /** + * @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). + + */ + + 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. + + */ + + 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 + + */ + + payment_initiator?:PaymentInitiator; + + /** + * @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 **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. + + */ + + 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' | 'klarna_pay_now' | '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' | '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,included_in_mrr?:boolean,item_price_id?:string,percentage?:number,period?:number,period_unit?:PeriodUnit}[]; + + /** + * @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}[]; + } + 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}[]; + + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + next_offset?:string; + } + export interface ListInputParam { + [key : string]: any; + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + limit?:number; + + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + offset?:string; + + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + include_deleted?:boolean; + + /** + * @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}; + + /** + * @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}; + + /** + * @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}; + + /** + * @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}; + + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + status?:{in?:string,is?:'in_trial' | 'paused' | 'transferred' | 'future' | 'active' | 'cancelled' | 'non_renewing',is_not?:'in_trial' | 'paused' | 'transferred' | 'future' | 'active' | 'cancelled' | 'non_renewing',not_in?:string}; + + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + 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 Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + cancel_reason_code?:{in?:string,is?:string,is_not?:string,not_in?:string,starts_with?:string}; + + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + remaining_billing_cycles?:{between?:string,gt?:string,gte?:string,is?:string,is_not?:string,is_present?:'true' | 'false',lt?:string,lte?:string}; + + /** + * @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}; + + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + 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}; + + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + cancelled_at?:{after?:string,before?:string,between?:string,on?:string}; + + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + has_scheduled_changes?:{is?:'true' | 'false'}; + + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + updated_at?:{after?:string,before?:string,between?:string,on?:string}; + + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + offline_payment_method?:{in?:string,is?:'eu_automated_bank_transfer' | 'bank_transfer' | 'mx_automated_bank_transfer' | 'custom' | 'ach_credit' | 'boleto' | 'check' | 'uk_automated_bank_transfer' | 'no_preference' | 'us_automated_bank_transfer' | 'jp_automated_bank_transfer' | 'sepa_credit' | 'cash',is_not?:'eu_automated_bank_transfer' | 'bank_transfer' | 'mx_automated_bank_transfer' | 'custom' | 'ach_credit' | 'boleto' | 'check' | 'uk_automated_bank_transfer' | 'no_preference' | 'us_automated_bank_transfer' | 'jp_automated_bank_transfer' | 'sepa_credit' | 'cash',not_in?:string}; + + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + auto_close_invoices?:{is?:'true' | 'false'}; + + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + override_relationship?:{is?:'true' | 'false'}; + + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + sort_by?:{asc?:'updated_at' | 'created_at',desc?:'updated_at' | 'created_at'}; + + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + business_entity_id?:{is?:string,is_not?:string,starts_with?:string}; + + /** + * @description Returns a list of subscriptions meeting **all** the conditions specified in the filter parameters below. + + */ + + channel?:{in?:string,is?:'app_store' | 'web' | 'play_store',is_not?:'app_store' | 'web' | 'play_store',not_in?:string}; + } + export interface ContractTermsForSubscriptionResponse { + /** + * @description Retrieves a list of contract term resources for the subscription specified in the path. + + */ + + list:{contract_term:ContractTerm}[]; + + /** + * @description Retrieves a list of contract term resources for the subscription specified in the path. + + */ + + next_offset?:string; + } + export interface ContractTermsForSubscriptionInputParam { + [key : string]: any; + /** + * @description Retrieves a list of contract term resources for the subscription specified in the path. + + */ + + limit?:number; + + /** + * @description Retrieves a list of contract term resources for the subscription specified in the path. + + */ + + offset?:string; + } + export interface ListDiscountsResponse { + /** + * @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. + + */ + + list:{discount:Discount}[]; + + /** + * @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_offset?:string; + } + export interface ListDiscountsInputParam { + [key : string]: any; + /** + * @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. + + */ + + limit?:number; + + /** + * @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. + + */ + + 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 Number of cycles(plan interval) this subscription should be charged. After the billing cycles exhausted, the subscription will be cancelled. + + */ + + billing_cycles?:number; + } + export interface RemoveCouponsResponse { + subscription:Subscription; + + customer:Customer; + + card?:Card; + } + export interface RemoveCouponsInputParam { + + /** + * @description List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes. + + */ + + coupon_ids?:string[]; + } + export interface UpdateResponse { + subscription:Subscription; + + customer:Customer; + + card?:Card; + + invoice?:Invoice; + + unbilled_charges?:UnbilledCharge[]; + + credit_notes?:CreditNote[]; + } + export interface UpdateInputParam { + [key : string] : any; + /** + * @description Identifier of the plan for this subscription. + + */ + + plan_id?:string; + + /** + * @description Represents the plan quantity for this subscription. + + */ + + plan_quantity?:number; + + /** + * @description Amount that will override the plan's default price. The unit depends on the [type of currency](/docs/api#md_disabled). If `changes_scheduled_at` is in the past and a `plan_unit_price` is not passed, then the plan's current unit price is considered even if the plan did not exist on the date as of when the change is scheduled. + + */ + + plan_unit_price?:number; + + /** + * @description Amount that will override the default setup fee. The unit depends on the [type of currency](/docs/api?prod_cat_ver=1#md_disabled). + + */ + + setup_fee?:number; + + /** + * @description Should be true if the existing addons should be replaced with the ones that are being passed. + + */ + + replace_addon_list?:boolean; + + /** + * @description List of addons IDs that are mandatory to the plan and has to be removed from the subscription. + + */ + + mandatory_addons_to_remove?:string[]; + + /** + * @description The decimal representation of the quantity of the plan purchased. Can be provided for quantity-based plans and only when [multi-decimal pricing](https://apidocs.chargebee.com/docs/api#handling_currency_units ) is enabled. + + */ + + plan_quantity_in_decimal?:string; + + /** + * @description When [price overriding](https://www.chargebee.com/docs/price-override.html) is enabled for the site, the price or per-unit price of the item can be set here. The [value set for the item price](/docs/api/item_prices#item_price_price) is used by default. Provide the value as a decimal string in major units of the currency. Can be provided only when [multi-decimal pricing](/docs/api#handling_currency_units) is enabled. If `changes_scheduled_at` is in the past and a `unit_price_in_decimal` 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. + + */ + + plan_unit_price_in_decimal?: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 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`. +. + + */ + + invoice_date?:number; + + /** + * @description The new start date of a `future` subscription. Applicable only for `future` subscriptions. + + */ + + start_date?:number; + + /** + * @description The time at which the trial has ended or will end for the subscription. Set it to `0` to have no trial period. +**Note** + +* This is only allowed when the subscription `status` is `future`, `in_trial`, or `cancelled`. +* The value must not be earlier than `changes_scheduled_at` or `start_date`. +* 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. + + */ + + trial_end?:number; + + /** + * @description The number of billing cycles the subscription runs before canceling. If not provided, then the billing cycles set for the plan 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. + + */ + + terms_to_charge?:number; + + /** + * @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: + +* 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. +. + + */ + + 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. + + */ + + 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. + + */ + + 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. + + */ + + po_number?: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). 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. + + */ + + coupon_ids?:string[]; + + /** + * @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`. + + */ + + replace_coupon_list?:boolean; + + /** + * @description * When `true`: [Prorated credits or charges](https://www.chargebee.com/docs/1.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/1.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 plan, its addons, or the prices of the plan or addons. + + */ + + prorate?:boolean; + + /** + * @description Set this to true if you want the update to be applied at the end of the current subscription billing cycle. + + */ + + end_of_term?:boolean; + + /** + * @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. + + */ + + force_term_reset?: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 `plan_id` or `addons[id]` + + */ + + reactivate?:boolean; + + /** + * @description The Chargebee payment token generated by Chargebee JS. + + */ + + 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_notes?:string; + + /** + * @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=1#metadata). + + */ + + meta_data?:object; + + /** + * @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; + + /** + * @description If `true`, ignores the [hierarchy relationship](./customers?prod_cat_ver=2#customer_relationship) and uses customer as payment and invoice owner. + + */ + + override_relationship?: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. +. + + */ + + changes_scheduled_at?: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. + + */ + + change_option?:ChangeOption; + + /** + * @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 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 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. + + */ + + trial_end_action?:TrialEndAction; + + /** + * @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' | 'klarna_pay_now' | '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 + + */ + + 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 **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. + +You can modify the plan, plan quantity and add or remove addons for the subscription. By default the changes are applied immediately and the charges (/credits) are prorated and adjusted with the next billing term. You may also choose to effect the changes at the end of the current term by passing **end_of_term** as "true". In this case proration will not be done. + +Only the parameters that are passed are modified for the subscription. Rest will reflect the existing values. + +By default, the addons passed are appended to the existing list of addons for this subscription. In case a passed addon already exists for this subscription, quantity value is replaced. If you want to completely replace the addons for this subscription, pass **replace_addon_list** as "true". + +[Card](/docs/api/cards#card_attributes) and 'vat_number' attributes can also be passed during subscription update. If they are passed, corresponding Billing Info attributes - the [Billing Address](/docs/api/customers#billing_address_attributes) and 'vat_number' - will be replaced automatically. + +Passing credit card details to this API involves PCI liability at your end as sensitive card info passes through your servers. If you wish to avoid that, you can use one of the following integration methodologies if applicable + +* If you are using Stripe gateway, you can use [Stripe.js](https://stripe.com/docs/stripe.js) with your checkout form. Take a look at this [Stripe tutorial](https://stripe.com/docs/payments/accept-a-payment-charges) for more details. +* If you are using Braintree gateway, you can use [Braintree.js](https://www.braintreepayments.com/docs/javascript) with your checkout form. Please refer this [tutorial](https://www.chargebee.com/tutorials/braintree-js-example.html) for more details. +* If you are using Authorize.Net gateway, you use [Accept.js](https://developer.authorize.net/api/reference/features/acceptjs.html) with your checkout form. +* 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/hosted_pages.html) based integration. + + + + + */ + + statement_descriptor?:{additional_info?:string,descriptor?:string}; + + /** + * @description Parameters for customer + + */ + + 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 contract_term + + */ + + contract_term?:{action_at_term_end?:'cancel' | 'renew_once' | 'renew' | 'evergreen',cancellation_cutoff_period?:number}; + + /** + * @description Parameters for addons + + */ + + addons?:{billing_cycles?:number,id?:string,proration_type?:ProrationType,quantity?:number,quantity_in_decimal?:string,trial_end?:number,unit_price?:number,unit_price_in_decimal?:string}[]; + + /** + * @description Parameters for event_based_addons + + */ + + event_based_addons?:{charge_on?:ChargeOn,charge_once?:boolean,id?:string,on_event?:OnEvent,quantity?:number,quantity_in_decimal?:string,service_period_in_days?:number,unit_price?:number,unit_price_in_decimal?:string}[]; } export interface UpdateForItemsResponse { subscription:Subscription; @@ -1653,7 +2696,7 @@ Applicable only when [Metered Billing](https://www.chargebee.com/docs/metered_bi */ - 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}; + 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' | 'klarna_pay_now' | '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 @@ -1878,7 +2921,7 @@ When dunning (payment failure retry settings) is configured with the last retry */ - 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}; + 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' | 'klarna_pay_now' | '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; @@ -2660,7 +3703,7 @@ For non-renewing subscriptions,`resume_date` should be before the canc */ - 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}; + 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' | 'klarna_pay_now' | '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; diff --git a/types/resources/Transaction.d.ts b/types/resources/Transaction.d.ts index 7fc9b2b..05ff229 100644 --- a/types/resources/Transaction.d.ts +++ b/types/resources/Transaction.d.ts @@ -546,7 +546,7 @@ declare module 'chargebee' { */ - payment_method?:{in?:string,is?:'other' | 'netbanking_emandates' | 'ach_credit' | 'dotpay' | 'boleto' | 'direct_debit' | 'automated_bank_transfer' | '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' | 'automated_bank_transfer' | '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_method?:{in?:string,is?:'other' | 'netbanking_emandates' | 'klarna_pay_now' | 'ach_credit' | 'dotpay' | 'boleto' | 'direct_debit' | 'automated_bank_transfer' | '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' | 'automated_bank_transfer' | '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 Lists all the transactions.