Invoices
post/v1/invoices/create_preview

Create a preview invoice

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

Request body

FieldTypeDescription
automatic_taxobject

Settings for automatic tax lookup for this invoice preview.

2 nested fields
FieldTypeDescription
enabled*boolean
liabilityobject
2 nested fields
FieldTypeDescription
accountstring
type*string
currencystring (currency)

The currency to preview this invoice in. Defaults to that of customer if not specified.

customerstring

The identifier of the customer whose upcoming invoice you're retrieving. If automatic_tax is enabled then one of customer, customer_details, subscription, or schedule must be set.

customer_accountstring

The identifier of the account representing the customer whose upcoming invoice you're retrieving. If automatic_tax is enabled then one of customer, customer_account, customer_details, subscription, or schedule must be set.

customer_detailsobject

Details about the customer you want to invoice or overrides for an existing customer. If automatic_tax is enabled then one of customer, customer_details, subscription, or schedule must be set.

5 nested fields
FieldTypeDescription
addressobject | string
shippingobject | string
taxobject
1 nested field
FieldTypeDescription
ip_addressstring | string
tax_exemptstring
tax_idsarray<object>
array item fields
FieldTypeDescription
type*string
value*string
discountsarray<object> | string

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.

expandarray<string>

Specifies which fields in the response should be expanded.

invoice_itemsarray<object>

List of invoice items to add or update in the upcoming invoice preview (up to 250).

array item fields
FieldTypeDescription
amountinteger
currencystring (currency)
descriptionstring
discountableboolean
discountsarray<object> | string
invoiceitemstring
metadataobject | string
periodobject
2 nested fields
FieldTypeDescription
end*integer (unix-time)
start*integer (unix-time)
pricestring
price_dataobject
5 nested fields
FieldTypeDescription
currency*string (currency)
product*string
tax_behaviorstring
unit_amountinteger
unit_amount_decimalstring (decimal)
quantityinteger
quantity_decimalstring (decimal)
tax_behaviorstring
tax_codestring | string
tax_ratesarray<string> | string
unit_amountinteger
unit_amount_decimalstring (decimal)
issuerobject

The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.

2 nested fields
FieldTypeDescription
accountstring
type*string
on_behalf_ofstring | string

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.

preview_modestring

Customizes the types of values to include when calculating the invoice. Defaults to next if unspecified.

schedulestring

The identifier of the schedule whose upcoming invoice you'd like to retrieve. Cannot be used with subscription or subscription fields.

schedule_detailsobject

The schedule creation or modification params to apply as a preview. Cannot be used with subscription or subscription_ prefixed fields.

4 nested fields
FieldTypeDescription
billing_modeobject
2 nested fields
FieldTypeDescription
flexibleobject
1 nested field
FieldTypeDescription
proration_discountsstring
type*string
end_behaviorstring
phasesarray<object>
array item fields
FieldTypeDescription
add_invoice_itemsarray<object>
array item fields
FieldTypeDescription
discountableboolean
discountsarray<object>
array item fields
FieldTypeDescription
couponstring
discountstring
promotion_codestring
metadataobject
periodobject
2 nested fields
FieldTypeDescription
end*object
2 nested fields
FieldTypeDescription
timestampinteger (unix-time)
type*string
start*object
2 nested fields
FieldTypeDescription
timestampinteger (unix-time)
type*string
pricestring
price_dataobject
5 nested fields
FieldTypeDescription
currency*string (currency)
product*string
tax_behaviorstring
unit_amountinteger
unit_amount_decimalstring (decimal)
quantityinteger
tax_ratesarray<string> | string
application_fee_percentnumber
automatic_taxobject
2 nested fields
FieldTypeDescription
enabled*boolean
liabilityobject
2 nested fields
FieldTypeDescription
accountstring
type*string
billing_cycle_anchorstring
billing_thresholdsobject | string
collection_methodstring
default_payment_methodstring
default_tax_ratesarray<string> | string
descriptionstring | string
discountsarray<object> | string
durationobject
2 nested fields
FieldTypeDescription
interval*string
interval_countinteger
end_dateinteger (unix-time) | string
invoice_settingsobject
3 nested fields
FieldTypeDescription
account_tax_idsarray<string> | string
days_until_dueinteger
issuerobject
2 nested fields
FieldTypeDescription
accountstring
type*string
items*array<object>
array item fields
FieldTypeDescription
billing_thresholdsobject | string
discountsarray<object> | string
metadataobject
pricestring
price_dataobject
6 nested fields
FieldTypeDescription
currency*string (currency)
product*string
recurring*object
2 nested fields
FieldTypeDescription
interval*string
interval_countinteger
tax_behaviorstring
unit_amountinteger
unit_amount_decimalstring (decimal)
quantityinteger
tax_ratesarray<string> | string
metadataobject
on_behalf_ofstring
proration_behaviorstring
start_dateinteger (unix-time) | string
transfer_dataobject
2 nested fields
FieldTypeDescription
amount_percentnumber
destination*string
trialboolean
trial_endinteger (unix-time) | string
proration_behaviorstring
subscriptionstring

