stripe/resources/generated/
invoice.rs

1// ======================================
2// This file was automatically generated.
3// ======================================
4
5use serde::{Deserialize, Serialize};
6
7use crate::client::{Client, Response};
8use crate::ids::{CustomerId, InvoiceId, SubscriptionId};
9use crate::params::{
10    CurrencyMap, Deleted, Expand, Expandable, List, Metadata, Object, Paginable, RangeQuery,
11    Timestamp,
12};
13use crate::resources::{
14    Account, Address, ApiErrors, Application, Charge, ConnectAccountReference, Currency, Customer,
15    Discount, InvoiceLineItem, InvoicePaymentMethodOptionsAcssDebit,
16    InvoicePaymentMethodOptionsBancontact, InvoicePaymentMethodOptionsCustomerBalance,
17    InvoicePaymentMethodOptionsKonbini, InvoicePaymentMethodOptionsUsBankAccount,
18    InvoiceSettingRenderingOptions, InvoicesShippingCost, PaymentIntent, PaymentMethod,
19    PaymentSource, Quote, Shipping, Subscription, TaxId, TaxRate, TestHelpersTestClock,
20};
21
22/// The resource representing a Stripe "Invoice".
23///
24/// For more details see <https://stripe.com/docs/api/invoices/object>
25#[derive(Clone, Debug, Default, Deserialize, Serialize)]
26pub struct Invoice {
27    /// Unique identifier for the object.
28    ///
29    /// This property is always present unless the invoice is an upcoming invoice.
30    /// See [Retrieve an upcoming invoice](https://stripe.com/docs/api/invoices/upcoming) for more details.
31    #[serde(default = "InvoiceId::none")]
32    pub id: InvoiceId,
33
34    /// The country of the business associated with this invoice, most often the business creating the invoice.
35    #[serde(skip_serializing_if = "Option::is_none")]
36    pub account_country: Option<String>,
37
38    /// The public name of the business associated with this invoice, most often the business creating the invoice.
39    #[serde(skip_serializing_if = "Option::is_none")]
40    pub account_name: Option<String>,
41
42    /// The account tax IDs associated with the invoice.
43    ///
44    /// Only editable when the invoice is a draft.
45    #[serde(skip_serializing_if = "Option::is_none")]
46    pub account_tax_ids: Option<Vec<Expandable<TaxId>>>,
47
48    /// Final amount due at this time for this invoice.
49    ///
50    /// 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.
51    /// If there is a positive `starting_balance` for the invoice (the customer owes money), the `amount_due` will also take that into account.
52    /// The charge that gets generated for the invoice will be for the amount specified in `amount_due`.
53    #[serde(skip_serializing_if = "Option::is_none")]
54    pub amount_due: Option<i64>,
55
56    /// The amount, in cents (or local equivalent), that was paid.
57    #[serde(skip_serializing_if = "Option::is_none")]
58    pub amount_paid: Option<i64>,
59
60    /// The difference between amount_due and amount_paid, in cents (or local equivalent).
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub amount_remaining: Option<i64>,
63
64    /// This is the sum of all the shipping amounts.
65    #[serde(skip_serializing_if = "Option::is_none")]
66    pub amount_shipping: Option<i64>,
67
68    /// ID of the Connect Application that created the invoice.
69    #[serde(skip_serializing_if = "Option::is_none")]
70    pub application: Option<Expandable<Application>>,
71
72    /// The fee in cents (or local equivalent) that will be applied to the invoice and transferred to the application owner's Stripe account when the invoice is paid.
73    #[serde(skip_serializing_if = "Option::is_none")]
74    pub application_fee_amount: Option<i64>,
75
76    /// Number of payment attempts made for this invoice, from the perspective of the payment retry schedule.
77    ///
78    /// Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count.
79    /// In other words, manual payment attempts after the first attempt do not affect the retry schedule.
80    #[serde(skip_serializing_if = "Option::is_none")]
81    pub attempt_count: Option<u64>,
82
83    /// Whether an attempt has been made to pay the invoice.
84    ///
85    /// 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.
86    #[serde(skip_serializing_if = "Option::is_none")]
87    pub attempted: Option<bool>,
88
89    /// Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice.
90    ///
91    /// If `false`, the invoice's state doesn't automatically advance without an explicit action.
92    #[serde(skip_serializing_if = "Option::is_none")]
93    pub auto_advance: Option<bool>,
94
95    #[serde(skip_serializing_if = "Option::is_none")]
96    pub automatic_tax: Option<AutomaticTax>,
97
98    /// Indicates the reason why the invoice was created.
99    ///
100    /// * `manual`: Unrelated to a subscription, for example, created via the invoice editor.
101    /// * `subscription`: No longer in use.
102    ///
103    /// 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.
104    #[serde(skip_serializing_if = "Option::is_none")]
105    pub billing_reason: Option<InvoiceBillingReason>,
106
107    /// ID of the latest charge generated for this invoice, if any.
108    #[serde(skip_serializing_if = "Option::is_none")]
109    pub charge: Option<Expandable<Charge>>,
110
111    /// Either `charge_automatically`, or `send_invoice`.
112    ///
113    /// When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer.
114    /// When sending an invoice, Stripe will email this invoice to the customer with payment instructions.
115    #[serde(skip_serializing_if = "Option::is_none")]
116    pub collection_method: Option<CollectionMethod>,
117
118    /// Time at which the object was created.
119    ///
120    /// Measured in seconds since the Unix epoch.
121    #[serde(skip_serializing_if = "Option::is_none")]
122    pub created: Option<Timestamp>,
123
124    /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
125    ///
126    /// Must be a [supported currency](https://stripe.com/docs/currencies).
127    #[serde(skip_serializing_if = "Option::is_none")]
128    pub currency: Option<Currency>,
129
130    /// Custom fields displayed on the invoice.
131    #[serde(skip_serializing_if = "Option::is_none")]
132    pub custom_fields: Option<Vec<InvoiceSettingCustomField>>,
133
134    /// The ID of the customer who will be billed.
135    #[serde(skip_serializing_if = "Option::is_none")]
136    pub customer: Option<Expandable<Customer>>,
137
138    /// The customer's address.
139    ///
140    /// Until the invoice is finalized, this field will equal `customer.address`.
141    /// Once the invoice is finalized, this field will no longer be updated.
142    #[serde(skip_serializing_if = "Option::is_none")]
143    pub customer_address: Option<Address>,
144
145    /// The customer's email.
146    ///
147    /// Until the invoice is finalized, this field will equal `customer.email`.
148    /// Once the invoice is finalized, this field will no longer be updated.
149    #[serde(skip_serializing_if = "Option::is_none")]
150    pub customer_email: Option<String>,
151
152    /// The customer's name.
153    ///
154    /// Until the invoice is finalized, this field will equal `customer.name`.
155    /// Once the invoice is finalized, this field will no longer be updated.
156    #[serde(skip_serializing_if = "Option::is_none")]
157    pub customer_name: Option<String>,
158
159    /// The customer's phone number.
160    ///
161    /// Until the invoice is finalized, this field will equal `customer.phone`.
162    /// Once the invoice is finalized, this field will no longer be updated.
163    #[serde(skip_serializing_if = "Option::is_none")]
164    pub customer_phone: Option<String>,
165
166    /// The customer's shipping information.
167    ///
168    /// Until the invoice is finalized, this field will equal `customer.shipping`.
169    /// Once the invoice is finalized, this field will no longer be updated.
170    #[serde(skip_serializing_if = "Option::is_none")]
171    pub customer_shipping: Option<Shipping>,
172
173    /// The customer's tax exempt status.
174    ///
175    /// Until the invoice is finalized, this field will equal `customer.tax_exempt`.
176    /// Once the invoice is finalized, this field will no longer be updated.
177    #[serde(skip_serializing_if = "Option::is_none")]
178    pub customer_tax_exempt: Option<InvoiceCustomerTaxExempt>,
179
180    /// The customer's tax IDs.
181    ///
182    /// Until the invoice is finalized, this field will contain the same tax IDs as `customer.tax_ids`.
183    /// Once the invoice is finalized, this field will no longer be updated.
184    #[serde(skip_serializing_if = "Option::is_none")]
185    pub customer_tax_ids: Option<Vec<InvoicesResourceInvoiceTaxId>>,
186
187    /// ID of the default payment method for the invoice.
188    ///
189    /// It must belong to the customer associated with the invoice.
190    /// 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.
191    #[serde(skip_serializing_if = "Option::is_none")]
192    pub default_payment_method: Option<Expandable<PaymentMethod>>,
193
194    /// ID of the default payment source for the invoice.
195    ///
196    /// It must belong to the customer associated with the invoice and be in a chargeable state.
197    /// If not set, defaults to the subscription's default source, if any, or to the customer's default source.
198    #[serde(skip_serializing_if = "Option::is_none")]
199    pub default_source: Option<Expandable<PaymentSource>>,
200
201    /// The tax rates applied to this invoice, if any.
202    #[serde(skip_serializing_if = "Option::is_none")]
203    pub default_tax_rates: Option<Vec<TaxRate>>,
204
205    // Always true for a deleted object
206    #[serde(default)]
207    pub deleted: bool,
208
209    /// An arbitrary string attached to the object.
210    ///
211    /// Often useful for displaying to users.
212    /// Referenced as 'memo' in the Dashboard.
213    #[serde(skip_serializing_if = "Option::is_none")]
214    pub description: Option<String>,
215
216    /// Describes the current discount applied to this invoice, if there is one.
217    ///
218    /// Not populated if there are multiple discounts.
219    #[serde(skip_serializing_if = "Option::is_none")]
220    pub discount: Option<Discount>,
221
222    /// The discounts applied to the invoice.
223    ///
224    /// Line item discounts are applied before invoice discounts.
225    /// Use `expand[]=discounts` to expand each discount.
226    #[serde(skip_serializing_if = "Option::is_none")]
227    pub discounts: Option<Vec<Expandable<Discount>>>,
228
229    /// The date on which payment for this invoice is due.
230    ///
231    /// This value will be `null` for invoices where `collection_method=charge_automatically`.
232    #[serde(skip_serializing_if = "Option::is_none")]
233    pub due_date: Option<Timestamp>,
234
235    /// The date when this invoice is in effect.
236    ///
237    /// Same as `finalized_at` unless overwritten.
238    /// When defined, this value replaces the system-generated 'Date of issue' printed on the invoice PDF and receipt.
239    #[serde(skip_serializing_if = "Option::is_none")]
240    pub effective_at: Option<Timestamp>,
241
242    /// Ending customer balance after the invoice is finalized.
243    ///
244    /// Invoices are finalized approximately an hour after successful webhook delivery or when payment collection is attempted for the invoice.
245    /// If the invoice has not been finalized yet, this will be null.
246    #[serde(skip_serializing_if = "Option::is_none")]
247    pub ending_balance: Option<i64>,
248
249    /// Footer displayed on the invoice.
250    #[serde(skip_serializing_if = "Option::is_none")]
251    pub footer: Option<String>,
252
253    /// Details of the invoice that was cloned.
254    ///
255    /// See the [revision documentation](https://stripe.com/docs/invoicing/invoice-revisions) for more details.
256    #[serde(skip_serializing_if = "Option::is_none")]
257    pub from_invoice: Option<InvoicesFromInvoice>,
258
259    /// The URL for the hosted invoice page, which allows customers to view and pay an invoice.
260    ///
261    /// If the invoice has not been finalized yet, this will be null.
262    #[serde(skip_serializing_if = "Option::is_none")]
263    pub hosted_invoice_url: Option<String>,
264
265    /// The link to download the PDF for the invoice.
266    ///
267    /// If the invoice has not been finalized yet, this will be null.
268    #[serde(skip_serializing_if = "Option::is_none")]
269    pub invoice_pdf: Option<String>,
270
271    #[serde(skip_serializing_if = "Option::is_none")]
272    pub issuer: Option<ConnectAccountReference>,
273
274    /// The error encountered during the previous attempt to finalize the invoice.
275    ///
276    /// This field is cleared when the invoice is successfully finalized.
277    #[serde(skip_serializing_if = "Option::is_none")]
278    pub last_finalization_error: Option<Box<ApiErrors>>,
279
280    /// The ID of the most recent non-draft revision of this invoice.
281    #[serde(skip_serializing_if = "Option::is_none")]
282    pub latest_revision: Option<Expandable<Invoice>>,
283
284    /// The individual line items that make up the invoice.
285    ///
286    /// `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.
287    #[serde(skip_serializing_if = "Option::is_none")]
288    pub lines: Option<List<InvoiceLineItem>>,
289
290    /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
291    #[serde(skip_serializing_if = "Option::is_none")]
292    pub livemode: Option<bool>,
293
294    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
295    ///
296    /// This can be useful for storing additional information about the object in a structured format.
297    #[serde(skip_serializing_if = "Option::is_none")]
298    pub metadata: Option<Metadata>,
299
300    /// The time at which payment will next be attempted.
301    ///
302    /// This value will be `null` for invoices where `collection_method=send_invoice`.
303    #[serde(skip_serializing_if = "Option::is_none")]
304    pub next_payment_attempt: Option<Timestamp>,
305
306    /// A unique, identifying string that appears on emails sent to the customer for this invoice.
307    ///
308    /// This starts with the customer's unique invoice_prefix if it is specified.
309    #[serde(skip_serializing_if = "Option::is_none")]
310    pub number: Option<String>,
311
312    /// The account (if any) for which the funds of the invoice payment are intended.
313    ///
314    /// If set, the invoice will be presented with the branding and support information of the specified account.
315    /// See the [Invoices with Connect](https://stripe.com/docs/billing/invoices/connect) documentation for details.
316    #[serde(skip_serializing_if = "Option::is_none")]
317    pub on_behalf_of: Option<Expandable<Account>>,
318
319    /// Whether payment was successfully collected for this invoice.
320    ///
321    /// An invoice can be paid (most commonly) with a charge or with credit from the customer's account balance.
322    #[serde(skip_serializing_if = "Option::is_none")]
323    pub paid: Option<bool>,
324
325    /// Returns true if the invoice was manually marked paid, returns false if the invoice hasn't been paid yet or was paid on Stripe.
326    #[serde(skip_serializing_if = "Option::is_none")]
327    pub paid_out_of_band: Option<bool>,
328
329    /// The PaymentIntent associated with this invoice.
330    ///
331    /// The PaymentIntent is generated when the invoice is finalized, and can then be used to pay the invoice.
332    /// Note that voiding an invoice will cancel the PaymentIntent.
333    #[serde(skip_serializing_if = "Option::is_none")]
334    pub payment_intent: Option<Expandable<PaymentIntent>>,
335
336    #[serde(skip_serializing_if = "Option::is_none")]
337    pub payment_settings: Option<InvoicesPaymentSettings>,
338
339    /// End of the usage period during which invoice items were added to this invoice.
340    #[serde(skip_serializing_if = "Option::is_none")]
341    pub period_end: Option<Timestamp>,
342
343    /// Start of the usage period during which invoice items were added to this invoice.
344    #[serde(skip_serializing_if = "Option::is_none")]
345    pub period_start: Option<Timestamp>,
346
347    /// Total amount of all post-payment credit notes issued for this invoice.
348    #[serde(skip_serializing_if = "Option::is_none")]
349    pub post_payment_credit_notes_amount: Option<i64>,
350
351    /// Total amount of all pre-payment credit notes issued for this invoice.
352    #[serde(skip_serializing_if = "Option::is_none")]
353    pub pre_payment_credit_notes_amount: Option<i64>,
354
355    /// The quote this invoice was generated from.
356    #[serde(skip_serializing_if = "Option::is_none")]
357    pub quote: Option<Expandable<Quote>>,
358
359    /// This is the transaction number that appears on email receipts sent for this invoice.
360    #[serde(skip_serializing_if = "Option::is_none")]
361    pub receipt_number: Option<String>,
362
363    /// The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page.
364    #[serde(skip_serializing_if = "Option::is_none")]
365    pub rendering: Option<InvoicesInvoiceRendering>,
366
367    /// This is a legacy field that will be removed soon.
368    ///
369    /// For details about `rendering_options`, refer to `rendering` instead.
370    /// Options for invoice PDF rendering.
371    #[serde(skip_serializing_if = "Option::is_none")]
372    pub rendering_options: Option<InvoiceSettingRenderingOptions>,
373
374    /// The details of the cost of shipping, including the ShippingRate applied on the invoice.
375    #[serde(skip_serializing_if = "Option::is_none")]
376    pub shipping_cost: Option<InvoicesShippingCost>,
377
378    /// Shipping details for the invoice.
379    ///
380    /// The Invoice PDF will use the `shipping_details` value if it is set, otherwise the PDF will render the shipping address from the customer.
381    #[serde(skip_serializing_if = "Option::is_none")]
382    pub shipping_details: Option<Shipping>,
383
384    /// Starting customer balance before the invoice is finalized.
385    ///
386    /// If the invoice has not been finalized yet, this will be the current customer balance.
387    /// For revision invoices, this also includes any customer balance that was applied to the original invoice.
388    #[serde(skip_serializing_if = "Option::is_none")]
389    pub starting_balance: Option<i64>,
390
391    /// Extra information about an invoice for the customer's credit card statement.
392    #[serde(skip_serializing_if = "Option::is_none")]
393    pub statement_descriptor: Option<String>,
394
395    /// The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`.
396    ///
397    /// [Learn more](https://stripe.com/docs/billing/invoices/workflow#workflow-overview).
398    #[serde(skip_serializing_if = "Option::is_none")]
399    pub status: Option<InvoiceStatus>,
400
401    #[serde(skip_serializing_if = "Option::is_none")]
402    pub status_transitions: Option<InvoicesStatusTransitions>,
403
404    /// The subscription that this invoice was prepared for, if any.
405    #[serde(skip_serializing_if = "Option::is_none")]
406    pub subscription: Option<Expandable<Subscription>>,
407
408    /// Details about the subscription that created this invoice.
409    #[serde(skip_serializing_if = "Option::is_none")]
410    pub subscription_details: Option<SubscriptionDetailsData>,
411
412    /// Only set for upcoming invoices that preview prorations.
413    ///
414    /// The time used to calculate prorations.
415    #[serde(skip_serializing_if = "Option::is_none")]
416    pub subscription_proration_date: Option<Timestamp>,
417
418    /// Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or exclusive tax is applied.
419    ///
420    /// Item discounts are already incorporated.
421    #[serde(skip_serializing_if = "Option::is_none")]
422    pub subtotal: Option<i64>,
423
424    /// The integer amount in cents (or local equivalent) representing the subtotal of the invoice before any invoice level discount or tax is applied.
425    ///
426    /// Item discounts are already incorporated.
427    #[serde(skip_serializing_if = "Option::is_none")]
428    pub subtotal_excluding_tax: Option<i64>,
429
430    /// The amount of tax on this invoice.
431    ///
432    /// This is the sum of all the tax amounts on this invoice.
433    #[serde(skip_serializing_if = "Option::is_none")]
434    pub tax: Option<i64>,
435
436    /// ID of the test clock this invoice belongs to.
437    #[serde(skip_serializing_if = "Option::is_none")]
438    pub test_clock: Option<Expandable<TestHelpersTestClock>>,
439
440    #[serde(skip_serializing_if = "Option::is_none")]
441    pub threshold_reason: Option<InvoiceThresholdReason>,
442
443    /// Total after discounts and taxes.
444    #[serde(skip_serializing_if = "Option::is_none")]
445    pub total: Option<i64>,
446
447    /// The aggregate amounts calculated per discount across all line items.
448    #[serde(skip_serializing_if = "Option::is_none")]
449    pub total_discount_amounts: Option<Vec<DiscountsResourceDiscountAmount>>,
450
451    /// The integer amount in cents (or local equivalent) representing the total amount of the invoice including all discounts but excluding all tax.
452    #[serde(skip_serializing_if = "Option::is_none")]
453    pub total_excluding_tax: Option<i64>,
454
455    /// The aggregate amounts calculated per tax rate for all line items.
456    #[serde(skip_serializing_if = "Option::is_none")]
457    pub total_tax_amounts: Option<Vec<TaxAmount>>,
458
459    /// 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.
460    #[serde(skip_serializing_if = "Option::is_none")]
461    pub transfer_data: Option<InvoiceTransferData>,
462
463    /// Invoices are automatically paid or sent 1 hour after webhooks are delivered, or until all webhook delivery attempts have [been exhausted](https://stripe.com/docs/billing/webhooks#understand).
464    ///
465    /// This field tracks the time when webhooks for this invoice were successfully delivered.
466    /// If the invoice had no webhooks to deliver, this will be set while the invoice is being created.
467    #[serde(skip_serializing_if = "Option::is_none")]
468    pub webhooks_delivered_at: Option<Timestamp>,
469}
470
471impl Invoice {
472    /// You can list all invoices, or list the invoices for a specific customer.
473    ///
474    /// The invoices are returned sorted by creation date, with the most recently created invoices appearing first.
475    pub fn list(client: &Client, params: &ListInvoices<'_>) -> Response<List<Invoice>> {
476        client.get_query("/invoices", params)
477    }
478
479    /// This endpoint creates a draft invoice for a given customer.
480    ///
481    /// The invoice remains a draft until you [finalize](https://stripe.com/docs/api#finalize_invoice) the invoice, which allows you to [pay](https://stripe.com/docs/api#pay_invoice) or [send](https://stripe.com/docs/api#send_invoice) the invoice to your customers.
482    pub fn create(client: &Client, params: CreateInvoice<'_>) -> Response<Invoice> {
483        #[allow(clippy::needless_borrows_for_generic_args)]
484        client.post_form("/invoices", &params)
485    }
486
487    /// Retrieves the invoice with the given ID.
488    pub fn retrieve(client: &Client, id: &InvoiceId, expand: &[&str]) -> Response<Invoice> {
489        client.get_query(&format!("/invoices/{}", id), Expand { expand })
490    }
491
492    /// Permanently deletes a one-off invoice draft.
493    ///
494    /// This cannot be undone.
495    /// 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](https://stripe.com/docs/api#void_invoice).
496    pub fn delete(client: &Client, id: &InvoiceId) -> Response<Deleted<InvoiceId>> {
497        client.delete(&format!("/invoices/{}", id))
498    }
499}
500
501impl Object for Invoice {
502    type Id = InvoiceId;
503    fn id(&self) -> Self::Id {
504        self.id.clone()
505    }
506    fn object(&self) -> &'static str {
507        "invoice"
508    }
509}
510
511#[derive(Clone, Debug, Default, Deserialize, Serialize)]
512pub struct AutomaticTax {
513    /// Whether Stripe automatically computes tax on this invoice.
514    ///
515    /// Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices.
516    pub enabled: bool,
517
518    /// The account that's liable for tax.
519    ///
520    /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account.
521    /// The tax transaction is returned in the report of the connected account.
522    pub liability: Option<ConnectAccountReference>,
523
524    /// The status of the most recent automated tax calculation for this invoice.
525    pub status: Option<AutomaticTaxStatus>,
526}
527
528#[derive(Clone, Debug, Default, Deserialize, Serialize)]
529pub struct DiscountsResourceDiscountAmount {
530    /// The amount, in cents (or local equivalent), of the discount.
531    pub amount: i64,
532
533    /// The discount that was applied to get this discount amount.
534    pub discount: Expandable<Discount>,
535}
536
537#[derive(Clone, Debug, Default, Deserialize, Serialize)]
538pub struct InvoiceSettingCustomField {
539    /// The name of the custom field.
540    pub name: String,
541
542    /// The value of the custom field.
543    pub value: String,
544}
545
546#[derive(Clone, Debug, Default, Deserialize, Serialize)]
547pub struct TaxAmount {
548    /// The amount, in cents (or local equivalent), of the tax.
549    pub amount: i64,
550
551    /// Whether this tax amount is inclusive or exclusive.
552    pub inclusive: bool,
553
554    /// The tax rate that was applied to get this tax amount.
555    pub tax_rate: Expandable<TaxRate>,
556
557    /// The reasoning behind this tax, for example, if the product is tax exempt.
558    ///
559    /// The possible values for this field may be extended as new tax rules are supported.
560    pub taxability_reason: Option<TaxAmountTaxabilityReason>,
561
562    /// The amount on which tax is calculated, in cents (or local equivalent).
563    pub taxable_amount: Option<i64>,
564}
565
566#[derive(Clone, Debug, Default, Deserialize, Serialize)]
567pub struct InvoiceThresholdReason {
568    /// The total invoice amount threshold boundary if it triggered the threshold invoice.
569    pub amount_gte: Option<i64>,
570
571    /// Indicates which line items triggered a threshold invoice.
572    pub item_reasons: Vec<InvoiceItemThresholdReason>,
573}
574
575#[derive(Clone, Debug, Default, Deserialize, Serialize)]
576pub struct InvoiceItemThresholdReason {
577    /// The IDs of the line items that triggered the threshold invoice.
578    pub line_item_ids: Vec<String>,
579
580    /// The quantity threshold boundary that applied to the given line item.
581    pub usage_gte: i64,
582}
583
584#[derive(Clone, Debug, Default, Deserialize, Serialize)]
585pub struct InvoiceTransferData {
586    /// The amount in cents (or local equivalent) that will be transferred to the destination account when the invoice is paid.
587    ///
588    /// By default, the entire amount is transferred to the destination.
589    pub amount: Option<i64>,
590
591    /// The account where funds from the payment will be transferred to upon payment success.
592    pub destination: Expandable<Account>,
593}
594
595#[derive(Clone, Debug, Default, Deserialize, Serialize)]
596pub struct InvoicesFromInvoice {
597    /// The relation between this invoice and the cloned invoice.
598    pub action: String,
599
600    /// The invoice that was cloned.
601    pub invoice: Expandable<Invoice>,
602}
603
604#[derive(Clone, Debug, Default, Deserialize, Serialize)]
605pub struct InvoicesInvoiceRendering {
606    /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
607    pub amount_tax_display: Option<String>,
608
609    /// Invoice pdf rendering options.
610    pub pdf: Option<InvoiceRenderingPdf>,
611}
612
613#[derive(Clone, Debug, Default, Deserialize, Serialize)]
614pub struct InvoiceRenderingPdf {
615    /// Page size of invoice pdf.
616    ///
617    /// Options include a4, letter, and auto.
618    /// If set to auto, page size will be switched to a4 or letter based on customer locale.
619    pub page_size: Option<InvoiceRenderingPdfPageSize>,
620}
621
622#[derive(Clone, Debug, Default, Deserialize, Serialize)]
623pub struct InvoicesPaymentSettings {
624    /// ID of the mandate to be used for this invoice.
625    ///
626    /// It must correspond to the payment method used to pay the invoice, including the invoice's default_payment_method or default_source, if set.
627    pub default_mandate: Option<String>,
628
629    /// Payment-method-specific configuration to provide to the invoice’s PaymentIntent.
630    pub payment_method_options: Option<InvoicesPaymentMethodOptions>,
631
632    /// The list of payment method types (e.g.
633    ///
634    /// card) to provide to the invoice’s PaymentIntent.
635    /// If not set, Stripe attempts to automatically determine the types to use by looking at the invoice’s default payment method, the subscription’s default payment method, the customer’s default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice).
636    pub payment_method_types: Option<Vec<InvoicesPaymentSettingsPaymentMethodTypes>>,
637}
638
639#[derive(Clone, Debug, Default, Deserialize, Serialize)]
640pub struct InvoicesPaymentMethodOptions {
641    /// If paying by `acss_debit`, this sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice’s PaymentIntent.
642    pub acss_debit: Option<InvoicePaymentMethodOptionsAcssDebit>,
643
644    /// If paying by `bancontact`, this sub-hash contains details about the Bancontact payment method options to pass to the invoice’s PaymentIntent.
645    pub bancontact: Option<InvoicePaymentMethodOptionsBancontact>,
646
647    /// If paying by `card`, this sub-hash contains details about the Card payment method options to pass to the invoice’s PaymentIntent.
648    pub card: Option<InvoicePaymentMethodOptionsCard>,
649
650    /// If paying by `customer_balance`, this sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent.
651    pub customer_balance: Option<InvoicePaymentMethodOptionsCustomerBalance>,
652
653    /// If paying by `konbini`, this sub-hash contains details about the Konbini payment method options to pass to the invoice’s PaymentIntent.
654    pub konbini: Option<InvoicePaymentMethodOptionsKonbini>,
655
656    /// If paying by `us_bank_account`, this sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent.
657    pub us_bank_account: Option<InvoicePaymentMethodOptionsUsBankAccount>,
658}
659
660#[derive(Clone, Debug, Default, Deserialize, Serialize)]
661pub struct InvoicePaymentMethodOptionsCard {
662    #[serde(skip_serializing_if = "Option::is_none")]
663    pub installments: Option<InvoiceInstallmentsCard>,
664
665    /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication).
666    ///
667    /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option.
668    /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
669    pub request_three_d_secure: Option<InvoicePaymentMethodOptionsCardRequestThreeDSecure>,
670}
671
672#[derive(Clone, Debug, Default, Deserialize, Serialize)]
673pub struct InvoiceInstallmentsCard {
674    /// Whether Installments are enabled for this Invoice.
675    pub enabled: Option<bool>,
676}
677
678#[derive(Clone, Debug, Default, Deserialize, Serialize)]
679pub struct InvoicesResourceInvoiceTaxId {
680    /// 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`, `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`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `li_uid`, `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`, or `unknown`.
681    #[serde(rename = "type")]
682    pub type_: TaxIdType,
683
684    /// The value of the tax ID.
685    pub value: Option<String>,
686}
687
688#[derive(Clone, Debug, Default, Deserialize, Serialize)]
689pub struct InvoicesStatusTransitions {
690    /// The time that the invoice draft was finalized.
691    pub finalized_at: Option<Timestamp>,
692
693    /// The time that the invoice was marked uncollectible.
694    pub marked_uncollectible_at: Option<Timestamp>,
695
696    /// The time that the invoice was paid.
697    pub paid_at: Option<Timestamp>,
698
699    /// The time that the invoice was voided.
700    pub voided_at: Option<Timestamp>,
701}
702
703#[derive(Clone, Debug, Default, Deserialize, Serialize)]
704pub struct SubscriptionDetailsData {
705    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will reflect the metadata of the subscription at the time of invoice creation.
706    ///
707    /// *Note: This attribute is populated only for invoices created on or after June 29, 2023.*.
708    pub metadata: Option<Metadata>,
709}
710
711/// The parameters for `Invoice::create`.
712#[derive(Clone, Debug, Serialize, Default)]
713pub struct CreateInvoice<'a> {
714    /// The account tax IDs associated with the invoice.
715    ///
716    /// Only editable when the invoice is a draft.
717    #[serde(skip_serializing_if = "Option::is_none")]
718    pub account_tax_ids: Option<Vec<String>>,
719
720    /// A fee in cents (or local equivalent) that will be applied to the invoice and transferred to the application owner's Stripe account.
721    ///
722    /// The request must be made with an OAuth key or the Stripe-Account header in order to take an application fee.
723    /// For more information, see the application fees [documentation](https://stripe.com/docs/billing/invoices/connect#collecting-fees).
724    #[serde(skip_serializing_if = "Option::is_none")]
725    pub application_fee_amount: Option<i64>,
726
727    /// Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice.
728    ///
729    /// If `false`, the invoice's state doesn't automatically advance without an explicit action.
730    #[serde(skip_serializing_if = "Option::is_none")]
731    pub auto_advance: Option<bool>,
732
733    /// Settings for automatic tax lookup for this invoice.
734    #[serde(skip_serializing_if = "Option::is_none")]
735    pub automatic_tax: Option<CreateInvoiceAutomaticTax>,
736
737    /// Either `charge_automatically`, or `send_invoice`.
738    ///
739    /// When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer.
740    /// When sending an invoice, Stripe will email this invoice to the customer with payment instructions.
741    /// Defaults to `charge_automatically`.
742    #[serde(skip_serializing_if = "Option::is_none")]
743    pub collection_method: Option<CollectionMethod>,
744
745    /// The currency to create this invoice in.
746    ///
747    /// Defaults to that of `customer` if not specified.
748    #[serde(skip_serializing_if = "Option::is_none")]
749    pub currency: Option<Currency>,
750
751    /// A list of up to 4 custom fields to be displayed on the invoice.
752    #[serde(skip_serializing_if = "Option::is_none")]
753    pub custom_fields: Option<Vec<CreateInvoiceCustomFields>>,
754
755    /// The ID of the customer who will be billed.
756    #[serde(skip_serializing_if = "Option::is_none")]
757    pub customer: Option<CustomerId>,
758
759    /// The number of days from when the invoice is created until it is due.
760    ///
761    /// Valid only for invoices where `collection_method=send_invoice`.
762    #[serde(skip_serializing_if = "Option::is_none")]
763    pub days_until_due: Option<u32>,
764
765    /// ID of the default payment method for the invoice.
766    ///
767    /// It must belong to the customer associated with the invoice.
768    /// 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.
769    #[serde(skip_serializing_if = "Option::is_none")]
770    pub default_payment_method: Option<&'a str>,
771
772    /// ID of the default payment source for the invoice.
773    ///
774    /// It must belong to the customer associated with the invoice and be in a chargeable state.
775    /// If not set, defaults to the subscription's default source, if any, or to the customer's default source.
776    #[serde(skip_serializing_if = "Option::is_none")]
777    pub default_source: Option<&'a str>,
778
779    /// The tax rates that will apply to any line item that does not have `tax_rates` set.
780    #[serde(skip_serializing_if = "Option::is_none")]
781    pub default_tax_rates: Option<Vec<String>>,
782
783    /// An arbitrary string attached to the object.
784    ///
785    /// Often useful for displaying to users.
786    /// Referenced as 'memo' in the Dashboard.
787    #[serde(skip_serializing_if = "Option::is_none")]
788    pub description: Option<&'a str>,
789
790    /// The coupons to redeem into discounts for the invoice.
791    ///
792    /// If not specified, inherits the discount from the invoice's customer.
793    /// Pass an empty string to avoid inheriting any discounts.
794    #[serde(skip_serializing_if = "Option::is_none")]
795    pub discounts: Option<Vec<CreateInvoiceDiscounts>>,
796
797    /// The date on which payment for this invoice is due.
798    ///
799    /// Valid only for invoices where `collection_method=send_invoice`.
800    #[serde(skip_serializing_if = "Option::is_none")]
801    pub due_date: Option<Timestamp>,
802
803    /// The date when this invoice is in effect.
804    ///
805    /// Same as `finalized_at` unless overwritten.
806    /// When defined, this value replaces the system-generated 'Date of issue' printed on the invoice PDF and receipt.
807    #[serde(skip_serializing_if = "Option::is_none")]
808    pub effective_at: Option<Timestamp>,
809
810    /// Specifies which fields in the response should be expanded.
811    #[serde(skip_serializing_if = "Expand::is_empty")]
812    pub expand: &'a [&'a str],
813
814    /// Footer to be displayed on the invoice.
815    #[serde(skip_serializing_if = "Option::is_none")]
816    pub footer: Option<&'a str>,
817
818    /// Revise an existing invoice.
819    ///
820    /// The new invoice will be created in `status=draft`.
821    /// See the [revision documentation](https://stripe.com/docs/invoicing/invoice-revisions) for more details.
822    #[serde(skip_serializing_if = "Option::is_none")]
823    pub from_invoice: Option<CreateInvoiceFromInvoice>,
824
825    /// The connected account that issues the invoice.
826    ///
827    /// The invoice is presented with the branding and support information of the specified account.
828    #[serde(skip_serializing_if = "Option::is_none")]
829    pub issuer: Option<CreateInvoiceIssuer>,
830
831    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
832    ///
833    /// This can be useful for storing additional information about the object in a structured format.
834    /// Individual keys can be unset by posting an empty value to them.
835    /// All keys can be unset by posting an empty value to `metadata`.
836    #[serde(skip_serializing_if = "Option::is_none")]
837    pub metadata: Option<Metadata>,
838
839    /// The account (if any) for which the funds of the invoice payment are intended.
840    ///
841    /// If set, the invoice will be presented with the branding and support information of the specified account.
842    /// See the [Invoices with Connect](https://stripe.com/docs/billing/invoices/connect) documentation for details.
843    #[serde(skip_serializing_if = "Option::is_none")]
844    pub on_behalf_of: Option<&'a str>,
845
846    /// Configuration settings for the PaymentIntent that is generated when the invoice is finalized.
847    #[serde(skip_serializing_if = "Option::is_none")]
848    pub payment_settings: Option<CreateInvoicePaymentSettings>,
849
850    /// How to handle pending invoice items on invoice creation.
851    ///
852    /// One of `include` or `exclude`.
853    /// `include` will include any pending invoice items, and will create an empty draft invoice if no pending invoice items exist.
854    /// `exclude` will always create an empty invoice draft regardless if there are pending invoice items or not.
855    /// Defaults to `exclude` if the parameter is omitted.
856    #[serde(skip_serializing_if = "Option::is_none")]
857    pub pending_invoice_items_behavior: Option<InvoicePendingInvoiceItemsBehavior>,
858
859    /// The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page.
860    #[serde(skip_serializing_if = "Option::is_none")]
861    pub rendering: Option<CreateInvoiceRendering>,
862
863    /// This is a legacy field that will be removed soon.
864    ///
865    /// For details about `rendering_options`, refer to `rendering` instead.
866    /// Options for invoice PDF rendering.
867    #[serde(skip_serializing_if = "Option::is_none")]
868    pub rendering_options: Option<CreateInvoiceRenderingOptions>,
869
870    /// Settings for the cost of shipping for this invoice.
871    #[serde(skip_serializing_if = "Option::is_none")]
872    pub shipping_cost: Option<CreateInvoiceShippingCost>,
873
874    /// Shipping details for the invoice.
875    ///
876    /// The Invoice PDF will use the `shipping_details` value if it is set, otherwise the PDF will render the shipping address from the customer.
877    #[serde(skip_serializing_if = "Option::is_none")]
878    pub shipping_details: Option<CreateInvoiceShippingDetails>,
879
880    /// Extra information about a charge for the customer's credit card statement.
881    ///
882    /// It must contain at least one letter.
883    /// If not specified and this invoice is part of a subscription, the default `statement_descriptor` will be set to the first subscription item's product's `statement_descriptor`.
884    #[serde(skip_serializing_if = "Option::is_none")]
885    pub statement_descriptor: Option<&'a str>,
886
887    /// The ID of the subscription to invoice, if any.
888    ///
889    /// If set, the created invoice will only include pending invoice items for that subscription.
890    /// The subscription's billing cycle and regular subscription events won't be affected.
891    #[serde(skip_serializing_if = "Option::is_none")]
892    pub subscription: Option<SubscriptionId>,
893
894    /// 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.
895    #[serde(skip_serializing_if = "Option::is_none")]
896    pub transfer_data: Option<CreateInvoiceTransferData>,
897}
898
899impl<'a> CreateInvoice<'a> {
900    pub fn new() -> Self {
901        CreateInvoice {
902            account_tax_ids: Default::default(),
903            application_fee_amount: Default::default(),
904            auto_advance: Default::default(),
905            automatic_tax: Default::default(),
906            collection_method: Default::default(),
907            currency: Default::default(),
908            custom_fields: Default::default(),
909            customer: Default::default(),
910            days_until_due: Default::default(),
911            default_payment_method: Default::default(),
912            default_source: Default::default(),
913            default_tax_rates: Default::default(),
914            description: Default::default(),
915            discounts: Default::default(),
916            due_date: Default::default(),
917            effective_at: Default::default(),
918            expand: Default::default(),
919            footer: Default::default(),
920            from_invoice: Default::default(),
921            issuer: Default::default(),
922            metadata: Default::default(),
923            on_behalf_of: Default::default(),
924            payment_settings: Default::default(),
925            pending_invoice_items_behavior: Default::default(),
926            rendering: Default::default(),
927            rendering_options: Default::default(),
928            shipping_cost: Default::default(),
929            shipping_details: Default::default(),
930            statement_descriptor: Default::default(),
931            subscription: Default::default(),
932            transfer_data: Default::default(),
933        }
934    }
935}
936
937/// The parameters for `Invoice::list`.
938#[derive(Clone, Debug, Serialize, Default)]
939pub struct ListInvoices<'a> {
940    /// The collection method of the invoice to retrieve.
941    ///
942    /// Either `charge_automatically` or `send_invoice`.
943    #[serde(skip_serializing_if = "Option::is_none")]
944    pub collection_method: Option<CollectionMethod>,
945
946    #[serde(skip_serializing_if = "Option::is_none")]
947    pub created: Option<RangeQuery<Timestamp>>,
948
949    /// Only return invoices for the customer specified by this customer ID.
950    #[serde(skip_serializing_if = "Option::is_none")]
951    pub customer: Option<CustomerId>,
952
953    #[serde(skip_serializing_if = "Option::is_none")]
954    pub due_date: Option<RangeQuery<Timestamp>>,
955
956    /// A cursor for use in pagination.
957    ///
958    /// `ending_before` is an object ID that defines your place in the list.
959    /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
960    #[serde(skip_serializing_if = "Option::is_none")]
961    pub ending_before: Option<InvoiceId>,
962
963    /// Specifies which fields in the response should be expanded.
964    #[serde(skip_serializing_if = "Expand::is_empty")]
965    pub expand: &'a [&'a str],
966
967    /// A limit on the number of objects to be returned.
968    ///
969    /// Limit can range between 1 and 100, and the default is 10.
970    #[serde(skip_serializing_if = "Option::is_none")]
971    pub limit: Option<u64>,
972
973    /// A cursor for use in pagination.
974    ///
975    /// `starting_after` is an object ID that defines your place in the list.
976    /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
977    #[serde(skip_serializing_if = "Option::is_none")]
978    pub starting_after: Option<InvoiceId>,
979
980    /// The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`.
981    ///
982    /// [Learn more](https://stripe.com/docs/billing/invoices/workflow#workflow-overview).
983    #[serde(skip_serializing_if = "Option::is_none")]
984    pub status: Option<InvoiceStatus>,
985
986    /// Only return invoices for the subscription specified by this subscription ID.
987    #[serde(skip_serializing_if = "Option::is_none")]
988    pub subscription: Option<SubscriptionId>,
989}
990
991impl<'a> ListInvoices<'a> {
992    pub fn new() -> Self {
993        ListInvoices {
994            collection_method: Default::default(),
995            created: Default::default(),
996            customer: Default::default(),
997            due_date: Default::default(),
998            ending_before: Default::default(),
999            expand: Default::default(),
1000            limit: Default::default(),
1001            starting_after: Default::default(),
1002            status: Default::default(),
1003            subscription: Default::default(),
1004        }
1005    }
1006}
1007impl Paginable for ListInvoices<'_> {
1008    type O = Invoice;
1009    fn set_last(&mut self, item: Self::O) {
1010        self.starting_after = Some(item.id());
1011    }
1012}
1013#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1014pub struct CreateInvoiceAutomaticTax {
1015    /// Whether Stripe automatically computes tax on this invoice.
1016    ///
1017    /// Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices.
1018    pub enabled: bool,
1019
1020    /// The account that's liable for tax.
1021    ///
1022    /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account.
1023    /// The tax transaction is returned in the report of the connected account.
1024    #[serde(skip_serializing_if = "Option::is_none")]
1025    pub liability: Option<CreateInvoiceAutomaticTaxLiability>,
1026}
1027
1028#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1029pub struct CreateInvoiceCustomFields {
1030    /// The name of the custom field.
1031    ///
1032    /// This may be up to 30 characters.
1033    pub name: String,
1034
1035    /// The value of the custom field.
1036    ///
1037    /// This may be up to 30 characters.
1038    pub value: String,
1039}
1040
1041#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1042pub struct CreateInvoiceDiscounts {
1043    /// ID of the coupon to create a new discount for.
1044    #[serde(skip_serializing_if = "Option::is_none")]
1045    pub coupon: Option<String>,
1046
1047    /// ID of an existing discount on the object (or one of its ancestors) to reuse.
1048    #[serde(skip_serializing_if = "Option::is_none")]
1049    pub discount: Option<String>,
1050}
1051
1052#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1053pub struct CreateInvoiceFromInvoice {
1054    /// The relation between the new invoice and the original invoice.
1055    ///
1056    /// Currently, only 'revision' is permitted.
1057    pub action: CreateInvoiceFromInvoiceAction,
1058
1059    /// The `id` of the invoice that will be cloned.
1060    pub invoice: String,
1061}
1062
1063#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1064pub struct CreateInvoiceIssuer {
1065    /// The connected account being referenced when `type` is `account`.
1066    #[serde(skip_serializing_if = "Option::is_none")]
1067    pub account: Option<String>,
1068
1069    /// Type of the account referenced in the request.
1070    #[serde(rename = "type")]
1071    pub type_: CreateInvoiceIssuerType,
1072}
1073
1074#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1075pub struct CreateInvoicePaymentSettings {
1076    /// ID of the mandate to be used for this invoice.
1077    ///
1078    /// It must correspond to the payment method used to pay the invoice, including the invoice's default_payment_method or default_source, if set.
1079    #[serde(skip_serializing_if = "Option::is_none")]
1080    pub default_mandate: Option<String>,
1081
1082    /// Payment-method-specific configuration to provide to the invoice’s PaymentIntent.
1083    #[serde(skip_serializing_if = "Option::is_none")]
1084    pub payment_method_options: Option<CreateInvoicePaymentSettingsPaymentMethodOptions>,
1085
1086    /// The list of payment method types (e.g.
1087    ///
1088    /// card) to provide to the invoice’s PaymentIntent.
1089    /// If not set, Stripe attempts to automatically determine the types to use by looking at the invoice’s default payment method, the subscription’s default payment method, the customer’s default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice).
1090    #[serde(skip_serializing_if = "Option::is_none")]
1091    pub payment_method_types: Option<Vec<CreateInvoicePaymentSettingsPaymentMethodTypes>>,
1092}
1093
1094#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1095pub struct CreateInvoiceRendering {
1096    /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
1097    ///
1098    /// One of `exclude_tax` or `include_inclusive_tax`.
1099    /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts.
1100    /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts.
1101    #[serde(skip_serializing_if = "Option::is_none")]
1102    pub amount_tax_display: Option<CreateInvoiceRenderingAmountTaxDisplay>,
1103
1104    /// Invoice pdf rendering options.
1105    #[serde(skip_serializing_if = "Option::is_none")]
1106    pub pdf: Option<CreateInvoiceRenderingPdf>,
1107}
1108
1109#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1110pub struct CreateInvoiceRenderingOptions {
1111    /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
1112    ///
1113    /// One of `exclude_tax` or `include_inclusive_tax`.
1114    /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts.
1115    /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts.
1116    #[serde(skip_serializing_if = "Option::is_none")]
1117    pub amount_tax_display: Option<CreateInvoiceRenderingOptionsAmountTaxDisplay>,
1118}
1119
1120#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1121pub struct CreateInvoiceShippingCost {
1122    /// The ID of the shipping rate to use for this order.
1123    #[serde(skip_serializing_if = "Option::is_none")]
1124    pub shipping_rate: Option<String>,
1125
1126    /// Parameters to create a new ad-hoc shipping rate for this order.
1127    #[serde(skip_serializing_if = "Option::is_none")]
1128    pub shipping_rate_data: Option<CreateInvoiceShippingCostShippingRateData>,
1129}
1130
1131#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1132pub struct CreateInvoiceShippingDetails {
1133    /// Shipping address.
1134    pub address: CreateInvoiceShippingDetailsAddress,
1135
1136    /// Recipient name.
1137    pub name: String,
1138
1139    /// Recipient phone (including extension).
1140    #[serde(skip_serializing_if = "Option::is_none")]
1141    pub phone: Option<String>,
1142}
1143
1144#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1145pub struct CreateInvoiceTransferData {
1146    /// The amount that will be transferred automatically when the invoice is paid.
1147    ///
1148    /// If no amount is set, the full amount is transferred.
1149    #[serde(skip_serializing_if = "Option::is_none")]
1150    pub amount: Option<i64>,
1151
1152    /// ID of an existing, connected Stripe account.
1153    pub destination: String,
1154}
1155
1156#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1157pub struct CreateInvoiceAutomaticTaxLiability {
1158    /// The connected account being referenced when `type` is `account`.
1159    #[serde(skip_serializing_if = "Option::is_none")]
1160    pub account: Option<String>,
1161
1162    /// Type of the account referenced in the request.
1163    #[serde(rename = "type")]
1164    pub type_: CreateInvoiceAutomaticTaxLiabilityType,
1165}
1166
1167#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1168pub struct CreateInvoicePaymentSettingsPaymentMethodOptions {
1169    /// If paying by `acss_debit`, this sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice’s PaymentIntent.
1170    #[serde(skip_serializing_if = "Option::is_none")]
1171    pub acss_debit: Option<CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebit>,
1172
1173    /// If paying by `bancontact`, this sub-hash contains details about the Bancontact payment method options to pass to the invoice’s PaymentIntent.
1174    #[serde(skip_serializing_if = "Option::is_none")]
1175    pub bancontact: Option<CreateInvoicePaymentSettingsPaymentMethodOptionsBancontact>,
1176
1177    /// If paying by `card`, this sub-hash contains details about the Card payment method options to pass to the invoice’s PaymentIntent.
1178    #[serde(skip_serializing_if = "Option::is_none")]
1179    pub card: Option<CreateInvoicePaymentSettingsPaymentMethodOptionsCard>,
1180
1181    /// If paying by `customer_balance`, this sub-hash contains details about the Bank transfer payment method options to pass to the invoice’s PaymentIntent.
1182    #[serde(skip_serializing_if = "Option::is_none")]
1183    pub customer_balance: Option<CreateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalance>,
1184
1185    /// If paying by `konbini`, this sub-hash contains details about the Konbini payment method options to pass to the invoice’s PaymentIntent.
1186    #[serde(skip_serializing_if = "Option::is_none")]
1187    pub konbini: Option<CreateInvoicePaymentSettingsPaymentMethodOptionsKonbini>,
1188
1189    /// If paying by `us_bank_account`, this sub-hash contains details about the ACH direct debit payment method options to pass to the invoice’s PaymentIntent.
1190    #[serde(skip_serializing_if = "Option::is_none")]
1191    pub us_bank_account: Option<CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccount>,
1192}
1193
1194#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1195pub struct CreateInvoiceRenderingPdf {
1196    /// Page size for invoice PDF.
1197    ///
1198    /// Can be set to `a4`, `letter`, or `auto`.  If set to `auto`, invoice PDF page size defaults to `a4` for customers with  Japanese locale and `letter` for customers with other locales.
1199    #[serde(skip_serializing_if = "Option::is_none")]
1200    pub page_size: Option<CreateInvoiceRenderingPdfPageSize>,
1201}
1202
1203#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1204pub struct CreateInvoiceShippingCostShippingRateData {
1205    /// The estimated range for how long shipping will take, meant to be displayable to the customer.
1206    ///
1207    /// This will appear on CheckoutSessions.
1208    #[serde(skip_serializing_if = "Option::is_none")]
1209    pub delivery_estimate: Option<CreateInvoiceShippingCostShippingRateDataDeliveryEstimate>,
1210
1211    /// The name of the shipping rate, meant to be displayable to the customer.
1212    ///
1213    /// This will appear on CheckoutSessions.
1214    pub display_name: String,
1215
1216    /// Describes a fixed amount to charge for shipping.
1217    ///
1218    /// Must be present if type is `fixed_amount`.
1219    #[serde(skip_serializing_if = "Option::is_none")]
1220    pub fixed_amount: Option<CreateInvoiceShippingCostShippingRateDataFixedAmount>,
1221
1222    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
1223    ///
1224    /// This can be useful for storing additional information about the object in a structured format.
1225    /// Individual keys can be unset by posting an empty value to them.
1226    /// All keys can be unset by posting an empty value to `metadata`.
1227    #[serde(skip_serializing_if = "Option::is_none")]
1228    pub metadata: Option<Metadata>,
1229
1230    /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes.
1231    ///
1232    /// One of `inclusive`, `exclusive`, or `unspecified`.
1233    #[serde(skip_serializing_if = "Option::is_none")]
1234    pub tax_behavior: Option<CreateInvoiceShippingCostShippingRateDataTaxBehavior>,
1235
1236    /// A [tax code](https://stripe.com/docs/tax/tax-categories) ID.
1237    ///
1238    /// The Shipping tax code is `txcd_92010001`.
1239    #[serde(skip_serializing_if = "Option::is_none")]
1240    pub tax_code: Option<String>,
1241
1242    /// The type of calculation to use on the shipping rate.
1243    ///
1244    /// Can only be `fixed_amount` for now.
1245    #[serde(rename = "type")]
1246    #[serde(skip_serializing_if = "Option::is_none")]
1247    pub type_: Option<CreateInvoiceShippingCostShippingRateDataType>,
1248}
1249
1250#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1251pub struct CreateInvoiceShippingDetailsAddress {
1252    /// City, district, suburb, town, or village.
1253    #[serde(skip_serializing_if = "Option::is_none")]
1254    pub city: Option<String>,
1255
1256    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
1257    #[serde(skip_serializing_if = "Option::is_none")]
1258    pub country: Option<String>,
1259
1260    /// Address line 1 (e.g., street, PO Box, or company name).
1261    #[serde(skip_serializing_if = "Option::is_none")]
1262    pub line1: Option<String>,
1263
1264    /// Address line 2 (e.g., apartment, suite, unit, or building).
1265    #[serde(skip_serializing_if = "Option::is_none")]
1266    pub line2: Option<String>,
1267
1268    /// ZIP or postal code.
1269    #[serde(skip_serializing_if = "Option::is_none")]
1270    pub postal_code: Option<String>,
1271
1272    /// State, county, province, or region.
1273    #[serde(skip_serializing_if = "Option::is_none")]
1274    pub state: Option<String>,
1275}
1276
1277#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1278pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebit {
1279    /// Additional fields for Mandate creation.
1280    #[serde(skip_serializing_if = "Option::is_none")]
1281    pub mandate_options:
1282        Option<CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions>,
1283
1284    /// Verification method for the intent.
1285    #[serde(skip_serializing_if = "Option::is_none")]
1286    pub verification_method:
1287        Option<CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod>,
1288}
1289
1290#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1291pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsBancontact {
1292    /// Preferred language of the Bancontact authorization page that the customer is redirected to.
1293    #[serde(skip_serializing_if = "Option::is_none")]
1294    pub preferred_language:
1295        Option<CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage>,
1296}
1297
1298#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1299pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsCard {
1300    /// Installment configuration for payments attempted on this invoice (Mexico Only).
1301    ///
1302    /// For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments).
1303    #[serde(skip_serializing_if = "Option::is_none")]
1304    pub installments: Option<CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallments>,
1305
1306    /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication).
1307    ///
1308    /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option.
1309    /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
1310    #[serde(skip_serializing_if = "Option::is_none")]
1311    pub request_three_d_secure:
1312        Option<CreateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure>,
1313}
1314
1315#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1316pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalance {
1317    /// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`.
1318    #[serde(skip_serializing_if = "Option::is_none")]
1319    pub bank_transfer:
1320        Option<CreateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransfer>,
1321
1322    /// The funding method type to be used when there are not enough funds in the customer balance.
1323    ///
1324    /// Permitted values include: `bank_transfer`.
1325    #[serde(skip_serializing_if = "Option::is_none")]
1326    pub funding_type: Option<String>,
1327}
1328
1329#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1330pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsKonbini {}
1331
1332#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1333pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccount {
1334    /// Additional fields for Financial Connections Session creation.
1335    #[serde(skip_serializing_if = "Option::is_none")]
1336    pub financial_connections:
1337        Option<CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections>,
1338
1339    /// Verification method for the intent.
1340    #[serde(skip_serializing_if = "Option::is_none")]
1341    pub verification_method:
1342        Option<CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod>,
1343}
1344
1345#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1346pub struct CreateInvoiceShippingCostShippingRateDataDeliveryEstimate {
1347    /// The upper bound of the estimated range.
1348    ///
1349    /// If empty, represents no upper bound i.e., infinite.
1350    #[serde(skip_serializing_if = "Option::is_none")]
1351    pub maximum: Option<CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximum>,
1352
1353    /// The lower bound of the estimated range.
1354    ///
1355    /// If empty, represents no lower bound.
1356    #[serde(skip_serializing_if = "Option::is_none")]
1357    pub minimum: Option<CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimum>,
1358}
1359
1360#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1361pub struct CreateInvoiceShippingCostShippingRateDataFixedAmount {
1362    /// A non-negative integer in cents representing how much to charge.
1363    pub amount: i64,
1364
1365    /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
1366    ///
1367    /// Must be a [supported currency](https://stripe.com/docs/currencies).
1368    pub currency: Currency,
1369
1370    /// Shipping rates defined in each available currency option.
1371    ///
1372    /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
1373    #[serde(skip_serializing_if = "Option::is_none")]
1374    pub currency_options:
1375        Option<CurrencyMap<CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptions>>,
1376}
1377
1378#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1379pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions {
1380    /// Transaction type of the mandate.
1381    #[serde(skip_serializing_if = "Option::is_none")]
1382    pub transaction_type: Option<
1383        CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType,
1384    >,
1385}
1386
1387#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1388pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallments {
1389    /// Setting to true enables installments for this invoice.
1390    /// Setting to false will prevent any selected plan from applying to a payment.
1391    #[serde(skip_serializing_if = "Option::is_none")]
1392    pub enabled: Option<bool>,
1393
1394    /// The selected installment plan to use for this invoice.
1395    #[serde(skip_serializing_if = "Option::is_none")]
1396    pub plan: Option<CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlan>,
1397}
1398
1399#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1400pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransfer {
1401    /// Configuration for eu_bank_transfer funding type.
1402    #[serde(skip_serializing_if = "Option::is_none")]
1403    pub eu_bank_transfer: Option<
1404        CreateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer,
1405    >,
1406
1407    /// The bank transfer type that can be used for funding.
1408    ///
1409    /// Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`.
1410    #[serde(rename = "type")]
1411    #[serde(skip_serializing_if = "Option::is_none")]
1412    pub type_: Option<String>,
1413}
1414
1415#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1416pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections {
1417
1418    /// The list of permissions to request.
1419    ///
1420    /// If this parameter is passed, the `payment_method` permission must be included.
1421    /// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`.
1422    #[serde(skip_serializing_if = "Option::is_none")]
1423    pub permissions: Option<Vec<CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions>>,
1424
1425    /// List of data features that you would like to retrieve upon account creation.
1426    #[serde(skip_serializing_if = "Option::is_none")]
1427    pub prefetch: Option<Vec<CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch>>,
1428}
1429
1430#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1431pub struct CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximum {
1432    /// A unit of time.
1433    pub unit: CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit,
1434
1435    /// Must be greater than 0.
1436    pub value: i64,
1437}
1438
1439#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1440pub struct CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimum {
1441    /// A unit of time.
1442    pub unit: CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit,
1443
1444    /// Must be greater than 0.
1445    pub value: i64,
1446}
1447
1448#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1449pub struct CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptions {
1450    /// A non-negative integer in cents representing how much to charge.
1451    pub amount: i64,
1452
1453    /// Specifies whether the rate is considered inclusive of taxes or exclusive of taxes.
1454    ///
1455    /// One of `inclusive`, `exclusive`, or `unspecified`.
1456    #[serde(skip_serializing_if = "Option::is_none")]
1457    pub tax_behavior:
1458        Option<CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior>,
1459}
1460
1461#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1462pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlan {
1463    /// For `fixed_count` installment plans, this is the number of installment payments your customer will make to their credit card.
1464    pub count: u64,
1465
1466    /// For `fixed_count` installment plans, this is the interval between installment payments your customer will make to their credit card.
1467    /// One of `month`.
1468    pub interval: CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval,
1469
1470    /// Type of installment plan, one of `fixed_count`.
1471    #[serde(rename = "type")]
1472    pub type_: CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType,
1473}
1474
1475#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1476pub struct CreateInvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransfer
1477{
1478    /// The desired country code of the bank account information.
1479    ///
1480    /// Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`.
1481    pub country: String,
1482}
1483
1484/// An enum representing the possible values of an `AutomaticTax`'s `status` field.
1485#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1486#[serde(rename_all = "snake_case")]
1487pub enum AutomaticTaxStatus {
1488    Complete,
1489    Failed,
1490    RequiresLocationInputs,
1491}
1492
1493impl AutomaticTaxStatus {
1494    pub fn as_str(self) -> &'static str {
1495        match self {
1496            AutomaticTaxStatus::Complete => "complete",
1497            AutomaticTaxStatus::Failed => "failed",
1498            AutomaticTaxStatus::RequiresLocationInputs => "requires_location_inputs",
1499        }
1500    }
1501}
1502
1503impl AsRef<str> for AutomaticTaxStatus {
1504    fn as_ref(&self) -> &str {
1505        self.as_str()
1506    }
1507}
1508
1509impl std::fmt::Display for AutomaticTaxStatus {
1510    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1511        self.as_str().fmt(f)
1512    }
1513}
1514impl std::default::Default for AutomaticTaxStatus {
1515    fn default() -> Self {
1516        Self::Complete
1517    }
1518}
1519
1520/// An enum representing the possible values of an `Invoice`'s `collection_method` field.
1521#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1522#[serde(rename_all = "snake_case")]
1523pub enum CollectionMethod {
1524    ChargeAutomatically,
1525    SendInvoice,
1526}
1527
1528impl CollectionMethod {
1529    pub fn as_str(self) -> &'static str {
1530        match self {
1531            CollectionMethod::ChargeAutomatically => "charge_automatically",
1532            CollectionMethod::SendInvoice => "send_invoice",
1533        }
1534    }
1535}
1536
1537impl AsRef<str> for CollectionMethod {
1538    fn as_ref(&self) -> &str {
1539        self.as_str()
1540    }
1541}
1542
1543impl std::fmt::Display for CollectionMethod {
1544    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1545        self.as_str().fmt(f)
1546    }
1547}
1548impl std::default::Default for CollectionMethod {
1549    fn default() -> Self {
1550        Self::ChargeAutomatically
1551    }
1552}
1553
1554/// An enum representing the possible values of an `CreateInvoiceAutomaticTaxLiability`'s `type` field.
1555#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1556#[serde(rename_all = "snake_case")]
1557pub enum CreateInvoiceAutomaticTaxLiabilityType {
1558    Account,
1559    #[serde(rename = "self")]
1560    Self_,
1561}
1562
1563impl CreateInvoiceAutomaticTaxLiabilityType {
1564    pub fn as_str(self) -> &'static str {
1565        match self {
1566            CreateInvoiceAutomaticTaxLiabilityType::Account => "account",
1567            CreateInvoiceAutomaticTaxLiabilityType::Self_ => "self",
1568        }
1569    }
1570}
1571
1572impl AsRef<str> for CreateInvoiceAutomaticTaxLiabilityType {
1573    fn as_ref(&self) -> &str {
1574        self.as_str()
1575    }
1576}
1577
1578impl std::fmt::Display for CreateInvoiceAutomaticTaxLiabilityType {
1579    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1580        self.as_str().fmt(f)
1581    }
1582}
1583impl std::default::Default for CreateInvoiceAutomaticTaxLiabilityType {
1584    fn default() -> Self {
1585        Self::Account
1586    }
1587}
1588
1589/// An enum representing the possible values of an `CreateInvoiceFromInvoice`'s `action` field.
1590#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1591#[serde(rename_all = "snake_case")]
1592pub enum CreateInvoiceFromInvoiceAction {
1593    Revision,
1594}
1595
1596impl CreateInvoiceFromInvoiceAction {
1597    pub fn as_str(self) -> &'static str {
1598        match self {
1599            CreateInvoiceFromInvoiceAction::Revision => "revision",
1600        }
1601    }
1602}
1603
1604impl AsRef<str> for CreateInvoiceFromInvoiceAction {
1605    fn as_ref(&self) -> &str {
1606        self.as_str()
1607    }
1608}
1609
1610impl std::fmt::Display for CreateInvoiceFromInvoiceAction {
1611    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1612        self.as_str().fmt(f)
1613    }
1614}
1615impl std::default::Default for CreateInvoiceFromInvoiceAction {
1616    fn default() -> Self {
1617        Self::Revision
1618    }
1619}
1620
1621/// An enum representing the possible values of an `CreateInvoiceIssuer`'s `type` field.
1622#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1623#[serde(rename_all = "snake_case")]
1624pub enum CreateInvoiceIssuerType {
1625    Account,
1626    #[serde(rename = "self")]
1627    Self_,
1628}
1629
1630impl CreateInvoiceIssuerType {
1631    pub fn as_str(self) -> &'static str {
1632        match self {
1633            CreateInvoiceIssuerType::Account => "account",
1634            CreateInvoiceIssuerType::Self_ => "self",
1635        }
1636    }
1637}
1638
1639impl AsRef<str> for CreateInvoiceIssuerType {
1640    fn as_ref(&self) -> &str {
1641        self.as_str()
1642    }
1643}
1644
1645impl std::fmt::Display for CreateInvoiceIssuerType {
1646    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1647        self.as_str().fmt(f)
1648    }
1649}
1650impl std::default::Default for CreateInvoiceIssuerType {
1651    fn default() -> Self {
1652        Self::Account
1653    }
1654}
1655
1656/// An enum representing the possible values of an `CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptions`'s `transaction_type` field.
1657#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1658#[serde(rename_all = "snake_case")]
1659pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType {
1660    Business,
1661    Personal,
1662}
1663
1664impl CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType {
1665    pub fn as_str(self) -> &'static str {
1666        match self {
1667            CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::Business => "business",
1668            CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::Personal => "personal",
1669        }
1670    }
1671}
1672
1673impl AsRef<str>
1674    for CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
1675{
1676    fn as_ref(&self) -> &str {
1677        self.as_str()
1678    }
1679}
1680
1681impl std::fmt::Display
1682    for CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
1683{
1684    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1685        self.as_str().fmt(f)
1686    }
1687}
1688impl std::default::Default
1689    for CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
1690{
1691    fn default() -> Self {
1692        Self::Business
1693    }
1694}
1695
1696/// An enum representing the possible values of an `CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebit`'s `verification_method` field.
1697#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1698#[serde(rename_all = "snake_case")]
1699pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod {
1700    Automatic,
1701    Instant,
1702    Microdeposits,
1703}
1704
1705impl CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod {
1706    pub fn as_str(self) -> &'static str {
1707        match self {
1708            CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::Automatic => "automatic",
1709            CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::Instant => "instant",
1710            CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod::Microdeposits => "microdeposits",
1711        }
1712    }
1713}
1714
1715impl AsRef<str> for CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod {
1716    fn as_ref(&self) -> &str {
1717        self.as_str()
1718    }
1719}
1720
1721impl std::fmt::Display
1722    for CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod
1723{
1724    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1725        self.as_str().fmt(f)
1726    }
1727}
1728impl std::default::Default
1729    for CreateInvoicePaymentSettingsPaymentMethodOptionsAcssDebitVerificationMethod
1730{
1731    fn default() -> Self {
1732        Self::Automatic
1733    }
1734}
1735
1736/// An enum representing the possible values of an `CreateInvoicePaymentSettingsPaymentMethodOptionsBancontact`'s `preferred_language` field.
1737#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1738#[serde(rename_all = "snake_case")]
1739pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage {
1740    De,
1741    En,
1742    Fr,
1743    Nl,
1744}
1745
1746impl CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage {
1747    pub fn as_str(self) -> &'static str {
1748        match self {
1749            CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::De => "de",
1750            CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::En => "en",
1751            CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::Fr => "fr",
1752            CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage::Nl => "nl",
1753        }
1754    }
1755}
1756
1757impl AsRef<str> for CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage {
1758    fn as_ref(&self) -> &str {
1759        self.as_str()
1760    }
1761}
1762
1763impl std::fmt::Display
1764    for CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage
1765{
1766    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1767        self.as_str().fmt(f)
1768    }
1769}
1770impl std::default::Default
1771    for CreateInvoicePaymentSettingsPaymentMethodOptionsBancontactPreferredLanguage
1772{
1773    fn default() -> Self {
1774        Self::De
1775    }
1776}
1777
1778/// An enum representing the possible values of an `CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlan`'s `interval` field.
1779#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1780#[serde(rename_all = "snake_case")]
1781pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval {
1782    Month,
1783}
1784
1785impl CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval {
1786    pub fn as_str(self) -> &'static str {
1787        match self {
1788            CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval::Month => {
1789                "month"
1790            }
1791        }
1792    }
1793}
1794
1795impl AsRef<str> for CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval {
1796    fn as_ref(&self) -> &str {
1797        self.as_str()
1798    }
1799}
1800
1801impl std::fmt::Display
1802    for CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval
1803{
1804    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1805        self.as_str().fmt(f)
1806    }
1807}
1808impl std::default::Default
1809    for CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanInterval
1810{
1811    fn default() -> Self {
1812        Self::Month
1813    }
1814}
1815
1816/// An enum representing the possible values of an `CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlan`'s `type` field.
1817#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1818#[serde(rename_all = "snake_case")]
1819pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType {
1820    FixedCount,
1821}
1822
1823impl CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType {
1824    pub fn as_str(self) -> &'static str {
1825        match self {
1826            CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType::FixedCount => "fixed_count",
1827        }
1828    }
1829}
1830
1831impl AsRef<str> for CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType {
1832    fn as_ref(&self) -> &str {
1833        self.as_str()
1834    }
1835}
1836
1837impl std::fmt::Display
1838    for CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType
1839{
1840    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1841        self.as_str().fmt(f)
1842    }
1843}
1844impl std::default::Default
1845    for CreateInvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanType
1846{
1847    fn default() -> Self {
1848        Self::FixedCount
1849    }
1850}
1851
1852/// An enum representing the possible values of an `CreateInvoicePaymentSettingsPaymentMethodOptionsCard`'s `request_three_d_secure` field.
1853#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1854#[serde(rename_all = "snake_case")]
1855pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure {
1856    Any,
1857    Automatic,
1858    Challenge,
1859}
1860
1861impl CreateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure {
1862    pub fn as_str(self) -> &'static str {
1863        match self {
1864            CreateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::Any => "any",
1865            CreateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::Automatic => {
1866                "automatic"
1867            }
1868            CreateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure::Challenge => {
1869                "challenge"
1870            }
1871        }
1872    }
1873}
1874
1875impl AsRef<str> for CreateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure {
1876    fn as_ref(&self) -> &str {
1877        self.as_str()
1878    }
1879}
1880
1881impl std::fmt::Display for CreateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure {
1882    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1883        self.as_str().fmt(f)
1884    }
1885}
1886impl std::default::Default
1887    for CreateInvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure
1888{
1889    fn default() -> Self {
1890        Self::Any
1891    }
1892}
1893
1894/// An enum representing the possible values of an `CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections`'s `permissions` field.
1895#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1896#[serde(rename_all = "snake_case")]
1897pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
1898{
1899    Balances,
1900    Ownership,
1901    PaymentMethod,
1902    Transactions,
1903}
1904
1905impl CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions {
1906    pub fn as_str(self) -> &'static str {
1907        match self {
1908            CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::Balances => "balances",
1909            CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::Ownership => "ownership",
1910            CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::PaymentMethod => "payment_method",
1911            CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::Transactions => "transactions",
1912        }
1913    }
1914}
1915
1916impl AsRef<str>
1917    for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
1918{
1919    fn as_ref(&self) -> &str {
1920        self.as_str()
1921    }
1922}
1923
1924impl std::fmt::Display
1925    for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
1926{
1927    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1928        self.as_str().fmt(f)
1929    }
1930}
1931impl std::default::Default
1932    for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
1933{
1934    fn default() -> Self {
1935        Self::Balances
1936    }
1937}
1938
1939/// An enum representing the possible values of an `CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnections`'s `prefetch` field.
1940#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1941#[serde(rename_all = "snake_case")]
1942pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch {
1943    Balances,
1944    Transactions,
1945}
1946
1947impl CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch {
1948    pub fn as_str(self) -> &'static str {
1949        match self {
1950            CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::Balances => "balances",
1951            CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::Transactions => "transactions",
1952        }
1953    }
1954}
1955
1956impl AsRef<str>
1957    for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
1958{
1959    fn as_ref(&self) -> &str {
1960        self.as_str()
1961    }
1962}
1963
1964impl std::fmt::Display
1965    for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
1966{
1967    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1968        self.as_str().fmt(f)
1969    }
1970}
1971impl std::default::Default
1972    for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
1973{
1974    fn default() -> Self {
1975        Self::Balances
1976    }
1977}
1978
1979/// An enum representing the possible values of an `CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccount`'s `verification_method` field.
1980#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1981#[serde(rename_all = "snake_case")]
1982pub enum CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod {
1983    Automatic,
1984    Instant,
1985    Microdeposits,
1986}
1987
1988impl CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod {
1989    pub fn as_str(self) -> &'static str {
1990        match self {
1991            CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::Automatic => "automatic",
1992            CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::Instant => "instant",
1993            CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod::Microdeposits => "microdeposits",
1994        }
1995    }
1996}
1997
1998impl AsRef<str>
1999    for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod
2000{
2001    fn as_ref(&self) -> &str {
2002        self.as_str()
2003    }
2004}
2005
2006impl std::fmt::Display
2007    for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod
2008{
2009    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2010        self.as_str().fmt(f)
2011    }
2012}
2013impl std::default::Default
2014    for CreateInvoicePaymentSettingsPaymentMethodOptionsUsBankAccountVerificationMethod
2015{
2016    fn default() -> Self {
2017        Self::Automatic
2018    }
2019}
2020
2021/// An enum representing the possible values of an `CreateInvoicePaymentSettings`'s `payment_method_types` field.
2022#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2023#[serde(rename_all = "snake_case")]
2024pub enum CreateInvoicePaymentSettingsPaymentMethodTypes {
2025    AchCreditTransfer,
2026    AchDebit,
2027    AcssDebit,
2028    AuBecsDebit,
2029    BacsDebit,
2030    Bancontact,
2031    Boleto,
2032    Card,
2033    Cashapp,
2034    CustomerBalance,
2035    Eps,
2036    Fpx,
2037    Giropay,
2038    Grabpay,
2039    Ideal,
2040    Konbini,
2041    Link,
2042    P24,
2043    Paynow,
2044    Paypal,
2045    Promptpay,
2046    SepaCreditTransfer,
2047    SepaDebit,
2048    Sofort,
2049    UsBankAccount,
2050    WechatPay,
2051}
2052
2053impl CreateInvoicePaymentSettingsPaymentMethodTypes {
2054    pub fn as_str(self) -> &'static str {
2055        match self {
2056            CreateInvoicePaymentSettingsPaymentMethodTypes::AchCreditTransfer => {
2057                "ach_credit_transfer"
2058            }
2059            CreateInvoicePaymentSettingsPaymentMethodTypes::AchDebit => "ach_debit",
2060            CreateInvoicePaymentSettingsPaymentMethodTypes::AcssDebit => "acss_debit",
2061            CreateInvoicePaymentSettingsPaymentMethodTypes::AuBecsDebit => "au_becs_debit",
2062            CreateInvoicePaymentSettingsPaymentMethodTypes::BacsDebit => "bacs_debit",
2063            CreateInvoicePaymentSettingsPaymentMethodTypes::Bancontact => "bancontact",
2064            CreateInvoicePaymentSettingsPaymentMethodTypes::Boleto => "boleto",
2065            CreateInvoicePaymentSettingsPaymentMethodTypes::Card => "card",
2066            CreateInvoicePaymentSettingsPaymentMethodTypes::Cashapp => "cashapp",
2067            CreateInvoicePaymentSettingsPaymentMethodTypes::CustomerBalance => "customer_balance",
2068            CreateInvoicePaymentSettingsPaymentMethodTypes::Eps => "eps",
2069            CreateInvoicePaymentSettingsPaymentMethodTypes::Fpx => "fpx",
2070            CreateInvoicePaymentSettingsPaymentMethodTypes::Giropay => "giropay",
2071            CreateInvoicePaymentSettingsPaymentMethodTypes::Grabpay => "grabpay",
2072            CreateInvoicePaymentSettingsPaymentMethodTypes::Ideal => "ideal",
2073            CreateInvoicePaymentSettingsPaymentMethodTypes::Konbini => "konbini",
2074            CreateInvoicePaymentSettingsPaymentMethodTypes::Link => "link",
2075            CreateInvoicePaymentSettingsPaymentMethodTypes::P24 => "p24",
2076            CreateInvoicePaymentSettingsPaymentMethodTypes::Paynow => "paynow",
2077            CreateInvoicePaymentSettingsPaymentMethodTypes::Paypal => "paypal",
2078            CreateInvoicePaymentSettingsPaymentMethodTypes::Promptpay => "promptpay",
2079            CreateInvoicePaymentSettingsPaymentMethodTypes::SepaCreditTransfer => {
2080                "sepa_credit_transfer"
2081            }
2082            CreateInvoicePaymentSettingsPaymentMethodTypes::SepaDebit => "sepa_debit",
2083            CreateInvoicePaymentSettingsPaymentMethodTypes::Sofort => "sofort",
2084            CreateInvoicePaymentSettingsPaymentMethodTypes::UsBankAccount => "us_bank_account",
2085            CreateInvoicePaymentSettingsPaymentMethodTypes::WechatPay => "wechat_pay",
2086        }
2087    }
2088}
2089
2090impl AsRef<str> for CreateInvoicePaymentSettingsPaymentMethodTypes {
2091    fn as_ref(&self) -> &str {
2092        self.as_str()
2093    }
2094}
2095
2096impl std::fmt::Display for CreateInvoicePaymentSettingsPaymentMethodTypes {
2097    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2098        self.as_str().fmt(f)
2099    }
2100}
2101impl std::default::Default for CreateInvoicePaymentSettingsPaymentMethodTypes {
2102    fn default() -> Self {
2103        Self::AchCreditTransfer
2104    }
2105}
2106
2107/// An enum representing the possible values of an `CreateInvoiceRendering`'s `amount_tax_display` field.
2108#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2109#[serde(rename_all = "snake_case")]
2110pub enum CreateInvoiceRenderingAmountTaxDisplay {
2111    ExcludeTax,
2112    IncludeInclusiveTax,
2113}
2114
2115impl CreateInvoiceRenderingAmountTaxDisplay {
2116    pub fn as_str(self) -> &'static str {
2117        match self {
2118            CreateInvoiceRenderingAmountTaxDisplay::ExcludeTax => "exclude_tax",
2119            CreateInvoiceRenderingAmountTaxDisplay::IncludeInclusiveTax => "include_inclusive_tax",
2120        }
2121    }
2122}
2123
2124impl AsRef<str> for CreateInvoiceRenderingAmountTaxDisplay {
2125    fn as_ref(&self) -> &str {
2126        self.as_str()
2127    }
2128}
2129
2130impl std::fmt::Display for CreateInvoiceRenderingAmountTaxDisplay {
2131    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2132        self.as_str().fmt(f)
2133    }
2134}
2135impl std::default::Default for CreateInvoiceRenderingAmountTaxDisplay {
2136    fn default() -> Self {
2137        Self::ExcludeTax
2138    }
2139}
2140
2141/// An enum representing the possible values of an `CreateInvoiceRenderingOptions`'s `amount_tax_display` field.
2142#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2143#[serde(rename_all = "snake_case")]
2144pub enum CreateInvoiceRenderingOptionsAmountTaxDisplay {
2145    ExcludeTax,
2146    IncludeInclusiveTax,
2147}
2148
2149impl CreateInvoiceRenderingOptionsAmountTaxDisplay {
2150    pub fn as_str(self) -> &'static str {
2151        match self {
2152            CreateInvoiceRenderingOptionsAmountTaxDisplay::ExcludeTax => "exclude_tax",
2153            CreateInvoiceRenderingOptionsAmountTaxDisplay::IncludeInclusiveTax => {
2154                "include_inclusive_tax"
2155            }
2156        }
2157    }
2158}
2159
2160impl AsRef<str> for CreateInvoiceRenderingOptionsAmountTaxDisplay {
2161    fn as_ref(&self) -> &str {
2162        self.as_str()
2163    }
2164}
2165
2166impl std::fmt::Display for CreateInvoiceRenderingOptionsAmountTaxDisplay {
2167    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2168        self.as_str().fmt(f)
2169    }
2170}
2171impl std::default::Default for CreateInvoiceRenderingOptionsAmountTaxDisplay {
2172    fn default() -> Self {
2173        Self::ExcludeTax
2174    }
2175}
2176
2177/// An enum representing the possible values of an `CreateInvoiceRenderingPdf`'s `page_size` field.
2178#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2179#[serde(rename_all = "snake_case")]
2180pub enum CreateInvoiceRenderingPdfPageSize {
2181    A4,
2182    Auto,
2183    Letter,
2184}
2185
2186impl CreateInvoiceRenderingPdfPageSize {
2187    pub fn as_str(self) -> &'static str {
2188        match self {
2189            CreateInvoiceRenderingPdfPageSize::A4 => "a4",
2190            CreateInvoiceRenderingPdfPageSize::Auto => "auto",
2191            CreateInvoiceRenderingPdfPageSize::Letter => "letter",
2192        }
2193    }
2194}
2195
2196impl AsRef<str> for CreateInvoiceRenderingPdfPageSize {
2197    fn as_ref(&self) -> &str {
2198        self.as_str()
2199    }
2200}
2201
2202impl std::fmt::Display for CreateInvoiceRenderingPdfPageSize {
2203    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2204        self.as_str().fmt(f)
2205    }
2206}
2207impl std::default::Default for CreateInvoiceRenderingPdfPageSize {
2208    fn default() -> Self {
2209        Self::A4
2210    }
2211}
2212
2213/// An enum representing the possible values of an `CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximum`'s `unit` field.
2214#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2215#[serde(rename_all = "snake_case")]
2216pub enum CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit {
2217    BusinessDay,
2218    Day,
2219    Hour,
2220    Month,
2221    Week,
2222}
2223
2224impl CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit {
2225    pub fn as_str(self) -> &'static str {
2226        match self {
2227            CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit::BusinessDay => {
2228                "business_day"
2229            }
2230            CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit::Day => "day",
2231            CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit::Hour => "hour",
2232            CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit::Month => "month",
2233            CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit::Week => "week",
2234        }
2235    }
2236}
2237
2238impl AsRef<str> for CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit {
2239    fn as_ref(&self) -> &str {
2240        self.as_str()
2241    }
2242}
2243
2244impl std::fmt::Display for CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit {
2245    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2246        self.as_str().fmt(f)
2247    }
2248}
2249impl std::default::Default
2250    for CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMaximumUnit
2251{
2252    fn default() -> Self {
2253        Self::BusinessDay
2254    }
2255}
2256
2257/// An enum representing the possible values of an `CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimum`'s `unit` field.
2258#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2259#[serde(rename_all = "snake_case")]
2260pub enum CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit {
2261    BusinessDay,
2262    Day,
2263    Hour,
2264    Month,
2265    Week,
2266}
2267
2268impl CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit {
2269    pub fn as_str(self) -> &'static str {
2270        match self {
2271            CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit::BusinessDay => {
2272                "business_day"
2273            }
2274            CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit::Day => "day",
2275            CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit::Hour => "hour",
2276            CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit::Month => "month",
2277            CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit::Week => "week",
2278        }
2279    }
2280}
2281
2282impl AsRef<str> for CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit {
2283    fn as_ref(&self) -> &str {
2284        self.as_str()
2285    }
2286}
2287
2288impl std::fmt::Display for CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit {
2289    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2290        self.as_str().fmt(f)
2291    }
2292}
2293impl std::default::Default
2294    for CreateInvoiceShippingCostShippingRateDataDeliveryEstimateMinimumUnit
2295{
2296    fn default() -> Self {
2297        Self::BusinessDay
2298    }
2299}
2300
2301/// An enum representing the possible values of an `CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptions`'s `tax_behavior` field.
2302#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2303#[serde(rename_all = "snake_case")]
2304pub enum CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior {
2305    Exclusive,
2306    Inclusive,
2307    Unspecified,
2308}
2309
2310impl CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior {
2311    pub fn as_str(self) -> &'static str {
2312        match self {
2313            CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior::Exclusive => "exclusive",
2314            CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior::Inclusive => "inclusive",
2315            CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior::Unspecified => "unspecified",
2316        }
2317    }
2318}
2319
2320impl AsRef<str> for CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior {
2321    fn as_ref(&self) -> &str {
2322        self.as_str()
2323    }
2324}
2325
2326impl std::fmt::Display
2327    for CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior
2328{
2329    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2330        self.as_str().fmt(f)
2331    }
2332}
2333impl std::default::Default
2334    for CreateInvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsTaxBehavior
2335{
2336    fn default() -> Self {
2337        Self::Exclusive
2338    }
2339}
2340
2341/// An enum representing the possible values of an `CreateInvoiceShippingCostShippingRateData`'s `tax_behavior` field.
2342#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2343#[serde(rename_all = "snake_case")]
2344pub enum CreateInvoiceShippingCostShippingRateDataTaxBehavior {
2345    Exclusive,
2346    Inclusive,
2347    Unspecified,
2348}
2349
2350impl CreateInvoiceShippingCostShippingRateDataTaxBehavior {
2351    pub fn as_str(self) -> &'static str {
2352        match self {
2353            CreateInvoiceShippingCostShippingRateDataTaxBehavior::Exclusive => "exclusive",
2354            CreateInvoiceShippingCostShippingRateDataTaxBehavior::Inclusive => "inclusive",
2355            CreateInvoiceShippingCostShippingRateDataTaxBehavior::Unspecified => "unspecified",
2356        }
2357    }
2358}
2359
2360impl AsRef<str> for CreateInvoiceShippingCostShippingRateDataTaxBehavior {
2361    fn as_ref(&self) -> &str {
2362        self.as_str()
2363    }
2364}
2365
2366impl std::fmt::Display for CreateInvoiceShippingCostShippingRateDataTaxBehavior {
2367    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2368        self.as_str().fmt(f)
2369    }
2370}
2371impl std::default::Default for CreateInvoiceShippingCostShippingRateDataTaxBehavior {
2372    fn default() -> Self {
2373        Self::Exclusive
2374    }
2375}
2376
2377/// An enum representing the possible values of an `CreateInvoiceShippingCostShippingRateData`'s `type` field.
2378#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2379#[serde(rename_all = "snake_case")]
2380pub enum CreateInvoiceShippingCostShippingRateDataType {
2381    FixedAmount,
2382}
2383
2384impl CreateInvoiceShippingCostShippingRateDataType {
2385    pub fn as_str(self) -> &'static str {
2386        match self {
2387            CreateInvoiceShippingCostShippingRateDataType::FixedAmount => "fixed_amount",
2388        }
2389    }
2390}
2391
2392impl AsRef<str> for CreateInvoiceShippingCostShippingRateDataType {
2393    fn as_ref(&self) -> &str {
2394        self.as_str()
2395    }
2396}
2397
2398impl std::fmt::Display for CreateInvoiceShippingCostShippingRateDataType {
2399    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2400        self.as_str().fmt(f)
2401    }
2402}
2403impl std::default::Default for CreateInvoiceShippingCostShippingRateDataType {
2404    fn default() -> Self {
2405        Self::FixedAmount
2406    }
2407}
2408
2409/// An enum representing the possible values of an `Invoice`'s `billing_reason` field.
2410#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2411#[serde(rename_all = "snake_case")]
2412pub enum InvoiceBillingReason {
2413    AutomaticPendingInvoiceItemInvoice,
2414    Manual,
2415    QuoteAccept,
2416    Subscription,
2417    SubscriptionCreate,
2418    SubscriptionCycle,
2419    SubscriptionThreshold,
2420    SubscriptionUpdate,
2421    Upcoming,
2422}
2423
2424impl InvoiceBillingReason {
2425    pub fn as_str(self) -> &'static str {
2426        match self {
2427            InvoiceBillingReason::AutomaticPendingInvoiceItemInvoice => {
2428                "automatic_pending_invoice_item_invoice"
2429            }
2430            InvoiceBillingReason::Manual => "manual",
2431            InvoiceBillingReason::QuoteAccept => "quote_accept",
2432            InvoiceBillingReason::Subscription => "subscription",
2433            InvoiceBillingReason::SubscriptionCreate => "subscription_create",
2434            InvoiceBillingReason::SubscriptionCycle => "subscription_cycle",
2435            InvoiceBillingReason::SubscriptionThreshold => "subscription_threshold",
2436            InvoiceBillingReason::SubscriptionUpdate => "subscription_update",
2437            InvoiceBillingReason::Upcoming => "upcoming",
2438        }
2439    }
2440}
2441
2442impl AsRef<str> for InvoiceBillingReason {
2443    fn as_ref(&self) -> &str {
2444        self.as_str()
2445    }
2446}
2447
2448impl std::fmt::Display for InvoiceBillingReason {
2449    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2450        self.as_str().fmt(f)
2451    }
2452}
2453impl std::default::Default for InvoiceBillingReason {
2454    fn default() -> Self {
2455        Self::AutomaticPendingInvoiceItemInvoice
2456    }
2457}
2458
2459/// An enum representing the possible values of an `Invoice`'s `customer_tax_exempt` field.
2460#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2461#[serde(rename_all = "snake_case")]
2462pub enum InvoiceCustomerTaxExempt {
2463    Exempt,
2464    None,
2465    Reverse,
2466}
2467
2468impl InvoiceCustomerTaxExempt {
2469    pub fn as_str(self) -> &'static str {
2470        match self {
2471            InvoiceCustomerTaxExempt::Exempt => "exempt",
2472            InvoiceCustomerTaxExempt::None => "none",
2473            InvoiceCustomerTaxExempt::Reverse => "reverse",
2474        }
2475    }
2476}
2477
2478impl AsRef<str> for InvoiceCustomerTaxExempt {
2479    fn as_ref(&self) -> &str {
2480        self.as_str()
2481    }
2482}
2483
2484impl std::fmt::Display for InvoiceCustomerTaxExempt {
2485    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2486        self.as_str().fmt(f)
2487    }
2488}
2489impl std::default::Default for InvoiceCustomerTaxExempt {
2490    fn default() -> Self {
2491        Self::Exempt
2492    }
2493}
2494
2495/// An enum representing the possible values of an `InvoicePaymentMethodOptionsCard`'s `request_three_d_secure` field.
2496#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2497#[serde(rename_all = "snake_case")]
2498pub enum InvoicePaymentMethodOptionsCardRequestThreeDSecure {
2499    Any,
2500    Automatic,
2501    Challenge,
2502}
2503
2504impl InvoicePaymentMethodOptionsCardRequestThreeDSecure {
2505    pub fn as_str(self) -> &'static str {
2506        match self {
2507            InvoicePaymentMethodOptionsCardRequestThreeDSecure::Any => "any",
2508            InvoicePaymentMethodOptionsCardRequestThreeDSecure::Automatic => "automatic",
2509            InvoicePaymentMethodOptionsCardRequestThreeDSecure::Challenge => "challenge",
2510        }
2511    }
2512}
2513
2514impl AsRef<str> for InvoicePaymentMethodOptionsCardRequestThreeDSecure {
2515    fn as_ref(&self) -> &str {
2516        self.as_str()
2517    }
2518}
2519
2520impl std::fmt::Display for InvoicePaymentMethodOptionsCardRequestThreeDSecure {
2521    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2522        self.as_str().fmt(f)
2523    }
2524}
2525impl std::default::Default for InvoicePaymentMethodOptionsCardRequestThreeDSecure {
2526    fn default() -> Self {
2527        Self::Any
2528    }
2529}
2530
2531/// An enum representing the possible values of an `CreateInvoice`'s `pending_invoice_items_behavior` field.
2532#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2533#[serde(rename_all = "snake_case")]
2534pub enum InvoicePendingInvoiceItemsBehavior {
2535    Exclude,
2536    Include,
2537    IncludeAndRequire,
2538}
2539
2540impl InvoicePendingInvoiceItemsBehavior {
2541    pub fn as_str(self) -> &'static str {
2542        match self {
2543            InvoicePendingInvoiceItemsBehavior::Exclude => "exclude",
2544            InvoicePendingInvoiceItemsBehavior::Include => "include",
2545            InvoicePendingInvoiceItemsBehavior::IncludeAndRequire => "include_and_require",
2546        }
2547    }
2548}
2549
2550impl AsRef<str> for InvoicePendingInvoiceItemsBehavior {
2551    fn as_ref(&self) -> &str {
2552        self.as_str()
2553    }
2554}
2555
2556impl std::fmt::Display for InvoicePendingInvoiceItemsBehavior {
2557    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2558        self.as_str().fmt(f)
2559    }
2560}
2561impl std::default::Default for InvoicePendingInvoiceItemsBehavior {
2562    fn default() -> Self {
2563        Self::Exclude
2564    }
2565}
2566
2567/// An enum representing the possible values of an `InvoiceRenderingPdf`'s `page_size` field.
2568#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2569#[serde(rename_all = "snake_case")]
2570pub enum InvoiceRenderingPdfPageSize {
2571    A4,
2572    Auto,
2573    Letter,
2574}
2575
2576impl InvoiceRenderingPdfPageSize {
2577    pub fn as_str(self) -> &'static str {
2578        match self {
2579            InvoiceRenderingPdfPageSize::A4 => "a4",
2580            InvoiceRenderingPdfPageSize::Auto => "auto",
2581            InvoiceRenderingPdfPageSize::Letter => "letter",
2582        }
2583    }
2584}
2585
2586impl AsRef<str> for InvoiceRenderingPdfPageSize {
2587    fn as_ref(&self) -> &str {
2588        self.as_str()
2589    }
2590}
2591
2592impl std::fmt::Display for InvoiceRenderingPdfPageSize {
2593    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2594        self.as_str().fmt(f)
2595    }
2596}
2597impl std::default::Default for InvoiceRenderingPdfPageSize {
2598    fn default() -> Self {
2599        Self::A4
2600    }
2601}
2602
2603/// An enum representing the possible values of an `Invoice`'s `status` field.
2604#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2605#[serde(rename_all = "snake_case")]
2606pub enum InvoiceStatus {
2607    Draft,
2608    Open,
2609    Paid,
2610    Uncollectible,
2611    Void,
2612}
2613
2614impl InvoiceStatus {
2615    pub fn as_str(self) -> &'static str {
2616        match self {
2617            InvoiceStatus::Draft => "draft",
2618            InvoiceStatus::Open => "open",
2619            InvoiceStatus::Paid => "paid",
2620            InvoiceStatus::Uncollectible => "uncollectible",
2621            InvoiceStatus::Void => "void",
2622        }
2623    }
2624}
2625
2626impl AsRef<str> for InvoiceStatus {
2627    fn as_ref(&self) -> &str {
2628        self.as_str()
2629    }
2630}
2631
2632impl std::fmt::Display for InvoiceStatus {
2633    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2634        self.as_str().fmt(f)
2635    }
2636}
2637impl std::default::Default for InvoiceStatus {
2638    fn default() -> Self {
2639        Self::Draft
2640    }
2641}
2642
2643/// An enum representing the possible values of an `InvoicesPaymentSettings`'s `payment_method_types` field.
2644#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2645#[serde(rename_all = "snake_case")]
2646pub enum InvoicesPaymentSettingsPaymentMethodTypes {
2647    AchCreditTransfer,
2648    AchDebit,
2649    AcssDebit,
2650    AuBecsDebit,
2651    BacsDebit,
2652    Bancontact,
2653    Boleto,
2654    Card,
2655    Cashapp,
2656    CustomerBalance,
2657    Eps,
2658    Fpx,
2659    Giropay,
2660    Grabpay,
2661    Ideal,
2662    Konbini,
2663    Link,
2664    P24,
2665    Paynow,
2666    Paypal,
2667    Promptpay,
2668    SepaCreditTransfer,
2669    SepaDebit,
2670    Sofort,
2671    UsBankAccount,
2672    WechatPay,
2673}
2674
2675impl InvoicesPaymentSettingsPaymentMethodTypes {
2676    pub fn as_str(self) -> &'static str {
2677        match self {
2678            InvoicesPaymentSettingsPaymentMethodTypes::AchCreditTransfer => "ach_credit_transfer",
2679            InvoicesPaymentSettingsPaymentMethodTypes::AchDebit => "ach_debit",
2680            InvoicesPaymentSettingsPaymentMethodTypes::AcssDebit => "acss_debit",
2681            InvoicesPaymentSettingsPaymentMethodTypes::AuBecsDebit => "au_becs_debit",
2682            InvoicesPaymentSettingsPaymentMethodTypes::BacsDebit => "bacs_debit",
2683            InvoicesPaymentSettingsPaymentMethodTypes::Bancontact => "bancontact",
2684            InvoicesPaymentSettingsPaymentMethodTypes::Boleto => "boleto",
2685            InvoicesPaymentSettingsPaymentMethodTypes::Card => "card",
2686            InvoicesPaymentSettingsPaymentMethodTypes::Cashapp => "cashapp",
2687            InvoicesPaymentSettingsPaymentMethodTypes::CustomerBalance => "customer_balance",
2688            InvoicesPaymentSettingsPaymentMethodTypes::Eps => "eps",
2689            InvoicesPaymentSettingsPaymentMethodTypes::Fpx => "fpx",
2690            InvoicesPaymentSettingsPaymentMethodTypes::Giropay => "giropay",
2691            InvoicesPaymentSettingsPaymentMethodTypes::Grabpay => "grabpay",
2692            InvoicesPaymentSettingsPaymentMethodTypes::Ideal => "ideal",
2693            InvoicesPaymentSettingsPaymentMethodTypes::Konbini => "konbini",
2694            InvoicesPaymentSettingsPaymentMethodTypes::Link => "link",
2695            InvoicesPaymentSettingsPaymentMethodTypes::P24 => "p24",
2696            InvoicesPaymentSettingsPaymentMethodTypes::Paynow => "paynow",
2697            InvoicesPaymentSettingsPaymentMethodTypes::Paypal => "paypal",
2698            InvoicesPaymentSettingsPaymentMethodTypes::Promptpay => "promptpay",
2699            InvoicesPaymentSettingsPaymentMethodTypes::SepaCreditTransfer => "sepa_credit_transfer",
2700            InvoicesPaymentSettingsPaymentMethodTypes::SepaDebit => "sepa_debit",
2701            InvoicesPaymentSettingsPaymentMethodTypes::Sofort => "sofort",
2702            InvoicesPaymentSettingsPaymentMethodTypes::UsBankAccount => "us_bank_account",
2703            InvoicesPaymentSettingsPaymentMethodTypes::WechatPay => "wechat_pay",
2704        }
2705    }
2706}
2707
2708impl AsRef<str> for InvoicesPaymentSettingsPaymentMethodTypes {
2709    fn as_ref(&self) -> &str {
2710        self.as_str()
2711    }
2712}
2713
2714impl std::fmt::Display for InvoicesPaymentSettingsPaymentMethodTypes {
2715    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2716        self.as_str().fmt(f)
2717    }
2718}
2719impl std::default::Default for InvoicesPaymentSettingsPaymentMethodTypes {
2720    fn default() -> Self {
2721        Self::AchCreditTransfer
2722    }
2723}
2724
2725/// An enum representing the possible values of an `TaxAmount`'s `taxability_reason` field.
2726#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2727#[serde(rename_all = "snake_case")]
2728pub enum TaxAmountTaxabilityReason {
2729    CustomerExempt,
2730    NotCollecting,
2731    NotSubjectToTax,
2732    NotSupported,
2733    PortionProductExempt,
2734    PortionReducedRated,
2735    PortionStandardRated,
2736    ProductExempt,
2737    ProductExemptHoliday,
2738    ProportionallyRated,
2739    ReducedRated,
2740    ReverseCharge,
2741    StandardRated,
2742    TaxableBasisReduced,
2743    ZeroRated,
2744}
2745
2746impl TaxAmountTaxabilityReason {
2747    pub fn as_str(self) -> &'static str {
2748        match self {
2749            TaxAmountTaxabilityReason::CustomerExempt => "customer_exempt",
2750            TaxAmountTaxabilityReason::NotCollecting => "not_collecting",
2751            TaxAmountTaxabilityReason::NotSubjectToTax => "not_subject_to_tax",
2752            TaxAmountTaxabilityReason::NotSupported => "not_supported",
2753            TaxAmountTaxabilityReason::PortionProductExempt => "portion_product_exempt",
2754            TaxAmountTaxabilityReason::PortionReducedRated => "portion_reduced_rated",
2755            TaxAmountTaxabilityReason::PortionStandardRated => "portion_standard_rated",
2756            TaxAmountTaxabilityReason::ProductExempt => "product_exempt",
2757            TaxAmountTaxabilityReason::ProductExemptHoliday => "product_exempt_holiday",
2758            TaxAmountTaxabilityReason::ProportionallyRated => "proportionally_rated",
2759            TaxAmountTaxabilityReason::ReducedRated => "reduced_rated",
2760            TaxAmountTaxabilityReason::ReverseCharge => "reverse_charge",
2761            TaxAmountTaxabilityReason::StandardRated => "standard_rated",
2762            TaxAmountTaxabilityReason::TaxableBasisReduced => "taxable_basis_reduced",
2763            TaxAmountTaxabilityReason::ZeroRated => "zero_rated",
2764        }
2765    }
2766}
2767
2768impl AsRef<str> for TaxAmountTaxabilityReason {
2769    fn as_ref(&self) -> &str {
2770        self.as_str()
2771    }
2772}
2773
2774impl std::fmt::Display for TaxAmountTaxabilityReason {
2775    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2776        self.as_str().fmt(f)
2777    }
2778}
2779impl std::default::Default for TaxAmountTaxabilityReason {
2780    fn default() -> Self {
2781        Self::CustomerExempt
2782    }
2783}
2784
2785/// An enum representing the possible values of an `InvoicesResourceInvoiceTaxId`'s `type` field.
2786#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
2787#[serde(rename_all = "snake_case")]
2788pub enum TaxIdType {
2789    AdNrt,
2790    AeTrn,
2791    ArCuit,
2792    AuAbn,
2793    AuArn,
2794    BgUic,
2795    BoTin,
2796    BrCnpj,
2797    BrCpf,
2798    CaBn,
2799    CaGstHst,
2800    CaPstBc,
2801    CaPstMb,
2802    CaPstSk,
2803    CaQst,
2804    ChVat,
2805    ClTin,
2806    CnTin,
2807    CoNit,
2808    CrTin,
2809    DoRcn,
2810    EcRuc,
2811    EgTin,
2812    EsCif,
2813    EuOssVat,
2814    EuVat,
2815    GbVat,
2816    GeVat,
2817    HkBr,
2818    HuTin,
2819    IdNpwp,
2820    IlVat,
2821    InGst,
2822    IsVat,
2823    JpCn,
2824    JpRn,
2825    JpTrn,
2826    KePin,
2827    KrBrn,
2828    LiUid,
2829    MxRfc,
2830    MyFrp,
2831    MyItn,
2832    MySst,
2833    NoVat,
2834    NzGst,
2835    PeRuc,
2836    PhTin,
2837    RoTin,
2838    RsPib,
2839    RuInn,
2840    RuKpp,
2841    SaVat,
2842    SgGst,
2843    SgUen,
2844    SiTin,
2845    SvNit,
2846    ThVat,
2847    TrTin,
2848    TwVat,
2849    UaVat,
2850    Unknown,
2851    UsEin,
2852    UyRuc,
2853    VeRif,
2854    VnTin,
2855    ZaVat,
2856}
2857
2858impl TaxIdType {
2859    pub fn as_str(self) -> &'static str {
2860        match self {
2861            TaxIdType::AdNrt => "ad_nrt",
2862            TaxIdType::AeTrn => "ae_trn",
2863            TaxIdType::ArCuit => "ar_cuit",
2864            TaxIdType::AuAbn => "au_abn",
2865            TaxIdType::AuArn => "au_arn",
2866            TaxIdType::BgUic => "bg_uic",
2867            TaxIdType::BoTin => "bo_tin",
2868            TaxIdType::BrCnpj => "br_cnpj",
2869            TaxIdType::BrCpf => "br_cpf",
2870            TaxIdType::CaBn => "ca_bn",
2871            TaxIdType::CaGstHst => "ca_gst_hst",
2872            TaxIdType::CaPstBc => "ca_pst_bc",
2873            TaxIdType::CaPstMb => "ca_pst_mb",
2874            TaxIdType::CaPstSk => "ca_pst_sk",
2875            TaxIdType::CaQst => "ca_qst",
2876            TaxIdType::ChVat => "ch_vat",
2877            TaxIdType::ClTin => "cl_tin",
2878            TaxIdType::CnTin => "cn_tin",
2879            TaxIdType::CoNit => "co_nit",
2880            TaxIdType::CrTin => "cr_tin",
2881            TaxIdType::DoRcn => "do_rcn",
2882            TaxIdType::EcRuc => "ec_ruc",
2883            TaxIdType::EgTin => "eg_tin",
2884            TaxIdType::EsCif => "es_cif",
2885            TaxIdType::EuOssVat => "eu_oss_vat",
2886            TaxIdType::EuVat => "eu_vat",
2887            TaxIdType::GbVat => "gb_vat",
2888            TaxIdType::GeVat => "ge_vat",
2889            TaxIdType::HkBr => "hk_br",
2890            TaxIdType::HuTin => "hu_tin",
2891            TaxIdType::IdNpwp => "id_npwp",
2892            TaxIdType::IlVat => "il_vat",
2893            TaxIdType::InGst => "in_gst",
2894            TaxIdType::IsVat => "is_vat",
2895            TaxIdType::JpCn => "jp_cn",
2896            TaxIdType::JpRn => "jp_rn",
2897            TaxIdType::JpTrn => "jp_trn",
2898            TaxIdType::KePin => "ke_pin",
2899            TaxIdType::KrBrn => "kr_brn",
2900            TaxIdType::LiUid => "li_uid",
2901            TaxIdType::MxRfc => "mx_rfc",
2902            TaxIdType::MyFrp => "my_frp",
2903            TaxIdType::MyItn => "my_itn",
2904            TaxIdType::MySst => "my_sst",
2905            TaxIdType::NoVat => "no_vat",
2906            TaxIdType::NzGst => "nz_gst",
2907            TaxIdType::PeRuc => "pe_ruc",
2908            TaxIdType::PhTin => "ph_tin",
2909            TaxIdType::RoTin => "ro_tin",
2910            TaxIdType::RsPib => "rs_pib",
2911            TaxIdType::RuInn => "ru_inn",
2912            TaxIdType::RuKpp => "ru_kpp",
2913            TaxIdType::SaVat => "sa_vat",
2914            TaxIdType::SgGst => "sg_gst",
2915            TaxIdType::SgUen => "sg_uen",
2916            TaxIdType::SiTin => "si_tin",
2917            TaxIdType::SvNit => "sv_nit",
2918            TaxIdType::ThVat => "th_vat",
2919            TaxIdType::TrTin => "tr_tin",
2920            TaxIdType::TwVat => "tw_vat",
2921            TaxIdType::UaVat => "ua_vat",
2922            TaxIdType::Unknown => "unknown",
2923            TaxIdType::UsEin => "us_ein",
2924            TaxIdType::UyRuc => "uy_ruc",
2925            TaxIdType::VeRif => "ve_rif",
2926            TaxIdType::VnTin => "vn_tin",
2927            TaxIdType::ZaVat => "za_vat",
2928        }
2929    }
2930}
2931
2932impl AsRef<str> for TaxIdType {
2933    fn as_ref(&self) -> &str {
2934        self.as_str()
2935    }
2936}
2937
2938impl std::fmt::Display for TaxIdType {
2939    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2940        self.as_str().fmt(f)
2941    }
2942}
2943impl std::default::Default for TaxIdType {
2944    fn default() -> Self {
2945        Self::AdNrt
2946    }
2947}