Struct Invoice

Source
pub struct Invoice {
Show 76 fields pub account_country: Option<String>, pub account_name: Option<String>, pub account_tax_ids: Option<Vec<Expandable<TaxId>>>, pub amount_due: i64, pub amount_overpaid: i64, pub amount_paid: i64, pub amount_remaining: i64, pub amount_shipping: i64, pub application: Option<Expandable<Application>>, pub attempt_count: u64, pub attempted: bool, pub auto_advance: Option<bool>, pub automatic_tax: AutomaticTax, pub automatically_finalizes_at: Option<Timestamp>, pub billing_reason: Option<InvoiceBillingReason>, pub collection_method: InvoiceCollectionMethod, pub confirmation_secret: Option<InvoicesResourceConfirmationSecret>, pub created: Timestamp, pub currency: Currency, pub custom_fields: Option<Vec<InvoiceSettingCustomField>>, pub customer: Option<Expandable<Customer>>, pub customer_address: Option<Address>, pub customer_email: Option<String>, pub customer_name: Option<String>, pub customer_phone: Option<String>, pub customer_shipping: Option<Shipping>, pub customer_tax_exempt: Option<InvoiceCustomerTaxExempt>, pub customer_tax_ids: Option<Vec<InvoicesResourceInvoiceTaxId>>, pub default_payment_method: Option<Expandable<PaymentMethod>>, pub default_source: Option<Expandable<PaymentSource>>, pub default_tax_rates: Vec<TaxRate>, pub description: Option<String>, pub discounts: Vec<Expandable<Discount>>, pub due_date: Option<Timestamp>, pub effective_at: Option<Timestamp>, pub ending_balance: Option<i64>, pub footer: Option<String>, pub from_invoice: Option<InvoicesResourceFromInvoice>, pub hosted_invoice_url: Option<String>, pub id: Option<InvoiceId>, pub invoice_pdf: Option<String>, pub issuer: ConnectAccountReference, pub last_finalization_error: Option<Box<ApiErrors>>, pub latest_revision: Option<Expandable<Invoice>>, pub lines: List<InvoiceLineItem>, pub livemode: bool, pub metadata: Option<HashMap<String, String>>, pub next_payment_attempt: Option<Timestamp>, pub number: Option<String>, pub on_behalf_of: Option<Expandable<Account>>, pub parent: Option<BillingBillResourceInvoicingParentsInvoiceParent>, pub payment_settings: InvoicesPaymentSettings, pub payments: Option<List<InvoicePayment>>, pub period_end: Timestamp, pub period_start: Timestamp, pub post_payment_credit_notes_amount: i64, pub pre_payment_credit_notes_amount: i64, pub receipt_number: Option<String>, pub rendering: Option<InvoicesResourceInvoiceRendering>, pub shipping_cost: Option<InvoicesResourceShippingCost>, pub shipping_details: Option<Shipping>, pub starting_balance: i64, pub statement_descriptor: Option<String>, pub status: Option<InvoiceStatus>, pub status_transitions: InvoicesResourceStatusTransitions, pub subscription: Option<Expandable<Subscription>>, pub subtotal: i64, pub subtotal_excluding_tax: Option<i64>, pub test_clock: Option<Expandable<TestHelpersTestClock>>, pub threshold_reason: Option<InvoiceThresholdReason>, pub total: i64, pub total_discount_amounts: Option<Vec<DiscountsResourceDiscountAmount>>, pub total_excluding_tax: Option<i64>, pub total_pretax_credit_amounts: Option<Vec<InvoicesResourcePretaxCreditAmount>>, pub total_taxes: Option<Vec<BillingBillResourceInvoicingTaxesTax>>, pub webhooks_delivered_at: Option<Timestamp>,
}
Expand 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

For more details see <https://stripe.com/docs/api/invoices/object>.

Fields§

§account_country: Option<String>

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

§account_name: Option<String>

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

§account_tax_ids: Option<Vec<Expandable<TaxId>>>

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

§amount_due: i64

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

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

§amount_paid: i64

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

§amount_remaining: i64

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

§amount_shipping: i64

This is the sum of all the shipping amounts.

§application: Option<Expandable<Application>>

ID of the Connect Application that created the invoice.

§attempt_count: u64

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

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: Option<bool>

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: AutomaticTax§automatically_finalizes_at: Option<Timestamp>

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_reason: Option<InvoiceBillingReason>

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 simulated invoices, per the upcoming invoice endpoint.
§collection_method: InvoiceCollectionMethod

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_secret: Option<InvoicesResourceConfirmationSecret>

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

§created: Timestamp

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