The identifier of the subscription for which you'd like to retrieve the upcoming invoice. If not provided, but a subscription_details.items is provided, you will preview creating a subscription with those items. If neither subscription nor subscription_details.items is provided, you will retrieve the next upcoming invoice from among the customer's subscriptions.

subscription_detailsobject

The subscription creation or modification params to apply as a preview. Cannot be used with schedule or schedule_details fields.

13 nested fields
FieldTypeDescription
billing_cycle_anchorstring | integer (unix-time)
billing_modeobject
2 nested fields
FieldTypeDescription
flexibleobject
1 nested field
FieldTypeDescription
proration_discountsstring
type*string
billing_schedulesarray<object> | string
cancel_atinteger (unix-time) | string | string
cancel_at_period_endboolean
cancel_nowboolean
default_tax_ratesarray<string> | string
itemsarray<object>
array item fields
FieldTypeDescription
billing_thresholdsobject | string
clear_usageboolean
deletedboolean
discountsarray<object> | string
idstring
metadataobject | string
pricestring
price_dataobject
6 nested fields
FieldTypeDescription
currency*string (currency)
product*string
recurring*object
2 nested fields
FieldTypeDescription
interval*string
interval_countinteger
tax_behaviorstring
unit_amountinteger
unit_amount_decimalstring (decimal)
quantityinteger
tax_ratesarray<string> | string
proration_behaviorstring
proration_dateinteger (unix-time)
resume_atstring
start_dateinteger (unix-time)
trial_endstring | integer (unix-time)

Response

FieldTypeDescription
account_countrystring

The country of the business associated with this invoice, most often the business creating the invoice.

account_namestring

The public name of the business associated with this invoice, most often the business creating the invoice.

account_tax_idsarray<string | tax_id | deleted_tax_id>

The account tax IDs associated with the invoice. Only editable when the invoice is a draft.

amount_due*integer

Final amount due at this time for this invoice. If the invoice's total is smaller than the minimum charge amount, for example, or if there is account credit that can be applied to the invoice, the amount_due may be 0. If there is a positive starting_balance for the invoice (the customer owes money), the amount_due will also take that into account. The charge that gets generated for the invoice will be for the amount specified in amount_due.

amount_overpaid*integer

Amount that was overpaid on the invoice. The amount overpaid is credited to the customer's credit balance.

amount_paid*integer

The amount, in cents (or local equivalent), that was paid.

amount_paid_off_stripe*integer

Amount, in cents (or local equivalent), that was paid on the invoice outside of Stripe.

amount_remaining*integer

The difference between amount_due and amount_paid, in cents (or local equivalent).

amount_shipping*integer

This is the sum of all the shipping amounts.

applicationstring | application | deleted_application

ID of the Connect Application that created the invoice.

attempt_count*integer

Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count. In other words, manual payment attempts after the first attempt do not affect the retry schedule. If a failure is returned with a non-retryable return code, the invoice can no longer be retried unless a new payment method is obtained. Retries will continue to be scheduled, and attempt_count will continue to increment, but retries will only be executed if a new payment method is obtained.

attempted*boolean

Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the invoice.created webhook, for example, so you might not want to display that invoice as unpaid to your users.

auto_advance*boolean

Controls whether Stripe performs automatic collection of the invoice. If false, the invoice's state doesn't automatically advance without an explicit action.

automatic_tax*automatic_tax
5 nested fields
FieldTypeDescription
disabled_reasonstring

If Stripe disabled automatic tax, this enum describes why.

enabled*boolean

Whether Stripe automatically computes tax on this invoice. Note that incompatible invoice items (invoice items with manually specified tax rates, negative amounts, or tax_behavior=unspecified) cannot be added to automatic tax invoices.

liabilityconnect_account_reference

The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.

providerstring

The tax provider powering automatic tax.

statusstring

The status of the most recent automated tax calculation for this invoice.

automatically_finalizes_atinteger (unix-time)

