View Source ExOAPI.Stripe.Schemas.Invoice (exoapi_stripe v0.1.4)

description: 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.

:customer_tax_exempt :: :string

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.

:auto_advance :: :boolean

Controls whether Stripe will perform automatic collection of the invoice. When false, the invoice's state will not automatically advance without an explicit action.

:customer_phone :: :string

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.

:invoice_pdf :: :string

The link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null.

:starting_balance :: :integer

Starting customer balance before the invoice is finalized. If the invoice has not been finalized yet, this will be the current customer balance.

:livemode :: :boolean

Has the value true if the object exists in live mode or the value false if the object exists in test mode.

::customer_tax_ids :: ExOAPI.Stripe.Schemas.InvoicesResourceInvoiceTaxId

: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.

:default_payment_method :: ExOAPI.Stripe.Schemas.PaymentMethod | :string

ID 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.

: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.

:last_finalization_error :: ExOAPI.Stripe.Schemas.ApiErrors

The error encountered during the previous attempt to finalize the invoice. This field is cleared when the invoice is successfully finalized.

: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.

:customer_name :: :string

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.

::custom_fields :: ExOAPI.Stripe.Schemas.InvoiceSettingCustomField

:subtotal :: :integer

Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated

:account_country :: :string

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

:metadata :: :map

Set 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.

:description :: :string

An arbitrary string attached to the object. Often useful for displaying to users. Referenced as 'memo' in the Dashboard.

:paid :: :boolean

Whether payment was successfully collected for this invoice. An invoice can be paid (most commonly) with a charge or with credit from the customer's account balance.

:pre_payment_credit_notes_amount :: :integer

Total amount of all pre-payment credit notes issued for this invoice.

:subscription_proration_date :: :integer

Only set for upcoming invoices that preview prorations. The time used to calculate prorations.

:footer :: :string

Footer displayed on the invoice.

:customer_shipping :: ExOAPI.Stripe.Schemas.Shipping

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.

:total :: :integer

Total after discounts and taxes.

:payment_intent :: ExOAPI.Stripe.Schemas.PaymentIntent | :string

The PaymentIntent associated with this invoice. The PaymentIntent is generated when the invoice is finalized, and can then be used to pay the invoice. Note that voiding an invoice will cancel the PaymentIntent.

:paid_out_of_band :: :boolean

Returns true if the invoice was manually marked paid, returns false if the invoice hasn't been paid yet or was paid on Stripe.

:threshold_reason :: ExOAPI.Stripe.Schemas.InvoiceThresholdReason

:discount :: ExOAPI.Stripe.Schemas.Discount

Describes the current discount applied to this invoice, if there is one. Not populated if there are multiple discounts.

:customer_email :: :string

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.

:on_behalf_of :: ExOAPI.Stripe.Schemas.Account | :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.

:charge :: ExOAPI.Stripe.Schemas.Charge | :string

ID of the latest charge generated for this invoice, if any.

:account_name :: :string

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

:customer :: ExOAPI.Stripe.Schemas.DeletedCustomer | ExOAPI.Stripe.Schemas.Customer | :string

The ID of the customer who will be billed.

:amount_paid :: :integer

The amount, in %s, that was paid.

::account_tax_ids :: ExOAPI.Stripe.Schemas.DeletedTaxId | ExOAPI.Stripe.Schemas.TaxId | :string

:hosted_invoice_url :: :string

The 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.

:statement_descriptor :: :string

Extra information about an invoice for the customer's credit card statement.

:payment_settings :: ExOAPI.Stripe.Schemas.InvoicesPaymentSettings

:due_date :: :integer

The date on which payment for this invoice is due. This value will be null for invoices where collection_method=charge_automatically.

:default_source :: ExOAPI.Stripe.Schemas.Source | ExOAPI.Stripe.Schemas.Card | ExOAPI.Stripe.Schemas.BitcoinReceiver | ExOAPI.Stripe.Schemas.BankAccount | ExOAPI.Stripe.Schemas.AlipayAccount | :string

