stripe/resources/generated/
invoice.rs

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