The time when this invoice is currently scheduled to be automatically finalized. The field will be null if the invoice is not scheduled to finalize in the future. If the invoice is not in the draft state, this field will always be null - see finalized_at for the time when an already-finalized invoice was finalized.

billing_reasonstring

Indicates the reason why the invoice was created. * manual: Unrelated to a subscription, for example, created via the invoice editor. * subscription: No longer in use. Applies to subscriptions from before May 2018 where no distinction was made between updates, cycles, and thresholds. * subscription_create: A new subscription was created. * subscription_cycle: A subscription advanced into a new period. * subscription_threshold: A subscription reached a billing threshold. * subscription_update: A subscription was updated. * upcoming: Reserved for upcoming invoices created through the Create Preview Invoice API or when an invoice.upcoming event is generated for an upcoming invoice on a subscription.

collection_method*string

Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions.

confirmation_secretinvoices_resource_confirmation_secret

The confirmation secret associated with this invoice. Currently, this contains the client_secret of the PaymentIntent that Stripe creates during invoice finalization.

created*integer (unix-time)

Time at which the object was created. Measured in seconds since the Unix epoch.

currency*string (currency)

Three-letter ISO currency code, in lowercase. Must be a supported currency.

custom_fieldsarray<invoice_setting_custom_field>

Custom fields displayed on the invoice.

array item fields
FieldTypeDescription
name*string

The name of the custom field.

value*string

The value of the custom field.

customer*string | customer | deleted_customer

The ID of the customer to bill.

customer_accountstring

The ID of the account representing the customer to bill.

customer_addressaddress

The customer's address. Until the invoice is finalized, this field will equal customer.address. Once the invoice is finalized, this field will no longer be updated.

customer_emailstring

The customer's email. Until the invoice is finalized, this field will equal customer.email. Once the invoice is finalized, this field will no longer be updated.

customer_namestring

The customer's name. Until the invoice is finalized, this field will equal customer.name. Once the invoice is finalized, this field will no longer be updated.

customer_phonestring

The customer's phone number. Until the invoice is finalized, this field will equal customer.phone. Once the invoice is finalized, this field will no longer be updated.

customer_shippingshipping

The customer's shipping information. Until the invoice is finalized, this field will equal customer.shipping. Once the invoice is finalized, this field will no longer be updated.

customer_tax_exemptstring

The customer's tax exempt status. Until the invoice is finalized, this field will equal customer.tax_exempt. Once the invoice is finalized, this field will no longer be updated.

customer_tax_idsarray<invoices_resource_invoice_tax_id>

The customer's tax IDs. Until the invoice is finalized, this field will contain the same tax IDs as customer.tax_ids. Once the invoice is finalized, this field will no longer be updated.

array item fields
FieldTypeDescription
type*string

The type of the tax ID, one of ad_nrt, ar_cuit, eu_vat, bo_tin, br_cnpj, br_cpf, cn_tin, co_nit, cr_tin, do_rcn, ec_ruc, eu_oss_vat, hr_oib, pe_ruc, ro_tin, rs_pib, sv_nit, uy_ruc, ve_rif, vn_tin, gb_vat, nz_gst, au_abn, au_arn, in_gst, no_vat, no_voec, za_vat, ch_vat, mx_rfc, sg_uen, ru_inn, ru_kpp, ca_bn, hk_br, es_cif, pl_nip, it_cf, fo_vat, gi_tin, py_ruc, tw_vat, th_vat, jp_cn, jp_rn, jp_trn, li_uid, li_vat, lk_vat, my_itn, us_ein, kr_brn, ca_qst, ca_gst_hst, ca_pst_bc, ca_pst_mb, ca_pst_sk, my_sst, sg_gst, ae_trn, cl_tin, sa_vat, id_npwp, my_frp, il_vat, ge_vat, ua_vat, is_vat, bg_uic, hu_tin, si_tin, ke_pin, tr_tin, eg_tin, ph_tin, al_tin, bh_vat, kz_bin, ng_tin, om_vat, de_stn, ch_uid, tz_vat, uz_vat, uz_tin, md_vat, ma_vat, by_tin, ao_tin, bs_tin, bb_tin, cd_nif, mr_nif, me_pib, zw_tin, ba_tin, gn_nif, mk_vat, sr_fin, sn_ninea, am_tin, np_pan, tj_tin, ug_tin, zm_tin, kh_tin, aw_tin, az_tin, bd_bin, bj_ifu, et_tin, kg_tin, la_tin, cm_niu, cv_nif, bf_ifu, or unknown

valuestring

The value of the tax ID.