POST /subscriptions/{subscription-id}/charge_future_renewals
Creates a single advance invoice or an advance invoicing schedule for a subscription.
Use this operation to bill future renewals in advance, enabling customers to prepay for upcoming billing cycles.
Prerequisites & Constraints
- The Advance Invoicing feature must be enabled on the site.
- The subscription
statusmust beactive. - The subscription must not be scheduled for cancellation or pause within the terms being invoiced.
- The subscription must have at least one item price belonging to a non-
metereditem. - The Multi-Frequency Billing feature must be disabled for the site.
- The subscription must not be a gift subscription. You can check this by listing all gifts setting the filter parameter
gift_receiver[customer_id][is]to thecustomer_idof the subscription and checking if one of the returned objects hasgift_receiver.subscription_idmatching theidof the subscription. - For subscriptions with ramps, the following constraints apply:
- The subscription must not have more than 12 scheduled ramps in the invoicing period specified by this API.
- For the invoicing period specified by this API, the subscription must not have any ramps scheduled for the middle of the subscription term.
- The subscription must not be in its final contract term. i.e. the subscription must not have
contract_term.action_at_term_endset tocancel. - The subscription must not have addons in trial.
Impacts
- The subscription
next_billing_atis updated to reflect the end of the last term being invoiced. If all remaining billing cycles are invoiced,next_billing_atis set tonull. - The subscription's
remaining_billing_cyclesis reduced by the number of terms charged.
- When
schedule_typeisimmediateandinvoice_immediately = true:- a single advance invoice is created covering the specified number of future billing cycles.
- the invoice includes line items for all non-metered items, applicable coupons, taxes, and credits.
- any changes scheduled in the current term or at the end of the current term for the subscription are automatically taken into account while generating the advance invoice.
- if
auto_collectionisonfor the subscription, the payment for the invoice is collected immediately using the payment source associated with the subscription.
- When
schedule_typeisimmediateandinvoice_immediatelyisfalse: The charges are added tounbilled_chargesfor the subscription and invoiced on the next renewal.
- When
schedule_typeisspecific_datesorfixed_intervals:- an advance invoice schedule is created. The schedule defines when advance invoices will be generated in the future.
- any changes scheduled for the subscription are automatically taken into account while generating the advance invoice.
Servers
- {protocol}://{site}.{environment}:{port}/api/v2
- {protocol}://{site}-test.{environment}:{port}/api/v2
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
subscription-id |
String | Yes |
Request headers
| Name | Type | Required | Description |
|---|---|---|---|
chargebee-request-origin-device |
String | No |
The device from which the customer has made the request |
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/x-www-form-urlencoded" |
chargebee-event-webhook |
String | No |
skip only webhooks Valid values:
|
chargebee-business-entity-id |
String | No |
If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
chargebee-event-actions |
String | No |
skip all actions to be done on the events Valid values:
|
chargebee-request-origin-user |
String | No |
The email address of your customer/user. Use this when the email address has only ASCII characters. |
chargebee-request-origin-ip |
String | No |
The IP address of the customer where the request originated |
chargebee-request-origin-user-encoded |
String | No |
The Base64-encoded email address of your customer/user. Use this if the email address has UTF-8 characters. When this header is provided, the header chargebee-request-origin-user is ignored. |
chargebee-event-email |
String | No |
skip only emails Valid values:
|
Request body fields
| Name | Type | Required | Description |
|---|---|---|---|
fixed_interval_schedule |
Object | No |
Parameters for fixed_interval_schedule. Required if
Constraint
|
fixed_interval_schedule.end_date |
Integer | No |
The date when the advance invoicing schedule ends. Advance invoices are not generated beyond this date. Constraints
|
fixed_interval_schedule.days_before_renewal |
Integer | No |
The number of days before each interval that advance invoices are generated. Constraints
|
fixed_interval_schedule.number_of_occurrences |
Integer | No |
The number of advance invoices to generate. Required if
Impact
|
fixed_interval_schedule.end_schedule_on |
String | No |
Specifies when the advance invoicing schedule ends. * after_number_of_intervals -Advance invoices are generated a specified number of times. Constraint
Advance invoices are generated for as long as the subscription is active. * specific_date -The advance invoicing schedule ends on a specific date. Constraint
Valid values:
|
invoice_immediately |
Boolean | No |
Whether the charge should be invoiced immediately or added to Prerequisite
Constraints
Default value
|
specific_dates_schedule |
Object | No |
Parameters for specific_dates_schedule. Required if
Constraints
|
specific_dates_schedule.terms_to_charge[] |
Array | No |
The number of billing cycles to charge for on the specified date. Constraints
Default value
|
specific_dates_schedule.date[] |
Array | No |
The date on which the advance invoice should be generated. This is the scheduled date for generating the invoice for the specified number of billing cycles. Constraints
|
schedule_type |
String | No |
The type of advance invoice or advance invoicing schedule. Default value
Bill immediately for the number of billing cycles specified by Prerequisite
Invoice on specific dates. Prerequisite
Constraints
Invoice at fixed intervals of time. Prerequisite
Constraints
Valid values:
|
terms_to_charge |
Integer | No |
The number of billing cycles to charge, depending on the
Constraints
Default value
Default value: 1 |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.