ID 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.

:receipt_number :: :string

This is the transaction number that appears on email receipts sent for this invoice.

:billing_reason :: :string

Indicates the reason why the invoice was created. subscription_cycle indicates an invoice created by a subscription advancing into a new period. subscription_create indicates an invoice created due to creating a subscription. subscription_update indicates an invoice created due to updating a subscription. subscription is set for all old invoices to indicate either a change to a subscription or a period advancement. manual is set for all invoices unrelated to a subscription (for example: created via the invoice editor). The upcoming value is reserved for simulated invoices per the upcoming invoice endpoint. subscription_threshold indicates an invoice created due to a billing threshold being reached.

:object :: :string

String representing the object's type. Objects of the same type share the same value.

:status_transitions :: ExOAPI.Stripe.Schemas.InvoicesStatusTransitions

:post_payment_credit_notes_amount :: :integer

Total amount of all post-payment credit notes issued for this invoice.

:test_clock :: ExOAPI.Stripe.Schemas.TestHelpers_testClock | :string

ID of the test clock this invoice belongs to.

:automatic_tax :: ExOAPI.Stripe.Schemas.AutomaticTax

:currency :: :string

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

::total_discount_amounts :: ExOAPI.Stripe.Schemas.DiscountsResourceDiscountAmount

:created :: :integer

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

::discounts :: ExOAPI.Stripe.Schemas.DeletedDiscount | ExOAPI.Stripe.Schemas.Discount | :string

:quote :: ExOAPI.Stripe.Schemas.Quote | :string

The quote this invoice was generated from.

:amount_remaining :: :integer

The amount remaining, in %s, that is due.

:period_end :: :integer

End of the usage period during which invoice items were added to this invoice.

:next_payment_attempt :: :integer

The time at which payment will next be attempted. This value will be null for invoices where collection_method=send_invoice.

:subscription :: ExOAPI.Stripe.Schemas.Subscription | :string

The subscription that this invoice was prepared for, if any.

:webhooks_delivered_at :: :integer

Invoices 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.

::total_tax_amounts :: ExOAPI.Stripe.Schemas.InvoiceTaxAmount

:status :: :string

The status of the invoice, one of draft, open, paid, uncollectible, or void. Learn more

:ending_balance :: :integer

Ending 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.

:customer_address :: ExOAPI.Stripe.Schemas.Address

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.

:number :: :string

A 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.

:application_fee_amount :: :integer

The fee in %s that will be applied to the invoice and transferred to the application owner's Stripe account when the invoice is paid.

:tax :: :integer

The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice.

:period_start :: :integer

Start of the usage period during which invoice items were added to this invoice.

:transfer_data :: ExOAPI.Stripe.Schemas.InvoiceTransferData

The account (if any) the payment will be attributed to for tax reporting, and where funds from the payment will be transferred to for the invoice.

: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.

:id :: :string

Unique identifier for the object.

::default_tax_rates :: ExOAPI.Stripe.Schemas.TaxRate

::data :: ExOAPI.Stripe.Schemas.LineItem

:has_more :: :boolean

True if this list has another page of items after this one that can be fetched.

:object :: :string

String representing the object's type. Objects of the same type share the same value. Always has the value list.

:url :: :string

The URL where this list can be accessed.

Link to this section Summary

Link to this section Types

