POST /v1/invoices/create_preview
At any time, you can preview the upcoming invoice for a subscription or subscription schedule. This will show you all the charges that are pending, including subscription renewal charges, invoice item charges, etc. It will also show you any discounts that are applicable to the invoice.
You can also preview the effects of creating or updating a subscription or subscription schedule, including a preview of any prorations that will take place. To ensure that the actual proration is calculated exactly the same as the previewed proration, you should pass the subscription_details.proration_date
parameter when doing the actual subscription update.
The recommended way to get only the prorations being previewed on the invoice is to consider line items where parent.subscription_item_details.proration
is true
.
Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the invoice has not yet been created. As such, the upcoming invoice will not show up in invoice listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the amount that your customer will be billed, you can add, remove, or update pending invoice items, or update the customer’s discount.
Note: Currency conversion calculations use the latest exchange rates. Exchange rates may vary between the time of the preview and the time of the actual invoice creation. Learn more
Servers
- https://api.stripe.com/
Request headers
Name | Type | Required | Description |
---|---|---|---|
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/x-www-form-urlencoded" |
Request body fields
Name | Type | Required | Description |
---|---|---|---|
discounts |
No |
The coupons to redeem into discounts for the invoice preview. If not specified, inherits the discount from the subscription or customer. This works for both coupons directly applied to an invoice and coupons applied to a subscription. Pass an empty string to avoid inheriting any discounts. |
|
subscription_details |
Object | No |
The subscription creation or modification params to apply as a preview. Cannot be used with |
subscription_details.cancel_now |
Boolean | No | |
subscription_details.proration_date |
Integer | No | |
subscription_details.start_date |
Integer | No | |
subscription_details.default_tax_rates |
No | ||
subscription_details.items[] |
Array | No | |
subscription_details.items[].id |
String | No | |
subscription_details.items[].discounts |
No | ||
subscription_details.items[].price |
String | No | |
subscription_details.items[].clear_usage |
Boolean | No | |
subscription_details.items[].deleted |
Boolean | No | |
subscription_details.items[].tax_rates |
No | ||
subscription_details.items[].billing_thresholds |
No | ||
subscription_details.items[].price_data |
Object | No | |
subscription_details.items[].price_data.unit_amount |
Integer | No | |
subscription_details.items[].price_data.unit_amount_decimal |
String | No | |
subscription_details.items[].price_data.product |
String | Yes | |
subscription_details.items[].price_data.recurring |
Object | Yes | |
subscription_details.items[].price_data.recurring.interval |
String | Yes |
Possible values:
|
subscription_details.items[].price_data.recurring.interval_count |
Integer | No | |
subscription_details.items[].price_data.tax_behavior |
String | No |
Possible values:
|
subscription_details.items[].price_data.currency |
String | Yes | |
subscription_details.items[].quantity |
Integer | No | |
subscription_details.items[].metadata |
No | ||
subscription_details.cancel_at_period_end |
Boolean | No | |
subscription_details.resume_at |
String | No |
Possible values:
|
subscription_details.cancel_at |
No | ||
subscription_details.billing_cycle_anchor |
No | ||
subscription_details.proration_behavior |
String | No |
Possible values:
|
subscription_details.trial_end |
No | ||
subscription_details.billing_mode |
Object | No | |
subscription_details.billing_mode.type |
String | Yes |
Possible values:
|
subscription |
String | No |
The identifier of the subscription for which you'd like to retrieve the upcoming invoice. If not provided, but a |
customer_details |
Object | No |
Details about the customer you want to invoice or overrides for an existing customer. If |
customer_details.tax |
Object | No | |
customer_details.tax.ip_address |
No | ||
customer_details.shipping |
No | ||
customer_details.tax_ids[] |
Array | No | |
customer_details.tax_ids[].type |
String | Yes |
Possible values:
|
customer_details.tax_ids[].value |
String | Yes | |
customer_details.address |
No | ||
customer_details.tax_exempt |
String | No |
Possible values:
|
expand[] |
Array | No |
Specifies which fields in the response should be expanded. |
automatic_tax |
Object | No |
Settings for automatic tax lookup for this invoice preview. |
automatic_tax.enabled |
Boolean | Yes | |
automatic_tax.liability |
Object | No | |
automatic_tax.liability.account |
String | No | |
automatic_tax.liability.type |
String | Yes |
Possible values:
|
invoice_items[] |
Array | No |
List of invoice items to add or update in the upcoming invoice preview (up to 250). |
invoice_items[].discounts |
No | ||
invoice_items[].price |
String | No | |
invoice_items[].description |
String | No | |
invoice_items[].tax_rates |
No | ||
invoice_items[].tax_code |
No | ||
invoice_items[].quantity |
Integer | No | |
invoice_items[].metadata |
No | ||
invoice_items[].currency |
String | No | |
invoice_items[].unit_amount |
Integer | No | |
invoice_items[].period |
Object | No | |
invoice_items[].period.end |
Integer | Yes | |
invoice_items[].period.start |
Integer | Yes | |
invoice_items[].unit_amount_decimal |
String | No | |
invoice_items[].amount |
Integer | No | |
invoice_items[].discountable |
Boolean | No | |
invoice_items[].price_data |
Object | No | |
invoice_items[].price_data.unit_amount |
Integer | No | |
invoice_items[].price_data.unit_amount_decimal |
String | No | |
invoice_items[].price_data.product |
String | Yes | |
invoice_items[].price_data.tax_behavior |
String | No |
Possible values:
|
invoice_items[].price_data.currency |
String | Yes | |
invoice_items[].tax_behavior |
String | No |
Possible values:
|
invoice_items[].invoiceitem |
String | No | |
schedule |
String | No |
The identifier of the schedule whose upcoming invoice you'd like to retrieve. Cannot be used with subscription or subscription fields. |
preview_mode |
String | No |
Customizes the types of values to include when calculating the invoice. Defaults to Possible values:
|
currency |
String | No |
The currency to preview this invoice in. Defaults to that of |
on_behalf_of |
No |
The account (if any) for which the funds of the invoice payment are intended. If set, the invoice will be presented with the branding and support information of the specified account. See the Invoices with Connect documentation for details. |
|
customer |
String | No |
The identifier of the customer whose upcoming invoice you'd like to retrieve. If |
schedule_details |
Object | No |
The schedule creation or modification params to apply as a preview. Cannot be used with |
schedule_details.end_behavior |
String | No |
Possible values:
|
schedule_details.phases[] |
Array | No | |
schedule_details.phases[].add_invoice_items[] |
Array | No | |
schedule_details.phases[].add_invoice_items[].discounts[] |
Array | No | |
schedule_details.phases[].add_invoice_items[].discounts[].promotion_code |
String | No | |
schedule_details.phases[].add_invoice_items[].discounts[].coupon |
String | No | |
schedule_details.phases[].add_invoice_items[].discounts[].discount |
String | No | |
schedule_details.phases[].add_invoice_items[].price |
String | No | |
schedule_details.phases[].add_invoice_items[].tax_rates |
No | ||
schedule_details.phases[].add_invoice_items[].price_data |
Object | No | |
schedule_details.phases[].add_invoice_items[].price_data.unit_amount |
Integer | No | |
schedule_details.phases[].add_invoice_items[].price_data.unit_amount_decimal |
String | No | |
schedule_details.phases[].add_invoice_items[].price_data.product |
String | Yes | |
schedule_details.phases[].add_invoice_items[].price_data.tax_behavior |
String | No |
Possible values:
|
schedule_details.phases[].add_invoice_items[].price_data.currency |
String | Yes | |
schedule_details.phases[].add_invoice_items[].quantity |
Integer | No | |
schedule_details.phases[].application_fee_percent |
Number | No | |
schedule_details.phases[].discounts |
No | ||
schedule_details.phases[].description |
No | ||
schedule_details.phases[].automatic_tax |
Object | No | |
schedule_details.phases[].automatic_tax.enabled |
Boolean | Yes | |
schedule_details.phases[].automatic_tax.liability |
Object | No | |
schedule_details.phases[].automatic_tax.liability.account |
String | No | |
schedule_details.phases[].automatic_tax.liability.type |
String | Yes |
Possible values:
|
schedule_details.phases[].items[] |
Array | Yes | |
schedule_details.phases[].items[].discounts |
No | ||
schedule_details.phases[].items[].price |
String | No | |
schedule_details.phases[].items[].tax_rates |
No | ||
schedule_details.phases[].items[].billing_thresholds |
No | ||
schedule_details.phases[].items[].price_data |
Object | No | |
schedule_details.phases[].items[].price_data.unit_amount |
Integer | No | |
schedule_details.phases[].items[].price_data.unit_amount_decimal |
String | No | |
schedule_details.phases[].items[].price_data.product |
String | Yes | |
schedule_details.phases[].items[].price_data.recurring |
Object | Yes | |
schedule_details.phases[].items[].price_data.recurring.interval |
String | Yes |
Possible values:
|
schedule_details.phases[].items[].price_data.recurring.interval_count |
Integer | No | |
schedule_details.phases[].items[].price_data.tax_behavior |
String | No |
Possible values:
|
schedule_details.phases[].items[].price_data.currency |
String | Yes | |
schedule_details.phases[].items[].quantity |
Integer | No | |
schedule_details.phases[].items[].metadata |
Object | No | |
schedule_details.phases[].metadata |
Object | No | |
schedule_details.phases[].proration_behavior |
String | No |
Possible values:
|
schedule_details.phases[].collection_method |
String | No |
Possible values:
|
schedule_details.phases[].on_behalf_of |
String | No | |
schedule_details.phases[].default_payment_method |
String | No | |
schedule_details.phases[].iterations |
Integer | No | |
schedule_details.phases[].trial |
Boolean | No | |
schedule_details.phases[].start_date |
No | ||
schedule_details.phases[].default_tax_rates |
No | ||
schedule_details.phases[].end_date |
No | ||
schedule_details.phases[].billing_thresholds |
No | ||
schedule_details.phases[].billing_cycle_anchor |
String | No |
Possible values:
|
schedule_details.phases[].trial_end |
No | ||
schedule_details.phases[].transfer_data |
Object | No | |
schedule_details.phases[].transfer_data.destination |
String | Yes | |
schedule_details.phases[].transfer_data.amount_percent |
Number | No | |
schedule_details.phases[].invoice_settings |
Object | No | |
schedule_details.phases[].invoice_settings.days_until_due |
Integer | No | |
schedule_details.phases[].invoice_settings.account_tax_ids |
No | ||
schedule_details.phases[].invoice_settings.issuer |
Object | No | |
schedule_details.phases[].invoice_settings.issuer.account |
String | No | |
schedule_details.phases[].invoice_settings.issuer.type |
String | Yes |
Possible values:
|
schedule_details.proration_behavior |
String | No |
Possible values:
|
schedule_details.billing_mode |
Object | No | |
schedule_details.billing_mode.type |
String | Yes |
Possible values:
|
issuer |
Object | No |
The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account. |
issuer.account |
String | No | |
issuer.type |
String | Yes |
Possible values:
|
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.