§currency: Currency

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

§custom_fields: Option<Vec<InvoiceSettingCustomField>>

Custom fields displayed on the invoice.

§customer: Option<Expandable<Customer>>

The ID of the customer who will be billed.

§customer_address: Option<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.

§customer_email: Option<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.

§customer_name: Option<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.

§customer_phone: Option<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.

§customer_shipping: Option<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.

§customer_tax_exempt: Option<InvoiceCustomerTaxExempt>

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_ids: Option<Vec<InvoicesResourceInvoiceTaxId>>

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.

§default_payment_method: Option<Expandable<PaymentMethod>>

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.

§default_source: Option<Expandable<PaymentSource>>

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.

§default_tax_rates: Vec<TaxRate>

The tax rates applied to this invoice, if any.

§description: Option<String>

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

§discounts: Vec<Expandable<Discount>>

The discounts applied to the invoice. Line item discounts are applied before invoice discounts. Use expand[]=discounts to expand each discount.

§due_date: Option<Timestamp>

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

§effective_at: Option<Timestamp>

The date when this invoice is in effect. Same as finalized_at unless overwritten. When defined, this value replaces the system-generated ‘Date of issue’ printed on the invoice PDF and receipt.

§ending_balance: Option<i64>

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.

§footer: Option<String>

Footer displayed on the invoice.

§from_invoice: Option<InvoicesResourceFromInvoice>

Details of the invoice that was cloned. See the revision documentation for more details.

§hosted_invoice_url: Option<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.

§id: Option<InvoiceId>

Unique identifier for the object. This property is always present unless the invoice is an upcoming invoice. See Retrieve an upcoming invoice for more details.

§invoice_pdf: Option<String>

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

§issuer: ConnectAccountReference§last_finalization_error: Option<Box<ApiErrors>>

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

§latest_revision: Option<Expandable<Invoice>>

The ID of the most recent non-draft revision of this invoice

§lines: List<InvoiceLineItem>

The individual line items that make up the invoice. lines is 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.

§livemode: bool

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

§metadata: Option<HashMap<String, String>>

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.

§next_payment_attempt: Option<Timestamp>

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

§number: Option<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.

§on_behalf_of: Option<Expandable<Account>>

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.

§parent: Option<BillingBillResourceInvoicingParentsInvoiceParent>

The parent that generated this invoice

§payment_settings: InvoicesPaymentSettings§payments: Option<List<InvoicePayment>>

Payments for this invoice

§period_end: Timestamp

End 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_start: Timestamp

Start 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_amount: i64

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

§pre_payment_credit_notes_amount: i64

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

§receipt_number: Option<String>

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

§rendering: Option<InvoicesResourceInvoiceRendering>

The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page.

§shipping_cost: Option<InvoicesResourceShippingCost>

The details of the cost of shipping, including the ShippingRate applied on the invoice.

§shipping_details: Option<Shipping>

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.

§starting_balance: i64

Starting 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_descriptor: Option<String>

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

§status: Option<InvoiceStatus>

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

§status_transitions: InvoicesResourceStatusTransitions§subscription: Option<Expandable<Subscription>>§subtotal: i64

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

§subtotal_excluding_tax: Option<i64>

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

§test_clock: Option<Expandable<TestHelpersTestClock>>

ID of the test clock this invoice belongs to.

§threshold_reason: Option<InvoiceThresholdReason>§total: i64

Total after discounts and taxes.

§total_discount_amounts: Option<Vec<DiscountsResourceDiscountAmount>>

The aggregate amounts calculated per discount across all line items.

§total_excluding_tax: Option<i64>

The integer amount in cents (or local equivalent) representing the total amount of the invoice including all discounts but excluding all tax.

§total_pretax_credit_amounts: Option<Vec<InvoicesResourcePretaxCreditAmount>>

Contains 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_taxes: Option<Vec<BillingBillResourceInvoicingTaxesTax>>

The aggregate tax information of all line items.

§webhooks_delivered_at: Option<Timestamp>

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.

Trait Implementations§

Source§

impl Clone for Invoice

Source§

fn clone(&self) -> Invoice

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Invoice

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Deserialize for Invoice

Source§

fn begin(out: &mut Option<Self>) -> &mut dyn Visitor

The only correct implementation of this method is: Read more
Source§

impl FromValueOpt for Invoice

Source§

impl Object for Invoice

Source§

type Id = Option<InvoiceId>

The canonical id type for this object.
Source§

fn id(&self) -> &Self::Id

The id of the object.
Source§

fn into_id(self) -> Self::Id

The owned id of the object.
Source§

impl ObjectDeser for Invoice

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.