@type params() :: map()
@type t() :: %ExOAPI.Stripe.Schemas.Invoice{
  account_country: String.t() | nil,
  account_name: String.t() | nil,
  account_tax_ids: [ExOAPI.EctoTypes.AnyOf.t()] | nil,
  amount_due: integer() | nil,
  amount_paid: integer() | nil,
  amount_remaining: integer() | nil,
  application_fee_amount: integer() | nil,
  attempt_count: integer() | nil,
  attempted: boolean() | nil,
  auto_advance: boolean() | nil,
  automatic_tax: ExOAPI.Stripe.Schemas.AutomaticTax.t() | nil,
  billing_reason:
    (:upcoming
     | :subscription_update
     | :subscription_threshold
     | :subscription_cycle
     | :subscription_create
     | :subscription
     | :quote_accept
     | :manual
     | :automatic_pending_invoice_item_invoice)
    | nil,
  charge: ExOAPI.EctoTypes.AnyOf.t() | nil,
  collection_method: (:send_invoice | :charge_automatically) | nil,
  created: integer() | nil,
  currency: String.t() | nil,
  custom_fields: [ExOAPI.Stripe.Schemas.InvoiceSettingCustomField.t()],
  customer: ExOAPI.EctoTypes.AnyOf.t() | nil,
  customer_address: ExOAPI.EctoTypes.AnyOf.t() | nil,
  customer_email: String.t() | nil,
  customer_name: String.t() | nil,
  customer_phone: String.t() | nil,
  customer_shipping: ExOAPI.EctoTypes.AnyOf.t() | nil,
  customer_tax_exempt: (:reverse | :none | :exempt) | nil,
  customer_tax_ids: [ExOAPI.Stripe.Schemas.InvoicesResourceInvoiceTaxId.t()],
  default_payment_method: ExOAPI.EctoTypes.AnyOf.t() | nil,
  default_source: ExOAPI.EctoTypes.AnyOf.t() | nil,
  default_tax_rates: [ExOAPI.Stripe.Schemas.TaxRate.t()],
  description: String.t() | nil,
  discount: ExOAPI.EctoTypes.AnyOf.t() | nil,
  discounts: [ExOAPI.EctoTypes.AnyOf.t()] | nil,
  due_date: integer() | nil,
  ending_balance: integer() | nil,
  footer: String.t() | nil,
  hosted_invoice_url: String.t() | nil,
  id: String.t() | nil,
  invoice_pdf: String.t() | nil,
  last_finalization_error: ExOAPI.EctoTypes.AnyOf.t() | nil,
  lines: map() | nil,
  livemode: boolean() | nil,
  metadata: map() | nil,
  next_payment_attempt: integer() | nil,
  number: String.t() | nil,
  object: :invoice | nil,
  on_behalf_of: ExOAPI.EctoTypes.AnyOf.t() | nil,
  paid: boolean() | nil,
  paid_out_of_band: boolean() | nil,
  payment_intent: ExOAPI.EctoTypes.AnyOf.t() | nil,
  payment_settings: ExOAPI.Stripe.Schemas.InvoicesPaymentSettings.t() | nil,
  period_end: integer() | nil,
  period_start: integer() | nil,
  post_payment_credit_notes_amount: integer() | nil,
  pre_payment_credit_notes_amount: integer() | nil,
  quote: ExOAPI.EctoTypes.AnyOf.t() | nil,
  receipt_number: String.t() | nil,
  starting_balance: integer() | nil,
  statement_descriptor: String.t() | nil,
  status: (:void | :uncollectible | :paid | :open | :draft | :deleted) | nil,
  status_transitions: ExOAPI.Stripe.Schemas.InvoicesStatusTransitions.t() | nil,
  subscription: ExOAPI.EctoTypes.AnyOf.t() | nil,
  subscription_proration_date: integer() | nil,
  subtotal: integer() | nil,
  tax: integer() | nil,
  test_clock: ExOAPI.EctoTypes.AnyOf.t() | nil,
  threshold_reason: ExOAPI.Stripe.Schemas.InvoiceThresholdReason.t() | nil,
  total: integer() | nil,
  total_discount_amounts: [
    ExOAPI.Stripe.Schemas.DiscountsResourceDiscountAmount.t()
  ],
  total_tax_amounts: [ExOAPI.Stripe.Schemas.InvoiceTaxAmount.t()],
  transfer_data: ExOAPI.EctoTypes.AnyOf.t() | nil,
  webhooks_delivered_at: integer() | nil
}

Link to this section Functions

Link to this function

changeset(struct \\ %__MODULE__{}, params)

View Source
@spec changeset(t(), params()) :: Ecto.Changeset.t()