View Source Stripe.Invoice (stripity_stripe v3.3.1)
Invoices are statements of amounts owed by a customer, and are either generated one-off, or generated periodically from a subscription.
They contain invoice items, and proration adjustments that may be caused by subscription upgrades/downgrades (if necessary).
If your invoice is configured to be billed through automatic charges, Stripe automatically finalizes your invoice and attempts payment. Note that finalizing the invoice, when automatic, does not happen immediately as the invoice is created. Stripe waits until one hour after the last webhook was successfully sent (or the last webhook timed out after failing). If you (and the platforms you may have connected to) have no webhooks configured, Stripe waits one hour after creation to finalize the invoice.
If your invoice is configured to be billed by sending an email, then based on your email settings, Stripe will email the invoice to your customer and await payment. These emails can contain a link to a hosted page to pay the invoice.
Stripe applies any customer credit on the account before determining the amount due for the invoice (i.e., the amount that will be actually charged). If the amount due for the invoice is less than Stripe's minimum allowed charge per currency, the invoice is automatically marked paid, and we add the amount due to the customer's credit balance which is applied to the next invoice.
More details on the customer's credit balance are here.
Related guide: Send invoices to customers
Summary
Types
Shipping address
Settings for automatic tax lookup for this invoice.
Configuration for the bank transfer funding type, if the funding_type is set to bank_transfer.
Controls how prorations and invoices for subscriptions are calculated and orchestrated.
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.
The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.
The number of intervals the phase should last. If set, end_date must not be set.
End of the invoice item period.
Configuration for eu_bank_transfer funding type.
Provide filters for the linked accounts that the customer can select for the payment method.
Additional fields for Financial Connections Session creation
Describes a fixed amount to charge for shipping. Must be present if type is fixed_amount.
Configure behavior for flexible billing mode.
Revise an existing invoice. The new invoice will be created in status=draft. See the revision documentation for more details.
Installment configuration for payments attempted on this invoice.
All invoices will be billed using the specified settings.
The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
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.
Additional fields for Mandate creation
The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite.
The lower bound of the estimated range. If empty, represents no lower bound.
Payment-method-specific configuration to provide to the invoice’s PaymentIntent.
Configuration settings for the PaymentIntent that is generated when the invoice is finalized.
Invoice pdf rendering options
The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have Stripe Revenue Recognition enabled, the period will be used to recognize and defer revenue. See the Revenue Recognition documentation for details.
Data used to generate a new Price object inline.
The pricing information for the invoice item.
Data used to generate a new Product object inline. One of product or product_data is required.
The recurring components of a price such as interval and interval_count.
The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page.
The schedule creation or modification params to apply as a preview. Cannot be used with subscription or subscription_ prefixed fields.
Settings for the cost of shipping for this invoice.
Shipping details for the invoice. The Invoice PDF will use the shipping_details value if it is set, otherwise the PDF will render the shipping address from the customer.
Parameters to create a new ad-hoc shipping rate for this order.
Start of the invoice item period.
The subscription creation or modification params to apply as a preview. Cannot be used with schedule or schedule_details fields.
The invoice type.
Tax details about the customer.
Data to find or create a TaxRate object.
If specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice's charge.
Functions
Adds multiple line items to an invoice. This is only possible when an invoice is still a draft.
Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of payments.
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.
Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be voided.
Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you’d like to finalize a draft invoice manually, you can do so using this method.
You can list all invoices, or list the invoices for a specific customer. The invoices are returned sorted by creation date, with the most recently created invoices appearing first.
Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.
Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your subscriptions settings. However, if you’d like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so.
Removes multiple line items from an invoice. This is only possible when an invoice is still a draft.
Retrieves the invoice with the given ID.
Search for invoices you’ve previously created using Stripe’s Search Query Language.Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up to an hour behind during outages. Search functionality is not available to merchants in India.
Stripe will automatically send invoices to customers according to your subscriptions settings. However, if you’d like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email.
Draft invoices are fully editable. Once an invoice is finalized,monetary values, as well as collection_method, become uneditable.
Updates multiple line items on an invoice. This is only possible when an invoice is still a draft.
Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to deletion, however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.
Types
@type acss_debit() :: %{ optional(:mandate_options) => mandate_options(), optional(:verification_method) => :automatic | :instant | :microdeposits }
@type add_invoice_items() :: %{ optional(:discounts) => [discounts()], optional(:metadata) => %{optional(binary()) => binary()}, optional(:period) => period(), optional(:price) => binary(), optional(:price_data) => price_data(), optional(:quantity) => integer(), optional(:tax_rates) => [binary()] | binary() }
@type address() :: %{ optional(:city) => binary(), optional(:country) => binary(), optional(:line1) => binary(), optional(:line2) => binary(), optional(:postal_code) => binary(), optional(:state) => binary() }
Shipping address
Settings for automatic tax lookup for this invoice.
@type bancontact() :: %{optional(:preferred_language) => :de | :en | :fr | :nl}
@type bank_transfer() :: %{ optional(:eu_bank_transfer) => eu_bank_transfer(), optional(:type) => binary() }
Configuration for the bank transfer funding type, if the funding_type is set to bank_transfer.
@type billing_mode() :: %{ optional(:flexible) => flexible(), optional(:type) => :classic | :flexible }
Controls how prorations and invoices for subscriptions are calculated and orchestrated.
@type billing_thresholds() :: %{optional(:usage_gte) => integer()}
@type card() :: %{ optional(:installments) => installments(), optional(:request_three_d_secure) => :any | :automatic | :challenge }
@type customer_balance() :: %{ optional(:bank_transfer) => bank_transfer(), optional(:funding_type) => binary() }
@type customer_details() :: %{ optional(:address) => address() | binary(), optional(:shipping) => shipping() | binary(), optional(:tax) => tax(), optional(:tax_exempt) => :exempt | :none | :reverse, optional(:tax_ids) => [tax_ids()] }
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.
The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.
@type duration() :: %{ optional(:interval) => :day | :month | :week | :year, optional(:interval_count) => integer() }
The number of intervals the phase should last. If set, end_date must not be set.
@type end_field() :: %{ optional(:timestamp) => integer(), optional(:type) => :min_item_period_end | :phase_end | :timestamp }
End of the invoice item period.
@type eu_bank_transfer() :: %{optional(:country) => binary()}
Configuration for eu_bank_transfer funding type.
@type filters() :: %{optional(:account_subcategories) => [:checking | :savings]}
Provide filters for the linked accounts that the customer can select for the payment method.
@type financial_connections() :: %{ optional(:filters) => filters(), optional(:permissions) => [ :balances | :ownership | :payment_method | :transactions ], optional(:prefetch) => [:balances | :ownership | :transactions] }
Additional fields for Financial Connections Session creation
@type fixed_amount() :: %{ optional(:amount) => integer(), optional(:currency) => binary(), optional(:currency_options) => map() }
Describes a fixed amount to charge for shipping. Must be present if type is fixed_amount.
@type flexible() :: %{optional(:proration_discounts) => :included | :itemized}
Configure behavior for flexible billing mode.
@type from_invoice() :: %{ optional(:action) => :revision, optional(:invoice) => binary() }
Revise an existing invoice. The new invoice will be created in status=draft. See the revision documentation for more details.
Installment configuration for payments attempted on this invoice.
For more information, see the installments integration guide.
@type invoice_items() :: %{ optional(:amount) => integer(), optional(:currency) => binary(), optional(:description) => binary(), optional(:discountable) => boolean(), optional(:discounts) => [discounts()] | binary(), optional(:invoiceitem) => binary(), optional(:metadata) => %{optional(binary()) => binary()} | binary(), optional(:period) => period(), optional(:price) => binary(), optional(:price_data) => price_data(), optional(:quantity) => integer(), optional(:tax_behavior) => :exclusive | :inclusive | :unspecified, optional(:tax_code) => binary() | binary(), optional(:tax_rates) => [binary()] | binary(), optional(:unit_amount) => integer(), optional(:unit_amount_decimal) => binary() }
@type invoice_settings() :: %{ optional(:account_tax_ids) => [binary()] | binary(), optional(:days_until_due) => integer(), optional(:issuer) => issuer() }
All invoices will be billed using the specified settings.
@type issuer() :: %{ optional(:account) => binary(), optional(:type) => :account | :self }
The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
@type items() :: %{ optional(:billing_thresholds) => billing_thresholds() | binary(), optional(:clear_usage) => boolean(), optional(:deleted) => boolean(), optional(:discounts) => [discounts()] | binary(), optional(:id) => binary(), optional(:metadata) => %{optional(binary()) => binary()} | binary(), optional(:plan) => binary(), optional(:price) => binary(), optional(:price_data) => price_data(), optional(:quantity) => integer(), optional(:tax_rates) => [binary()] | binary() }
@type liability() :: %{ optional(:account) => binary(), optional(:type) => :account | :self }
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.
@type lines() :: %{ optional(:amount) => integer(), optional(:description) => binary(), optional(:discountable) => boolean(), optional(:discounts) => [discounts()] | binary(), optional(:invoice_item) => binary(), optional(:metadata) => %{optional(binary()) => binary()} | binary(), optional(:period) => period(), optional(:price_data) => price_data(), optional(:pricing) => pricing(), optional(:quantity) => integer(), optional(:tax_amounts) => [tax_amounts()] | binary(), optional(:tax_rates) => [binary()] | binary() }
@type mandate_options() :: %{optional(:transaction_type) => :business | :personal}
Additional fields for Mandate creation
@type maximum() :: %{ optional(:unit) => :business_day | :day | :hour | :month | :week, optional(:value) => integer() }
The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite.
@type minimum() :: %{ optional(:unit) => :business_day | :day | :hour | :month | :week, optional(:value) => integer() }
The lower bound of the estimated range. If empty, represents no lower bound.
@type payment_method_options() :: %{ optional(:acss_debit) => acss_debit() | binary(), optional(:bancontact) => bancontact() | binary(), optional(:card) => card() | binary(), optional(:customer_balance) => customer_balance() | binary(), optional(:konbini) => map() | binary(), optional(:sepa_debit) => map() | binary(), optional(:us_bank_account) => us_bank_account() | binary() }
Payment-method-specific configuration to provide to the invoice’s PaymentIntent.
@type payment_settings() :: %{ optional(:default_mandate) => binary() | binary(), optional(:payment_method_options) => payment_method_options(), optional(:payment_method_types) => [ :ach_credit_transfer | :ach_debit | :acss_debit | :affirm | :amazon_pay | :au_becs_debit | :bacs_debit | :bancontact | :boleto | :card | :cashapp | :crypto | :custom | :customer_balance | :eps | :fpx | :giropay | :grabpay | :ideal | :jp_credit_transfer | :kakao_pay | :klarna | :konbini | :kr_card | :link | :multibanco | :naver_pay | :nz_bank_account | :p24 | :payco | :paynow | :paypal | :promptpay | :revolut_pay | :sepa_credit_transfer | :sepa_debit | :sofort | :swish | :us_bank_account | :wechat_pay ] | binary() }
Configuration settings for the PaymentIntent that is generated when the invoice is finalized.
@type pdf() :: %{optional(:page_size) => :a4 | :auto | :letter}
Invoice pdf rendering options
The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have Stripe Revenue Recognition enabled, the period will be used to recognize and defer revenue. See the Revenue Recognition documentation for details.
@type phases() :: %{ optional(:add_invoice_items) => [add_invoice_items()], optional(:application_fee_percent) => number(), optional(:automatic_tax) => automatic_tax(), optional(:billing_cycle_anchor) => :automatic | :phase_start, optional(:billing_thresholds) => billing_thresholds() | binary(), optional(:collection_method) => :charge_automatically | :send_invoice, optional(:currency) => binary(), optional(:default_payment_method) => binary(), optional(:default_tax_rates) => [binary()] | binary(), optional(:description) => binary() | binary(), optional(:discounts) => [discounts()] | binary(), optional(:duration) => duration(), optional(:end_date) => integer() | :now, optional(:invoice_settings) => invoice_settings(), optional(:items) => [items()], optional(:metadata) => %{optional(binary()) => binary()}, optional(:on_behalf_of) => binary(), optional(:proration_behavior) => :always_invoice | :create_prorations | :none, optional(:start_date) => integer() | :now, optional(:transfer_data) => transfer_data(), optional(:trial) => boolean(), optional(:trial_end) => integer() | :now }
@type plan() :: %{ optional(:count) => integer(), optional(:interval) => :month, optional(:type) => :bonus | :fixed_count | :revolving }
@type price_data() :: %{ optional(:currency) => binary(), optional(:product) => binary(), optional(:product_data) => product_data(), optional(:tax_behavior) => :exclusive | :inclusive | :unspecified, optional(:unit_amount) => integer(), optional(:unit_amount_decimal) => binary() }
Data used to generate a new Price object inline.
@type pricing() :: %{optional(:price) => binary()}
The pricing information for the invoice item.
@type product_data() :: %{ optional(:description) => binary(), optional(:images) => [binary()], optional(:metadata) => %{optional(binary()) => binary()}, optional(:name) => binary(), optional(:tax_code) => binary(), optional(:unit_label) => binary() }
Data used to generate a new Product object inline. One of product or product_data is required.
@type recurring() :: %{ optional(:interval) => :day | :month | :week | :year, optional(:interval_count) => integer() }
The recurring components of a price such as interval and interval_count.
@type rendering() :: %{ optional(:amount_tax_display) => :exclude_tax | :include_inclusive_tax, optional(:pdf) => pdf(), optional(:template) => binary(), optional(:template_version) => integer() | binary() }
The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page.
@type schedule_details() :: %{ optional(:billing_mode) => billing_mode(), optional(:end_behavior) => :cancel | :release, optional(:phases) => [phases()], optional(:proration_behavior) => :always_invoice | :create_prorations | :none }
The schedule creation or modification params to apply as a preview. Cannot be used with subscription or subscription_ prefixed fields.
@type shipping_cost() :: %{ optional(:shipping_rate) => binary(), optional(:shipping_rate_data) => shipping_rate_data() }
Settings for the cost of shipping for this invoice.
@type shipping_details() :: %{ optional(:address) => address(), optional(:name) => binary(), optional(:phone) => binary() | binary() }
Shipping details for the invoice. The Invoice PDF will use the shipping_details value if it is set, otherwise the PDF will render the shipping address from the customer.
@type shipping_rate_data() :: %{ optional(:delivery_estimate) => delivery_estimate(), optional(:display_name) => binary(), optional(:fixed_amount) => fixed_amount(), optional(:metadata) => %{optional(binary()) => binary()}, optional(:tax_behavior) => :exclusive | :inclusive | :unspecified, optional(:tax_code) => binary(), optional(:type) => :fixed_amount }
Parameters to create a new ad-hoc shipping rate for this order.
@type start() :: %{ optional(:timestamp) => integer(), optional(:type) => :max_item_period_start | :phase_start | :timestamp }
Start of the invoice item period.
@type subscription_details() :: %{ optional(:billing_cycle_anchor) => (:now | :unchanged) | integer(), optional(:billing_mode) => billing_mode(), optional(:cancel_at) => integer() | binary() | :max_period_end | :min_period_end, optional(:cancel_at_period_end) => boolean(), optional(:cancel_now) => boolean(), optional(:default_tax_rates) => [binary()] | binary(), optional(:items) => [items()], optional(:proration_behavior) => :always_invoice | :create_prorations | :none, optional(:proration_date) => integer(), optional(:resume_at) => :now, optional(:start_date) => integer(), optional(:trial_end) => :now | integer() }
The subscription creation or modification params to apply as a preview. Cannot be used with schedule or schedule_details fields.
@type t() :: %Stripe.Invoice{ account_country: binary() | nil, account_name: binary() | nil, account_tax_ids: term() | nil, amount_due: integer(), amount_overpaid: integer(), amount_paid: integer(), amount_remaining: integer(), amount_shipping: integer(), application: (binary() | term() | term()) | nil, attempt_count: integer(), attempted: boolean(), auto_advance: boolean(), automatic_tax: term(), automatically_finalizes_at: integer() | nil, billing_reason: binary() | nil, collection_method: binary(), confirmation_secret: term() | nil, created: integer(), currency: binary(), custom_fields: term() | nil, customer: (binary() | Stripe.Customer.t() | Stripe.DeletedCustomer.t()) | nil, customer_address: term() | nil, customer_email: binary() | nil, customer_name: binary() | nil, customer_phone: binary() | nil, customer_shipping: term() | nil, customer_tax_exempt: binary() | nil, customer_tax_ids: term() | nil, default_payment_method: (binary() | Stripe.PaymentMethod.t()) | nil, default_source: (binary() | Stripe.PaymentSource.t()) | nil, default_tax_rates: term(), description: binary() | nil, discounts: term(), due_date: integer() | nil, effective_at: integer() | nil, ending_balance: integer() | nil, footer: binary() | nil, from_invoice: term() | nil, hosted_invoice_url: binary() | nil, id: binary(), invoice_pdf: binary() | nil, issuer: term(), last_finalization_error: Stripe.ApiErrors.t() | nil, latest_revision: (binary() | t()) | nil, lines: term(), livemode: boolean(), metadata: term() | nil, next_payment_attempt: integer() | nil, number: binary() | nil, object: binary(), on_behalf_of: (binary() | Stripe.Account.t()) | nil, parent: term() | nil, payment_settings: term(), payments: term(), period_end: integer(), period_start: integer(), post_payment_credit_notes_amount: integer(), pre_payment_credit_notes_amount: integer(), receipt_number: binary() | nil, rendering: term() | nil, shipping_cost: term() | nil, shipping_details: term() | nil, starting_balance: integer(), statement_descriptor: binary() | nil, status: binary() | nil, status_transitions: term(), subscription: (binary() | Stripe.Subscription.t()) | nil, subtotal: integer(), subtotal_excluding_tax: integer() | nil, test_clock: (binary() | Stripe.TestHelpers.TestClock.t()) | nil, threshold_reason: term(), total: integer(), total_discount_amounts: term() | nil, total_excluding_tax: integer() | nil, total_pretax_credit_amounts: term() | nil, total_taxes: term() | nil, webhooks_delivered_at: integer() | nil }
The invoice type.
account_countryThe country of the business associated with this invoice, most often the business creating the invoice.account_nameThe public name of the business associated with this invoice, most often the business creating the invoice.account_tax_idsThe account tax IDs associated with the invoice. Only editable when the invoice is a draft.amount_dueFinal 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, theamount_duemay be 0. If there is a positivestarting_balancefor the invoice (the customer owes money), theamount_duewill also take that into account. The charge that gets generated for the invoice will be for the amount specified inamount_due.amount_overpaidAmount that was overpaid on the invoice. The amount overpaid is credited to the customer's credit balance.amount_paidThe amount, in cents (or local equivalent), that was paid.amount_remainingThe difference between amount_due and amount_paid, in cents (or local equivalent).amount_shippingThis is the sum of all the shipping amounts.applicationID of the Connect Application that created the invoice.attempt_countNumber 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.attemptedWhether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after theinvoice.createdwebhook, for example, so you might not want to display that invoice as unpaid to your users.auto_advanceControls whether Stripe performs automatic collection of the invoice. Iffalse, the invoice's state doesn't automatically advance without an explicit action.automatic_taxautomatically_finalizes_atThe time when this invoice is currently scheduled to be automatically finalized. The field will benullif the invoice is not scheduled to finalize in the future. If the invoice is not in the draft state, this field will always benull- seefinalized_atfor the time when an already-finalized invoice was finalized.billing_reasonIndicates 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 aninvoice.upcomingevent is generated for an upcoming invoice on a subscription.collection_methodEithercharge_automatically, orsend_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_secretThe confirmation secret associated with this invoice. Currently, this contains the client_secret of the PaymentIntent that Stripe creates during invoice finalization.createdTime at which the object was created. Measured in seconds since the Unix epoch.currencyThree-letter ISO currency code, in lowercase. Must be a supported currency.custom_fieldsCustom fields displayed on the invoice.customerThe ID of the customer who will be billed.customer_addressThe customer's address. Until the invoice is finalized, this field will equalcustomer.address. Once the invoice is finalized, this field will no longer be updated.customer_emailThe customer's email. Until the invoice is finalized, this field will equalcustomer.email. Once the invoice is finalized, this field will no longer be updated.customer_nameThe customer's name. Until the invoice is finalized, this field will equalcustomer.name. Once the invoice is finalized, this field will no longer be updated.customer_phoneThe customer's phone number. Until the invoice is finalized, this field will equalcustomer.phone. Once the invoice is finalized, this field will no longer be updated.customer_shippingThe customer's shipping information. Until the invoice is finalized, this field will equalcustomer.shipping. Once the invoice is finalized, this field will no longer be updated.customer_tax_exemptThe customer's tax exempt status. Until the invoice is finalized, this field will equalcustomer.tax_exempt. Once the invoice is finalized, this field will no longer be updated.customer_tax_idsThe customer's tax IDs. Until the invoice is finalized, this field will contain the same tax IDs ascustomer.tax_ids. Once the invoice is finalized, this field will no longer be updated.default_payment_methodID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings.default_sourceID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription's default source, if any, or to the customer's default source.default_tax_ratesThe tax rates applied to this invoice, if any.descriptionAn arbitrary string attached to the object. Often useful for displaying to users. Referenced as 'memo' in the Dashboard.discountsThe discounts applied to the invoice. Line item discounts are applied before invoice discounts. Useexpand[]=discountsto expand each discount.due_dateThe date on which payment for this invoice is due. This value will benullfor invoices wherecollection_method=charge_automatically.effective_atThe date when this invoice is in effect. Same asfinalized_atunless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the invoice PDF and receipt.ending_balanceEnding customer balance after the invoice is finalized. Invoices are finalized approximately an hour after successful webhook delivery or when payment collection is attempted for the invoice. If the invoice has not been finalized yet, this will be null.footerFooter displayed on the invoice.from_invoiceDetails of the invoice that was cloned. See the revision documentation for more details.hosted_invoice_urlThe URL for the hosted invoice page, which allows customers to view and pay an invoice. If the invoice has not been finalized yet, this will be null.idUnique identifier for the object. For preview invoices created using the create preview endpoint, this id will be prefixed withupcoming_in.invoice_pdfThe link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null.issuerlast_finalization_errorThe error encountered during the previous attempt to finalize the invoice. This field is cleared when the invoice is successfully finalized.latest_revisionThe ID of the most recent non-draft revision of this invoicelinesThe individual line items that make up the invoice.linesis sorted as follows: (1) pending invoice items (including prorations) in reverse chronological order, (2) subscription items in reverse chronological order, and (3) invoice items added after invoice creation in chronological order.livemodeHas the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.metadataSet of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.next_payment_attemptThe time at which payment will next be attempted. This value will benullfor invoices wherecollection_method=send_invoice.numberA unique, identifying string that appears on emails sent to the customer for this invoice. This starts with the customer's unique invoice_prefix if it is specified.objectString representing the object's type. Objects of the same type share the same value.on_behalf_ofThe 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.parentThe parent that generated this invoicepayment_settingspaymentsPayments for this invoiceperiod_endEnd of the usage period during which invoice items were added to this invoice. This looks back one period for a subscription invoice. Use the line item period to get the service period for each price.period_startStart of the usage period during which invoice items were added to this invoice. This looks back one period for a subscription invoice. Use the line item period to get the service period for each price.post_payment_credit_notes_amountTotal amount of all post-payment credit notes issued for this invoice.pre_payment_credit_notes_amountTotal amount of all pre-payment credit notes issued for this invoice.receipt_numberThis is the transaction number that appears on email receipts sent for this invoice.renderingThe rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page.shipping_costThe details of the cost of shipping, including the ShippingRate applied on the invoice.shipping_detailsShipping details for the invoice. The Invoice PDF will use theshipping_detailsvalue if it is set, otherwise the PDF will render the shipping address from the customer.starting_balanceStarting customer balance before the invoice is finalized. If the invoice has not been finalized yet, this will be the current customer balance. For revision invoices, this also includes any customer balance that was applied to the original invoice.statement_descriptorExtra information about an invoice for the customer's credit card statement.statusThe status of the invoice, one ofdraft,open,paid,uncollectible, orvoid. Learn morestatus_transitionssubscriptionsubtotalTotal of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or exclusive tax is applied. Item discounts are already incorporatedsubtotal_excluding_taxThe integer amount in cents (or local equivalent) representing the subtotal of the invoice before any invoice level discount or tax is applied. Item discounts are already incorporatedtest_clockID of the test clock this invoice belongs to.threshold_reasontotalTotal after discounts and taxes.total_discount_amountsThe aggregate amounts calculated per discount across all line items.total_excluding_taxThe integer amount in cents (or local equivalent) representing the total amount of the invoice including all discounts but excluding all tax.total_pretax_credit_amountsContains pretax credit amounts (ex: discount, credit grants, etc) that apply to this invoice. This is a combined list of total_pretax_credit_amounts across all invoice line items.total_taxesThe aggregate tax information of all line items.webhooks_delivered_atInvoices are automatically paid or sent 1 hour after webhooks are delivered, or until all webhook delivery attempts have been exhausted. This field tracks the time when webhooks for this invoice were successfully delivered. If the invoice had no webhooks to deliver, this will be set while the invoice is being created.
Tax details about the customer.
@type tax_amounts() :: %{ optional(:amount) => integer(), optional(:tax_rate_data) => tax_rate_data(), optional(:taxability_reason) => :customer_exempt | :not_collecting | :not_subject_to_tax | :not_supported | :portion_product_exempt | :portion_reduced_rated | :portion_standard_rated | :product_exempt | :product_exempt_holiday | :proportionally_rated | :reduced_rated | :reverse_charge | :standard_rated | :taxable_basis_reduced | :zero_rated, optional(:taxable_amount) => integer() }
@type tax_ids() :: %{ optional(:type) => :ad_nrt | :ae_trn | :al_tin | :am_tin | :ao_tin | :ar_cuit | :au_abn | :au_arn | :aw_tin | :az_tin | :ba_tin | :bb_tin | :bd_bin | :bf_ifu | :bg_uic | :bh_vat | :bj_ifu | :bo_tin | :br_cnpj | :br_cpf | :bs_tin | :by_tin | :ca_bn | :ca_gst_hst | :ca_pst_bc | :ca_pst_mb | :ca_pst_sk | :ca_qst | :cd_nif | :ch_uid | :ch_vat | :cl_tin | :cm_niu | :cn_tin | :co_nit | :cr_tin | :cv_nif | :de_stn | :do_rcn | :ec_ruc | :eg_tin | :es_cif | :et_tin | :eu_oss_vat | :eu_vat | :gb_vat | :ge_vat | :gn_nif | :hk_br | :hr_oib | :hu_tin | :id_npwp | :il_vat | :in_gst | :is_vat | :jp_cn | :jp_rn | :jp_trn | :ke_pin | :kg_tin | :kh_tin | :kr_brn | :kz_bin | :la_tin | :li_uid | :li_vat | :ma_vat | :md_vat | :me_pib | :mk_vat | :mr_nif | :mx_rfc | :my_frp | :my_itn | :my_sst | :ng_tin | :no_vat | :no_voec | :np_pan | :nz_gst | :om_vat | :pe_ruc | :ph_tin | :ro_tin | :rs_pib | :ru_inn | :ru_kpp | :sa_vat | :sg_gst | :sg_uen | :si_tin | :sn_ninea | :sr_fin | :sv_nit | :th_vat | :tj_tin | :tr_tin | :tw_vat | :tz_vat | :ua_vat | :ug_tin | :us_ein | :uy_ruc | :uz_tin | :uz_vat | :ve_rif | :vn_tin | :za_vat | :zm_tin | :zw_tin, optional(:value) => binary() }
@type tax_rate_data() :: %{ optional(:country) => binary(), optional(:description) => binary(), optional(:display_name) => binary(), optional(:inclusive) => boolean(), optional(:jurisdiction) => binary(), optional(:jurisdiction_level) => :city | :country | :county | :district | :multiple | :state, optional(:percentage) => number(), optional(:state) => binary(), optional(:tax_type) => :amusement_tax | :communications_tax | :gst | :hst | :igst | :jct | :lease_tax | :pst | :qst | :retail_delivery_fee | :rst | :sales_tax | :service_tax | :vat }
Data to find or create a TaxRate object.
Stripe automatically creates or reuses a TaxRate object for each tax amount. If the tax_rate_data exactly matches a previous value, Stripe will reuse the TaxRate object. TaxRate objects created automatically by Stripe are immediately archived, do not appear in the line item’s tax_rates, and cannot be directly added to invoices, payments, or line items.
If specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice's charge.
@type us_bank_account() :: %{ optional(:financial_connections) => financial_connections(), optional(:verification_method) => :automatic | :instant | :microdeposits }
Functions
@spec add_lines( invoice :: binary(), params :: %{ optional(:expand) => [binary()], optional(:invoice_metadata) => map() | binary(), optional(:lines) => [lines()] }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Adds multiple line items to an invoice. This is only possible when an invoice is still a draft.
Details
- Method:
post - Path:
/v1/invoices/{invoice}/add_lines
@spec attach_payment( invoice :: binary(), params :: %{ optional(:expand) => [binary()], optional(:payment_intent) => binary(), optional(:payment_record) => binary() }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of payments.
For the PaymentIntent, when the PaymentIntent’s status changes to succeeded, the payment is creditedto the invoice, increasing its amount_paid. When the invoice is fully paid, the
invoice’s status becomes paid.
If the PaymentIntent’s status is already succeeded when it’s attached, it’scredited to the invoice immediately.
See: Partial payments to learn more.
#### Details * Method: `post` * Path: `/v1/invoices/{invoice}/attach_payment`@spec create( params :: %{ optional(:account_tax_ids) => [binary()] | binary(), optional(:application_fee_amount) => integer(), optional(:auto_advance) => boolean(), optional(:automatic_tax) => automatic_tax(), optional(:automatically_finalizes_at) => integer(), optional(:collection_method) => :charge_automatically | :send_invoice, optional(:currency) => binary(), optional(:custom_fields) => [custom_fields()] | binary(), optional(:customer) => binary(), optional(:days_until_due) => integer(), optional(:default_payment_method) => binary(), optional(:default_source) => binary(), optional(:default_tax_rates) => [binary()], optional(:description) => binary(), optional(:discounts) => [discounts()] | binary(), optional(:due_date) => integer(), optional(:effective_at) => integer(), optional(:expand) => [binary()], optional(:footer) => binary(), optional(:from_invoice) => from_invoice(), optional(:issuer) => issuer(), optional(:metadata) => %{optional(binary()) => binary()} | binary(), optional(:number) => binary(), optional(:on_behalf_of) => binary(), optional(:payment_settings) => payment_settings(), optional(:pending_invoice_items_behavior) => :exclude | :include, optional(:rendering) => rendering(), optional(:shipping_cost) => shipping_cost(), optional(:shipping_details) => shipping_details(), optional(:statement_descriptor) => binary(), optional(:subscription) => binary(), optional(:transfer_data) => transfer_data() }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
This endpoint creates a draft invoice for a given customer. The invoice remains a draft until you finalize the invoice, which allows you to pay or send the invoice to your customers.
Details
- Method:
post - Path:
/v1/invoices
@spec create_preview( params :: %{ optional(:automatic_tax) => automatic_tax(), optional(:currency) => binary(), optional(:customer) => binary(), optional(:customer_details) => customer_details(), optional(:discounts) => [discounts()] | binary(), optional(:expand) => [binary()], optional(:invoice_items) => [invoice_items()], optional(:issuer) => issuer(), optional(:on_behalf_of) => binary() | binary(), optional(:preview_mode) => :next | :recurring, optional(:schedule) => binary(), optional(:schedule_details) => schedule_details(), optional(:subscription) => binary(), optional(:subscription_details) => subscription_details() }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
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
Details
- Method:
post - Path:
/v1/invoices/create_preview
@spec delete(invoice :: binary(), opts :: Keyword.t()) :: {:ok, Stripe.DeletedInvoice.t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be voided.
Details
- Method:
delete - Path:
/v1/invoices/{invoice}
@spec finalize_invoice( invoice :: binary(), params :: %{ optional(:auto_advance) => boolean(), optional(:expand) => [binary()] }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you’d like to finalize a draft invoice manually, you can do so using this method.
Details
- Method:
post - Path:
/v1/invoices/{invoice}/finalize
@spec list( params :: %{ optional(:collection_method) => :charge_automatically | :send_invoice, optional(:created) => created() | integer(), optional(:customer) => binary(), optional(:due_date) => due_date() | integer(), optional(:ending_before) => binary(), optional(:expand) => [binary()], optional(:limit) => integer(), optional(:starting_after) => binary(), optional(:status) => :draft | :open | :paid | :uncollectible | :void, optional(:subscription) => binary() }, opts :: Keyword.t() ) :: {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
You can list all invoices, or list the invoices for a specific customer. The invoices are returned sorted by creation date, with the most recently created invoices appearing first.
Details
- Method:
get - Path:
/v1/invoices
@spec mark_uncollectible( invoice :: binary(), params :: %{optional(:expand) => [binary()]}, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.
Details
- Method:
post - Path:
/v1/invoices/{invoice}/mark_uncollectible
@spec pay( invoice :: binary(), params :: %{ optional(:expand) => [binary()], optional(:forgive) => boolean(), optional(:mandate) => binary() | binary(), optional(:off_session) => boolean(), optional(:paid_out_of_band) => boolean(), optional(:payment_method) => binary(), optional(:source) => binary() }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your subscriptions settings. However, if you’d like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so.
Details
- Method:
post - Path:
/v1/invoices/{invoice}/pay
@spec remove_lines( invoice :: binary(), params :: %{ optional(:expand) => [binary()], optional(:invoice_metadata) => map() | binary(), optional(:lines) => [lines()] }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Removes multiple line items from an invoice. This is only possible when an invoice is still a draft.
Details
- Method:
post - Path:
/v1/invoices/{invoice}/remove_lines
@spec retrieve( invoice :: binary(), params :: %{optional(:expand) => [binary()]}, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Retrieves the invoice with the given ID.
Details
- Method:
get - Path:
/v1/invoices/{invoice}
@spec search( params :: %{ optional(:expand) => [binary()], optional(:limit) => integer(), optional(:page) => binary(), optional(:query) => binary() }, opts :: Keyword.t() ) :: {:ok, Stripe.SearchResult.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Search for invoices you’ve previously created using Stripe’s Search Query Language.Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up to an hour behind during outages. Search functionality is not available to merchants in India.
#### Details * Method: `get` * Path: `/v1/invoices/search`@spec send_invoice( invoice :: binary(), params :: %{optional(:expand) => [binary()]}, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Stripe will automatically send invoices to customers according to your subscriptions settings. However, if you’d like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email.
Requests made in test-mode result in no emails being sent, despite sending an invoice.sent event.
Details
- Method:
post - Path:
/v1/invoices/{invoice}/send
@spec update( invoice :: binary(), params :: %{ optional(:account_tax_ids) => [binary()] | binary(), optional(:application_fee_amount) => integer(), optional(:auto_advance) => boolean(), optional(:automatic_tax) => automatic_tax(), optional(:automatically_finalizes_at) => integer(), optional(:collection_method) => :charge_automatically | :send_invoice, optional(:custom_fields) => [custom_fields()] | binary(), optional(:days_until_due) => integer(), optional(:default_payment_method) => binary(), optional(:default_source) => binary() | binary(), optional(:default_tax_rates) => [binary()] | binary(), optional(:description) => binary(), optional(:discounts) => [discounts()] | binary(), optional(:due_date) => integer(), optional(:effective_at) => integer() | binary(), optional(:expand) => [binary()], optional(:footer) => binary(), optional(:issuer) => issuer(), optional(:metadata) => %{optional(binary()) => binary()} | binary(), optional(:number) => binary() | binary(), optional(:on_behalf_of) => binary() | binary(), optional(:payment_settings) => payment_settings(), optional(:rendering) => rendering(), optional(:shipping_cost) => shipping_cost() | binary(), optional(:shipping_details) => shipping_details() | binary(), optional(:statement_descriptor) => binary(), optional(:transfer_data) => transfer_data() | binary() }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Draft invoices are fully editable. Once an invoice is finalized,monetary values, as well as collection_method, become uneditable.
If you would like to stop the Stripe Billing engine from automatically finalizing, reattempting payments on,sending reminders for, or automatically reconciling invoices, pass
auto_advance=false.
@spec update_lines( invoice :: binary(), params :: %{ optional(:expand) => [binary()], optional(:invoice_metadata) => map() | binary(), optional(:lines) => [lines()] }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Updates multiple line items on an invoice. This is only possible when an invoice is still a draft.
Details
- Method:
post - Path:
/v1/invoices/{invoice}/update_lines
@spec void_invoice( invoice :: binary(), params :: %{optional(:expand) => [binary()]}, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to deletion, however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.
Consult with local regulations to determine whether and how an invoice might be amended, canceled, or voided in the jurisdiction you’re doing business in. You might need to issue another invoice or credit note instead. Stripe recommends that you consult with your legal counsel for advice specific to your business.
Details
- Method:
post - Path:
/v1/invoices/{invoice}/void