• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-java / #16599

29 Oct 2024 11:04PM UTC coverage: 12.519% (-0.1%) from 12.62%
#16599

push

github

web-flow
Merge pull request #1914 from stripe/latest-codegen-beta

Update generated code for beta

40 of 1580 new or added lines in 51 files covered. (2.53%)

19 existing lines in 15 files now uncovered.

18843 of 150513 relevant lines covered (12.52%)

0.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

33.14
/src/main/java/com/stripe/model/Invoice.java
1
// File generated from our OpenAPI spec
2
package com.stripe.model;
3

4
import com.google.gson.annotations.SerializedName;
5
import com.stripe.exception.StripeException;
6
import com.stripe.model.billing.CreditBalanceTransaction;
7
import com.stripe.model.testhelpers.TestClock;
8
import com.stripe.net.ApiRequest;
9
import com.stripe.net.ApiRequestParams;
10
import com.stripe.net.ApiResource;
11
import com.stripe.net.BaseAddress;
12
import com.stripe.net.RequestOptions;
13
import com.stripe.net.StripeResponseGetter;
14
import com.stripe.param.InvoiceAddLinesParams;
15
import com.stripe.param.InvoiceAttachPaymentIntentParams;
16
import com.stripe.param.InvoiceAttachPaymentParams;
17
import com.stripe.param.InvoiceCreateParams;
18
import com.stripe.param.InvoiceCreatePreviewParams;
19
import com.stripe.param.InvoiceFinalizeInvoiceParams;
20
import com.stripe.param.InvoiceListParams;
21
import com.stripe.param.InvoiceMarkUncollectibleParams;
22
import com.stripe.param.InvoicePayParams;
23
import com.stripe.param.InvoiceRemoveLinesParams;
24
import com.stripe.param.InvoiceRetrieveParams;
25
import com.stripe.param.InvoiceSearchParams;
26
import com.stripe.param.InvoiceSendInvoiceParams;
27
import com.stripe.param.InvoiceUpcomingLinesParams;
28
import com.stripe.param.InvoiceUpcomingParams;
29
import com.stripe.param.InvoiceUpdateLinesParams;
30
import com.stripe.param.InvoiceUpdateParams;
31
import com.stripe.param.InvoiceVoidInvoiceParams;
32
import java.util.List;
33
import java.util.Map;
34
import java.util.stream.Collectors;
35
import lombok.EqualsAndHashCode;
36
import lombok.Getter;
37
import lombok.Setter;
38

39
/**
40
 * Invoices are statements of amounts owed by a customer, and are either generated one-off, or
41
 * generated periodically from a subscription.
42
 *
43
 * <p>They contain <a href="https://stripe.com/docs/api#invoiceitems">invoice items</a>, and
44
 * proration adjustments that may be caused by subscription upgrades/downgrades (if necessary).
45
 *
46
 * <p>If your invoice is configured to be billed through automatic charges, Stripe automatically
47
 * finalizes your invoice and attempts payment. Note that finalizing the invoice, <a
48
 * href="https://stripe.com/docs/invoicing/integration/automatic-advancement-collection">when
49
 * automatic</a>, does not happen immediately as the invoice is created. Stripe waits until one hour
50
 * after the last webhook was successfully sent (or the last webhook timed out after failing). If
51
 * you (and the platforms you may have connected to) have no webhooks configured, Stripe waits one
52
 * hour after creation to finalize the invoice.
53
 *
54
 * <p>If your invoice is configured to be billed by sending an email, then based on your <a
55
 * href="https://dashboard.stripe.com/account/billing/automatic">email settings</a>, Stripe will
56
 * email the invoice to your customer and await payment. These emails can contain a link to a hosted
57
 * page to pay the invoice.
58
 *
59
 * <p>Stripe applies any customer credit on the account before determining the amount due for the
60
 * invoice (i.e., the amount that will be actually charged). If the amount due for the invoice is
61
 * less than Stripe's <a
62
 * href="https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts">minimum allowed
63
 * charge per currency</a>, the invoice is automatically marked paid, and we add the amount due to
64
 * the customer's credit balance which is applied to the next invoice.
65
 *
66
 * <p>More details on the customer's credit balance are <a
67
 * href="https://stripe.com/docs/billing/customer/balance">here</a>.
68
 *
69
 * <p>Related guide: <a href="https://stripe.com/docs/billing/invoices/sending">Send invoices to
70
 * customers</a>
71
 */
72
@Getter
73
@Setter
74
@EqualsAndHashCode(callSuper = false)
75
public class Invoice extends ApiResource implements HasId, MetadataStore<Invoice> {
1✔
76
  /**
77
   * The country of the business associated with this invoice, most often the business creating the
78
   * invoice.
79
   */
80
  @SerializedName("account_country")
81
  String accountCountry;
82

83
  /**
84
   * The public name of the business associated with this invoice, most often the business creating
85
   * the invoice.
86
   */
87
  @SerializedName("account_name")
88
  String accountName;
89

90
  /** The account tax IDs associated with the invoice. Only editable when the invoice is a draft. */
91
  @SerializedName("account_tax_ids")
92
  List<ExpandableField<TaxId>> accountTaxIds;
93

94
  /**
95
   * Final amount due at this time for this invoice. If the invoice's total is smaller than the
96
   * minimum charge amount, for example, or if there is account credit that can be applied to the
97
   * invoice, the {@code amount_due} may be 0. If there is a positive {@code starting_balance} for
98
   * the invoice (the customer owes money), the {@code amount_due} will also take that into account.
99
   * The charge that gets generated for the invoice will be for the amount specified in {@code
100
   * amount_due}.
101
   */
102
  @SerializedName("amount_due")
103
  Long amountDue;
104

105
  /** The amount, in cents (or local equivalent), that was paid. */
106
  @SerializedName("amount_paid")
107
  Long amountPaid;
108

109
  /** The difference between amount_due and amount_paid, in cents (or local equivalent). */
110
  @SerializedName("amount_remaining")
111
  Long amountRemaining;
112

113
  /** This is the sum of all the shipping amounts. */
114
  @SerializedName("amount_shipping")
115
  Long amountShipping;
116

117
  /**
118
   * List of expected payments and corresponding due dates. This value will be null for invoices
119
   * where collection_method=charge_automatically.
120
   */
121
  @SerializedName("amounts_due")
122
  List<Invoice.AmountsDue> amountsDue;
123

124
  /** ID of the Connect Application that created the invoice. */
125
  @SerializedName("application")
126
  @Getter(lombok.AccessLevel.NONE)
127
  @Setter(lombok.AccessLevel.NONE)
128
  ExpandableField<Application> application;
129

130
  /**
131
   * The fee in cents (or local equivalent) that will be applied to the invoice and transferred to
132
   * the application owner's Stripe account when the invoice is paid.
133
   */
134
  @SerializedName("application_fee_amount")
135
  Long applicationFeeAmount;
136

137
  /**
138
   * Number of payment attempts made for this invoice, from the perspective of the payment retry
139
   * schedule. Any payment attempt counts as the first attempt, and subsequently only automatic
140
   * retries increment the attempt count. In other words, manual payment attempts after the first
141
   * attempt do not affect the retry schedule. If a failure is returned with a non-retryable return
142
   * code, the invoice can no longer be retried unless a new payment method is obtained. Retries
143
   * will continue to be scheduled, and attempt_count will continue to increment, but retries will
144
   * only be executed if a new payment method is obtained.
145
   */
146
  @SerializedName("attempt_count")
147
  Long attemptCount;
148

149
  /**
150
   * Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour
151
   * after the {@code invoice.created} webhook, for example, so you might not want to display that
152
   * invoice as unpaid to your users.
153
   */
154
  @SerializedName("attempted")
155
  Boolean attempted;
156

157
  /**
158
   * Controls whether Stripe performs <a
159
   * href="https://stripe.com/docs/invoicing/integration/automatic-advancement-collection">automatic
160
   * collection</a> of the invoice. If {@code false}, the invoice's state doesn't automatically
161
   * advance without an explicit action.
162
   */
163
  @SerializedName("auto_advance")
164
  Boolean autoAdvance;
165

166
  @SerializedName("automatic_tax")
167
  AutomaticTax automaticTax;
168

169
  /**
170
   * The time when this invoice is currently scheduled to be automatically finalized. The field will
171
   * be {@code null} if the invoice is not scheduled to finalize in the future. If the invoice is
172
   * not in the draft state, this field will always be {@code null} - see {@code finalized_at} for
173
   * the time when an already-finalized invoice was finalized.
174
   */
175
  @SerializedName("automatically_finalizes_at")
176
  Long automaticallyFinalizesAt;
177

178
  /**
179
   * Indicates the reason why the invoice was created.
180
   *
181
   * <p>* {@code manual}: Unrelated to a subscription, for example, created via the invoice editor.
182
   * * {@code subscription}: No longer in use. Applies to subscriptions from before May 2018 where
183
   * no distinction was made between updates, cycles, and thresholds. * {@code subscription_create}:
184
   * A new subscription was created. * {@code subscription_cycle}: A subscription advanced into a
185
   * new period. * {@code subscription_threshold}: A subscription reached a billing threshold. *
186
   * {@code subscription_update}: A subscription was updated. * {@code upcoming}: Reserved for
187
   * simulated invoices, per the upcoming invoice endpoint.
188
   *
189
   * <p>One of {@code automatic_pending_invoice_item_invoice}, {@code manual}, {@code quote_accept},
190
   * {@code subscription}, {@code subscription_create}, {@code subscription_cycle}, {@code
191
   * subscription_threshold}, {@code subscription_update}, or {@code upcoming}.
192
   */
193
  @SerializedName("billing_reason")
194
  String billingReason;
195

196
  /** ID of the latest charge generated for this invoice, if any. */
197
  @SerializedName("charge")
198
  @Getter(lombok.AccessLevel.NONE)
199
  @Setter(lombok.AccessLevel.NONE)
200
  ExpandableField<Charge> charge;
201

202
  /**
203
   * Either {@code charge_automatically}, or {@code send_invoice}. When charging automatically,
204
   * Stripe will attempt to pay this invoice using the default source attached to the customer. When
205
   * sending an invoice, Stripe will email this invoice to the customer with payment instructions.
206
   *
207
   * <p>One of {@code charge_automatically}, or {@code send_invoice}.
208
   */
209
  @SerializedName("collection_method")
210
  String collectionMethod;
211

212
  /** Time at which the object was created. Measured in seconds since the Unix epoch. */
213
  @SerializedName("created")
214
  Long created;
215

216
  /**
217
   * Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>,
218
   * in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
219
   */
220
  @SerializedName("currency")
221
  String currency;
222

223
  /** Custom fields displayed on the invoice. */
224
  @SerializedName("custom_fields")
225
  List<Invoice.CustomField> customFields;
226

227
  /** The ID of the customer who will be billed. */
228
  @SerializedName("customer")
229
  @Getter(lombok.AccessLevel.NONE)
230
  @Setter(lombok.AccessLevel.NONE)
231
  ExpandableField<Customer> customer;
232

233
  /**
234
   * The customer's address. Until the invoice is finalized, this field will equal {@code
235
   * customer.address}. Once the invoice is finalized, this field will no longer be updated.
236
   */
237
  @SerializedName("customer_address")
238
  Address customerAddress;
239

240
  /**
241
   * The customer's email. Until the invoice is finalized, this field will equal {@code
242
   * customer.email}. Once the invoice is finalized, this field will no longer be updated.
243
   */
244
  @SerializedName("customer_email")
245
  String customerEmail;
246

247
  /**
248
   * The customer's name. Until the invoice is finalized, this field will equal {@code
249
   * customer.name}. Once the invoice is finalized, this field will no longer be updated.
250
   */
251
  @SerializedName("customer_name")
252
  String customerName;
253

254
  /**
255
   * The customer's phone number. Until the invoice is finalized, this field will equal {@code
256
   * customer.phone}. Once the invoice is finalized, this field will no longer be updated.
257
   */
258
  @SerializedName("customer_phone")
259
  String customerPhone;
260

261
  /**
262
   * The customer's shipping information. Until the invoice is finalized, this field will equal
263
   * {@code customer.shipping}. Once the invoice is finalized, this field will no longer be updated.
264
   */
265
  @SerializedName("customer_shipping")
266
  ShippingDetails customerShipping;
267

268
  /**
269
   * The customer's tax exempt status. Until the invoice is finalized, this field will equal {@code
270
   * customer.tax_exempt}. Once the invoice is finalized, this field will no longer be updated.
271
   *
272
   * <p>One of {@code exempt}, {@code none}, or {@code reverse}.
273
   */
274
  @SerializedName("customer_tax_exempt")
275
  String customerTaxExempt;
276

277
  /**
278
   * The customer's tax IDs. Until the invoice is finalized, this field will contain the same tax
279
   * IDs as {@code customer.tax_ids}. Once the invoice is finalized, this field will no longer be
280
   * updated.
281
   */
282
  @SerializedName("customer_tax_ids")
283
  List<Invoice.CustomerTaxId> customerTaxIds;
284

285
  /**
286
   * The margins applied to the invoice. Can be overridden by line item {@code margins}. Use {@code
287
   * expand[]=default_margins} to expand each margin.
288
   */
289
  @SerializedName("default_margins")
290
  List<ExpandableField<Margin>> defaultMargins;
291

292
  /**
293
   * ID of the default payment method for the invoice. It must belong to the customer associated
294
   * with the invoice. If not set, defaults to the subscription's default payment method, if any, or
295
   * to the default payment method in the customer's invoice settings.
296
   */
297
  @SerializedName("default_payment_method")
298
  @Getter(lombok.AccessLevel.NONE)
299
  @Setter(lombok.AccessLevel.NONE)
300
  ExpandableField<PaymentMethod> defaultPaymentMethod;
301

302
  /**
303
   * ID of the default payment source for the invoice. It must belong to the customer associated
304
   * with the invoice and be in a chargeable state. If not set, defaults to the subscription's
305
   * default source, if any, or to the customer's default source.
306
   */
307
  @SerializedName("default_source")
308
  @Getter(lombok.AccessLevel.NONE)
309
  @Setter(lombok.AccessLevel.NONE)
310
  ExpandableField<PaymentSource> defaultSource;
311

312
  /** The tax rates applied to this invoice, if any. */
313
  @SerializedName("default_tax_rates")
314
  List<TaxRate> defaultTaxRates;
315

316
  /** Always true for a deleted object. */
317
  @SerializedName("deleted")
318
  Boolean deleted;
319

320
  /**
321
   * An arbitrary string attached to the object. Often useful for displaying to users. Referenced as
322
   * 'memo' in the Dashboard.
323
   */
324
  @SerializedName("description")
325
  String description;
326

327
  /**
328
   * Describes the current discount applied to this invoice, if there is one. Not populated if there
329
   * are multiple discounts.
330
   */
331
  @SerializedName("discount")
332
  Discount discount;
333

334
  /**
335
   * The discounts applied to the invoice. Line item discounts are applied before invoice discounts.
336
   * Use {@code expand[]=discounts} to expand each discount.
337
   */
338
  @SerializedName("discounts")
339
  List<ExpandableField<Discount>> discounts;
340

341
  /**
342
   * The date on which payment for this invoice is due. This value will be {@code null} for invoices
343
   * where {@code collection_method=charge_automatically}.
344
   */
345
  @SerializedName("due_date")
346
  Long dueDate;
347

348
  /**
349
   * The date when this invoice is in effect. Same as {@code finalized_at} unless overwritten. When
350
   * defined, this value replaces the system-generated 'Date of issue' printed on the invoice PDF
351
   * and receipt.
352
   */
353
  @SerializedName("effective_at")
354
  Long effectiveAt;
355

356
  /**
357
   * Ending customer balance after the invoice is finalized. Invoices are finalized approximately an
358
   * hour after successful webhook delivery or when payment collection is attempted for the invoice.
359
   * If the invoice has not been finalized yet, this will be null.
360
   */
361
  @SerializedName("ending_balance")
362
  Long endingBalance;
363

364
  /** Footer displayed on the invoice. */
365
  @SerializedName("footer")
366
  String footer;
367

368
  /**
369
   * Details of the invoice that was cloned. See the <a
370
   * href="https://stripe.com/docs/invoicing/invoice-revisions">revision documentation</a> for more
371
   * details.
372
   */
373
  @SerializedName("from_invoice")
374
  FromInvoice fromInvoice;
375

376
  /**
377
   * The URL for the hosted invoice page, which allows customers to view and pay an invoice. If the
378
   * invoice has not been finalized yet, this will be null.
379
   */
380
  @SerializedName("hosted_invoice_url")
381
  String hostedInvoiceUrl;
382

383
  /**
384
   * Unique identifier for the object. This property is always present unless the invoice is an
385
   * upcoming invoice. See <a href="https://stripe.com/docs/api/invoices/upcoming">Retrieve an
386
   * upcoming invoice</a> for more details.
387
   */
388
  @Getter(onMethod_ = {@Override})
389
  @SerializedName("id")
390
  String id;
391

392
  /**
393
   * The link to download the PDF for the invoice. If the invoice has not been finalized yet, this
394
   * will be null.
395
   */
396
  @SerializedName("invoice_pdf")
397
  String invoicePdf;
398

399
  @SerializedName("issuer")
400
  Issuer issuer;
401

402
  /**
403
   * The error encountered during the previous attempt to finalize the invoice. This field is
404
   * cleared when the invoice is successfully finalized.
405
   */
406
  @SerializedName("last_finalization_error")
407
  StripeError lastFinalizationError;
408

409
  /** The ID of the most recent non-draft revision of this invoice. */
410
  @SerializedName("latest_revision")
411
  @Getter(lombok.AccessLevel.NONE)
412
  @Setter(lombok.AccessLevel.NONE)
413
  ExpandableField<Invoice> latestRevision;
414

415
  /**
416
   * The individual line items that make up the invoice. {@code lines} is sorted as follows: (1)
417
   * pending invoice items (including prorations) in reverse chronological order, (2) subscription
418
   * items in reverse chronological order, and (3) invoice items added after invoice creation in
419
   * chronological order.
420
   */
421
  @SerializedName("lines")
422
  InvoiceLineItemCollection lines;
423

424
  /**
425
   * Has the value {@code true} if the object exists in live mode or the value {@code false} if the
426
   * object exists in test mode.
427
   */
428
  @SerializedName("livemode")
429
  Boolean livemode;
430

431
  /**
432
   * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach
433
   * to an object. This can be useful for storing additional information about the object in a
434
   * structured format.
435
   */
436
  @Getter(onMethod_ = {@Override})
437
  @SerializedName("metadata")
438
  Map<String, String> metadata;
439

440
  /**
441
   * The time at which payment will next be attempted. This value will be {@code null} for invoices
442
   * where {@code collection_method=send_invoice}.
443
   */
444
  @SerializedName("next_payment_attempt")
445
  Long nextPaymentAttempt;
446

447
  /**
448
   * A unique, identifying string that appears on emails sent to the customer for this invoice. This
449
   * starts with the customer's unique invoice_prefix if it is specified.
450
   */
451
  @SerializedName("number")
452
  String number;
453

454
  /**
455
   * String representing the object's type. Objects of the same type share the same value.
456
   *
457
   * <p>Equal to {@code invoice}.
458
   */
459
  @SerializedName("object")
460
  String object;
461

462
  /**
463
   * The account (if any) for which the funds of the invoice payment are intended. If set, the
464
   * invoice will be presented with the branding and support information of the specified account.
465
   * See the <a href="https://stripe.com/docs/billing/invoices/connect">Invoices with Connect</a>
466
   * documentation for details.
467
   */
468
  @SerializedName("on_behalf_of")
469
  @Getter(lombok.AccessLevel.NONE)
470
  @Setter(lombok.AccessLevel.NONE)
471
  ExpandableField<Account> onBehalfOf;
472

473
  /**
474
   * Whether payment was successfully collected for this invoice. An invoice can be paid (most
475
   * commonly) with a charge or with credit from the customer's account balance.
476
   */
477
  @SerializedName("paid")
478
  Boolean paid;
479

480
  /**
481
   * Returns true if the invoice was manually marked paid, returns false if the invoice hasn't been
482
   * paid yet or was paid on Stripe.
483
   */
484
  @SerializedName("paid_out_of_band")
485
  Boolean paidOutOfBand;
486

487
  /**
488
   * The PaymentIntent associated with this invoice. The PaymentIntent is generated when the invoice
489
   * is finalized, and can then be used to pay the invoice. Note that voiding an invoice will cancel
490
   * the PaymentIntent.
491
   */
492
  @SerializedName("payment_intent")
493
  @Getter(lombok.AccessLevel.NONE)
494
  @Setter(lombok.AccessLevel.NONE)
495
  ExpandableField<PaymentIntent> paymentIntent;
496

497
  @SerializedName("payment_settings")
498
  PaymentSettings paymentSettings;
499

500
  /** Payments for this invoice. */
501
  @SerializedName("payments")
502
  InvoicePaymentCollection payments;
503

504
  /**
505
   * End of the usage period during which invoice items were added to this invoice. This looks back
506
   * one period for a subscription invoice. Use the <a
507
   * href="https://stripe.com/api/invoices/line_item#invoice_line_item_object-period">line item
508
   * period</a> to get the service period for each price.
509
   */
510
  @SerializedName("period_end")
511
  Long periodEnd;
512

513
  /**
514
   * Start of the usage period during which invoice items were added to this invoice. This looks
515
   * back one period for a subscription invoice. Use the <a
516
   * href="https://stripe.com/api/invoices/line_item#invoice_line_item_object-period">line item
517
   * period</a> to get the service period for each price.
518
   */
519
  @SerializedName("period_start")
520
  Long periodStart;
521

522
  /** Total amount of all post-payment credit notes issued for this invoice. */
523
  @SerializedName("post_payment_credit_notes_amount")
524
  Long postPaymentCreditNotesAmount;
525

526
  /** Total amount of all pre-payment credit notes issued for this invoice. */
527
  @SerializedName("pre_payment_credit_notes_amount")
528
  Long prePaymentCreditNotesAmount;
529

530
  /** The quote this invoice was generated from. */
531
  @SerializedName("quote")
532
  @Getter(lombok.AccessLevel.NONE)
533
  @Setter(lombok.AccessLevel.NONE)
534
  ExpandableField<Quote> quote;
535

536
  /** This is the transaction number that appears on email receipts sent for this invoice. */
537
  @SerializedName("receipt_number")
538
  String receiptNumber;
539

540
  /**
541
   * The rendering-related settings that control how the invoice is displayed on customer-facing
542
   * surfaces such as PDF and Hosted Invoice Page.
543
   */
544
  @SerializedName("rendering")
545
  Rendering rendering;
546

547
  /** The details of the cost of shipping, including the ShippingRate applied on the invoice. */
548
  @SerializedName("shipping_cost")
549
  ShippingCost shippingCost;
550

551
  /**
552
   * Shipping details for the invoice. The Invoice PDF will use the {@code shipping_details} value
553
   * if it is set, otherwise the PDF will render the shipping address from the customer.
554
   */
555
  @SerializedName("shipping_details")
556
  ShippingDetails shippingDetails;
557

558
  /**
559
   * Starting customer balance before the invoice is finalized. If the invoice has not been
560
   * finalized yet, this will be the current customer balance. For revision invoices, this also
561
   * includes any customer balance that was applied to the original invoice.
562
   */
563
  @SerializedName("starting_balance")
564
  Long startingBalance;
565

566
  /** Extra information about an invoice for the customer's credit card statement. */
567
  @SerializedName("statement_descriptor")
568
  String statementDescriptor;
569

570
  /**
571
   * The status of the invoice, one of {@code draft}, {@code open}, {@code paid}, {@code
572
   * uncollectible}, or {@code void}. <a
573
   * href="https://stripe.com/docs/billing/invoices/workflow#workflow-overview">Learn more</a>
574
   */
575
  @SerializedName("status")
576
  String status;
577

578
  @SerializedName("status_transitions")
579
  StatusTransitions statusTransitions;
580

581
  /** The subscription that this invoice was prepared for, if any. */
582
  @SerializedName("subscription")
583
  @Getter(lombok.AccessLevel.NONE)
584
  @Setter(lombok.AccessLevel.NONE)
585
  ExpandableField<Subscription> subscription;
586

587
  /** Details about the subscription that created this invoice. */
588
  @SerializedName("subscription_details")
589
  SubscriptionDetails subscriptionDetails;
590

591
  /**
592
   * Only set for upcoming invoices that preview prorations. The time used to calculate prorations.
593
   */
594
  @SerializedName("subscription_proration_date")
595
  Long subscriptionProrationDate;
596

597
  /**
598
   * Total of all subscriptions, invoice items, and prorations on the invoice before any invoice
599
   * level discount or exclusive tax is applied. Item discounts are already incorporated
600
   */
601
  @SerializedName("subtotal")
602
  Long subtotal;
603

604
  /**
605
   * The integer amount in cents (or local equivalent) representing the subtotal of the invoice
606
   * before any invoice level discount or tax is applied. Item discounts are already incorporated
607
   */
608
  @SerializedName("subtotal_excluding_tax")
609
  Long subtotalExcludingTax;
610

611
  /** The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice. */
612
  @SerializedName("tax")
613
  Long tax;
614

615
  /** ID of the test clock this invoice belongs to. */
616
  @SerializedName("test_clock")
617
  @Getter(lombok.AccessLevel.NONE)
618
  @Setter(lombok.AccessLevel.NONE)
619
  ExpandableField<TestClock> testClock;
620

621
  @SerializedName("threshold_reason")
622
  ThresholdReason thresholdReason;
623

624
  /** Total after discounts and taxes. */
625
  @SerializedName("total")
626
  Long total;
627

628
  /** The aggregate amounts calculated per discount across all line items. */
629
  @SerializedName("total_discount_amounts")
630
  List<Invoice.TotalDiscountAmount> totalDiscountAmounts;
631

632
  /**
633
   * The integer amount in cents (or local equivalent) representing the total amount of the invoice
634
   * including all discounts but excluding all tax.
635
   */
636
  @SerializedName("total_excluding_tax")
637
  Long totalExcludingTax;
638

639
  /** The aggregate amounts calculated per margin across all line items. */
640
  @SerializedName("total_margin_amounts")
641
  List<Invoice.TotalMarginAmount> totalMarginAmounts;
642

643
  /**
644
   * Contains pretax credit amounts (ex: discount, credit grants, etc) that apply to this invoice.
645
   * This is a combined list of total_pretax_credit_amounts across all invoice line items.
646
   */
647
  @SerializedName("total_pretax_credit_amounts")
648
  List<Invoice.TotalPretaxCreditAmount> totalPretaxCreditAmounts;
649

650
  /** The aggregate amounts calculated per tax rate for all line items. */
651
  @SerializedName("total_tax_amounts")
652
  List<Invoice.TotalTaxAmount> totalTaxAmounts;
653

654
  /**
655
   * The account (if any) the payment will be attributed to for tax reporting, and where funds from
656
   * the payment will be transferred to for the invoice.
657
   */
658
  @SerializedName("transfer_data")
659
  TransferData transferData;
660

661
  /**
662
   * Invoices are automatically paid or sent 1 hour after webhooks are delivered, or until all
663
   * webhook delivery attempts have <a
664
   * href="https://stripe.com/docs/billing/webhooks#understand">been exhausted</a>. This field
665
   * tracks the time when webhooks for this invoice were successfully delivered. If the invoice had
666
   * no webhooks to deliver, this will be set while the invoice is being created.
667
   */
668
  @SerializedName("webhooks_delivered_at")
669
  Long webhooksDeliveredAt;
670

671
  /** Get ID of expandable {@code application} object. */
672
  public String getApplication() {
673
    return (this.application != null) ? this.application.getId() : null;
1✔
674
  }
675

676
  public void setApplication(String id) {
677
    this.application = ApiResource.setExpandableFieldId(id, this.application);
×
678
  }
×
679

680
  /** Get expanded {@code application}. */
681
  public Application getApplicationObject() {
682
    return (this.application != null) ? this.application.getExpanded() : null;
×
683
  }
684

685
  public void setApplicationObject(Application expandableObject) {
686
    this.application = new ExpandableField<Application>(expandableObject.getId(), expandableObject);
×
687
  }
×
688

689
  /** Get ID of expandable {@code charge} object. */
690
  public String getCharge() {
691
    return (this.charge != null) ? this.charge.getId() : null;
1✔
692
  }
693

694
  public void setCharge(String id) {
695
    this.charge = ApiResource.setExpandableFieldId(id, this.charge);
×
696
  }
×
697

698
  /** Get expanded {@code charge}. */
699
  public Charge getChargeObject() {
700
    return (this.charge != null) ? this.charge.getExpanded() : null;
1✔
701
  }
702

703
  public void setChargeObject(Charge expandableObject) {
704
    this.charge = new ExpandableField<Charge>(expandableObject.getId(), expandableObject);
×
705
  }
×
706

707
  /** Get ID of expandable {@code customer} object. */
708
  public String getCustomer() {
709
    return (this.customer != null) ? this.customer.getId() : null;
1✔
710
  }
711

712
  public void setCustomer(String id) {
713
    this.customer = ApiResource.setExpandableFieldId(id, this.customer);
×
714
  }
×
715

716
  /** Get expanded {@code customer}. */
717
  public Customer getCustomerObject() {
718
    return (this.customer != null) ? this.customer.getExpanded() : null;
1✔
719
  }
720

721
  public void setCustomerObject(Customer expandableObject) {
722
    this.customer = new ExpandableField<Customer>(expandableObject.getId(), expandableObject);
×
723
  }
×
724

725
  /** Get ID of expandable {@code defaultPaymentMethod} object. */
726
  public String getDefaultPaymentMethod() {
727
    return (this.defaultPaymentMethod != null) ? this.defaultPaymentMethod.getId() : null;
1✔
728
  }
729

730
  public void setDefaultPaymentMethod(String id) {
731
    this.defaultPaymentMethod = ApiResource.setExpandableFieldId(id, this.defaultPaymentMethod);
×
732
  }
×
733

734
  /** Get expanded {@code defaultPaymentMethod}. */
735
  public PaymentMethod getDefaultPaymentMethodObject() {
736
    return (this.defaultPaymentMethod != null) ? this.defaultPaymentMethod.getExpanded() : null;
×
737
  }
738

739
  public void setDefaultPaymentMethodObject(PaymentMethod expandableObject) {
740
    this.defaultPaymentMethod =
×
741
        new ExpandableField<PaymentMethod>(expandableObject.getId(), expandableObject);
×
742
  }
×
743

744
  /** Get ID of expandable {@code defaultSource} object. */
745
  public String getDefaultSource() {
746
    return (this.defaultSource != null) ? this.defaultSource.getId() : null;
1✔
747
  }
748

749
  public void setDefaultSource(String id) {
750
    this.defaultSource = ApiResource.setExpandableFieldId(id, this.defaultSource);
×
751
  }
×
752

753
  /** Get expanded {@code defaultSource}. */
754
  public PaymentSource getDefaultSourceObject() {
755
    return (this.defaultSource != null) ? this.defaultSource.getExpanded() : null;
×
756
  }
757

758
  public void setDefaultSourceObject(PaymentSource expandableObject) {
759
    this.defaultSource =
×
760
        new ExpandableField<PaymentSource>(expandableObject.getId(), expandableObject);
×
761
  }
×
762

763
  /** Get ID of expandable {@code latestRevision} object. */
764
  public String getLatestRevision() {
765
    return (this.latestRevision != null) ? this.latestRevision.getId() : null;
1✔
766
  }
767

768
  public void setLatestRevision(String id) {
769
    this.latestRevision = ApiResource.setExpandableFieldId(id, this.latestRevision);
×
770
  }
×
771

772
  /** Get expanded {@code latestRevision}. */
773
  public Invoice getLatestRevisionObject() {
774
    return (this.latestRevision != null) ? this.latestRevision.getExpanded() : null;
×
775
  }
776

777
  public void setLatestRevisionObject(Invoice expandableObject) {
778
    this.latestRevision = new ExpandableField<Invoice>(expandableObject.getId(), expandableObject);
×
779
  }
×
780

781
  /** Get ID of expandable {@code onBehalfOf} object. */
782
  public String getOnBehalfOf() {
783
    return (this.onBehalfOf != null) ? this.onBehalfOf.getId() : null;
1✔
784
  }
785

786
  public void setOnBehalfOf(String id) {
787
    this.onBehalfOf = ApiResource.setExpandableFieldId(id, this.onBehalfOf);
×
788
  }
×
789

790
  /** Get expanded {@code onBehalfOf}. */
791
  public Account getOnBehalfOfObject() {
792
    return (this.onBehalfOf != null) ? this.onBehalfOf.getExpanded() : null;
×
793
  }
794

795
  public void setOnBehalfOfObject(Account expandableObject) {
796
    this.onBehalfOf = new ExpandableField<Account>(expandableObject.getId(), expandableObject);
×
797
  }
×
798

799
  /** Get ID of expandable {@code paymentIntent} object. */
800
  public String getPaymentIntent() {
801
    return (this.paymentIntent != null) ? this.paymentIntent.getId() : null;
1✔
802
  }
803

804
  public void setPaymentIntent(String id) {
805
    this.paymentIntent = ApiResource.setExpandableFieldId(id, this.paymentIntent);
×
806
  }
×
807

808
  /** Get expanded {@code paymentIntent}. */
809
  public PaymentIntent getPaymentIntentObject() {
810
    return (this.paymentIntent != null) ? this.paymentIntent.getExpanded() : null;
×
811
  }
812

813
  public void setPaymentIntentObject(PaymentIntent expandableObject) {
814
    this.paymentIntent =
×
815
        new ExpandableField<PaymentIntent>(expandableObject.getId(), expandableObject);
×
816
  }
×
817

818
  /** Get ID of expandable {@code quote} object. */
819
  public String getQuote() {
820
    return (this.quote != null) ? this.quote.getId() : null;
1✔
821
  }
822

823
  public void setQuote(String id) {
824
    this.quote = ApiResource.setExpandableFieldId(id, this.quote);
×
825
  }
×
826

827
  /** Get expanded {@code quote}. */
828
  public Quote getQuoteObject() {
829
    return (this.quote != null) ? this.quote.getExpanded() : null;
×
830
  }
831

832
  public void setQuoteObject(Quote expandableObject) {
833
    this.quote = new ExpandableField<Quote>(expandableObject.getId(), expandableObject);
×
834
  }
×
835

836
  /** Get ID of expandable {@code subscription} object. */
837
  public String getSubscription() {
838
    return (this.subscription != null) ? this.subscription.getId() : null;
1✔
839
  }
840

841
  public void setSubscription(String id) {
842
    this.subscription = ApiResource.setExpandableFieldId(id, this.subscription);
×
843
  }
×
844

845
  /** Get expanded {@code subscription}. */
846
  public Subscription getSubscriptionObject() {
847
    return (this.subscription != null) ? this.subscription.getExpanded() : null;
×
848
  }
849

850
  public void setSubscriptionObject(Subscription expandableObject) {
851
    this.subscription =
×
852
        new ExpandableField<Subscription>(expandableObject.getId(), expandableObject);
×
853
  }
×
854

855
  /** Get ID of expandable {@code testClock} object. */
856
  public String getTestClock() {
857
    return (this.testClock != null) ? this.testClock.getId() : null;
1✔
858
  }
859

860
  public void setTestClock(String id) {
861
    this.testClock = ApiResource.setExpandableFieldId(id, this.testClock);
×
862
  }
×
863

864
  /** Get expanded {@code testClock}. */
865
  public TestClock getTestClockObject() {
866
    return (this.testClock != null) ? this.testClock.getExpanded() : null;
×
867
  }
868

869
  public void setTestClockObject(TestClock expandableObject) {
870
    this.testClock = new ExpandableField<TestClock>(expandableObject.getId(), expandableObject);
×
871
  }
×
872

873
  /** Get IDs of expandable {@code accountTaxIds} object list. */
874
  public List<String> getAccountTaxIds() {
875
    return (this.accountTaxIds != null)
1✔
876
        ? this.accountTaxIds.stream().map(x -> x.getId()).collect(Collectors.toList())
×
877
        : null;
1✔
878
  }
879

880
  public void setAccountTaxIds(List<String> ids) {
881
    if (ids == null) {
×
882
      this.accountTaxIds = null;
×
883
      return;
×
884
    }
885
    if (this.accountTaxIds != null
×
886
        && this.accountTaxIds.stream()
×
887
            .map(x -> x.getId())
×
888
            .collect(Collectors.toList())
×
889
            .equals(ids)) {
×
890
      // noop if the ids are equal to what are already present
891
      return;
×
892
    }
893
    this.accountTaxIds =
×
894
        (ids != null)
×
895
            ? ids.stream()
×
896
                .map(id -> new ExpandableField<TaxId>(id, null))
×
897
                .collect(Collectors.toList())
×
898
            : null;
×
899
  }
×
900

901
  /** Get expanded {@code accountTaxIds}. */
902
  public List<TaxId> getAccountTaxIdObjects() {
903
    return (this.accountTaxIds != null)
×
904
        ? this.accountTaxIds.stream().map(x -> x.getExpanded()).collect(Collectors.toList())
×
905
        : null;
×
906
  }
907

908
  public void setAccountTaxIdObjects(List<TaxId> objs) {
909
    this.accountTaxIds =
×
910
        objs != null
×
911
            ? objs.stream()
×
912
                .map(x -> new ExpandableField<TaxId>(x.getId(), x))
×
913
                .collect(Collectors.toList())
×
914
            : null;
×
915
  }
×
916

917
  /** Get IDs of expandable {@code defaultMargins} object list. */
918
  public List<String> getDefaultMargins() {
919
    return (this.defaultMargins != null)
1✔
920
        ? this.defaultMargins.stream().map(x -> x.getId()).collect(Collectors.toList())
×
921
        : null;
1✔
922
  }
923

924
  public void setDefaultMargins(List<String> ids) {
925
    if (ids == null) {
×
926
      this.defaultMargins = null;
×
927
      return;
×
928
    }
929
    if (this.defaultMargins != null
×
930
        && this.defaultMargins.stream()
×
931
            .map(x -> x.getId())
×
932
            .collect(Collectors.toList())
×
933
            .equals(ids)) {
×
934
      // noop if the ids are equal to what are already present
935
      return;
×
936
    }
937
    this.defaultMargins =
×
938
        (ids != null)
×
939
            ? ids.stream()
×
940
                .map(id -> new ExpandableField<Margin>(id, null))
×
941
                .collect(Collectors.toList())
×
942
            : null;
×
943
  }
×
944

945
  /** Get expanded {@code defaultMargins}. */
946
  public List<Margin> getDefaultMarginObjects() {
947
    return (this.defaultMargins != null)
×
948
        ? this.defaultMargins.stream().map(x -> x.getExpanded()).collect(Collectors.toList())
×
949
        : null;
×
950
  }
951

952
  public void setDefaultMarginObjects(List<Margin> objs) {
953
    this.defaultMargins =
×
954
        objs != null
×
955
            ? objs.stream()
×
956
                .map(x -> new ExpandableField<Margin>(x.getId(), x))
×
957
                .collect(Collectors.toList())
×
958
            : null;
×
959
  }
×
960

961
  /** Get IDs of expandable {@code discounts} object list. */
962
  public List<String> getDiscounts() {
963
    return (this.discounts != null)
1✔
964
        ? this.discounts.stream().map(x -> x.getId()).collect(Collectors.toList())
1✔
965
        : null;
×
966
  }
967

968
  public void setDiscounts(List<String> ids) {
969
    if (ids == null) {
×
970
      this.discounts = null;
×
971
      return;
×
972
    }
973
    if (this.discounts != null
×
974
        && this.discounts.stream().map(x -> x.getId()).collect(Collectors.toList()).equals(ids)) {
×
975
      // noop if the ids are equal to what are already present
976
      return;
×
977
    }
978
    this.discounts =
×
979
        (ids != null)
×
980
            ? ids.stream()
×
981
                .map(id -> new ExpandableField<Discount>(id, null))
×
982
                .collect(Collectors.toList())
×
983
            : null;
×
984
  }
×
985

986
  /** Get expanded {@code discounts}. */
987
  public List<Discount> getDiscountObjects() {
988
    return (this.discounts != null)
1✔
989
        ? this.discounts.stream().map(x -> x.getExpanded()).collect(Collectors.toList())
1✔
990
        : null;
×
991
  }
992

993
  public void setDiscountObjects(List<Discount> objs) {
994
    this.discounts =
×
995
        objs != null
×
996
            ? objs.stream()
×
997
                .map(x -> new ExpandableField<Discount>(x.getId(), x))
×
998
                .collect(Collectors.toList())
×
999
            : null;
×
1000
  }
×
1001

1002
  /**
1003
   * Adds multiple line items to an invoice. This is only possible when an invoice is still a draft.
1004
   */
1005
  public Invoice addLines(Map<String, Object> params) throws StripeException {
1006
    return addLines(params, (RequestOptions) null);
×
1007
  }
1008

1009
  /**
1010
   * Adds multiple line items to an invoice. This is only possible when an invoice is still a draft.
1011
   */
1012
  public Invoice addLines(Map<String, Object> params, RequestOptions options)
1013
      throws StripeException {
1014
    String path = String.format("/v1/invoices/%s/add_lines", ApiResource.urlEncodeId(this.getId()));
×
1015
    ApiRequest request =
×
1016
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
1017
    return getResponseGetter().request(request, Invoice.class);
×
1018
  }
1019

1020
  /**
1021
   * Adds multiple line items to an invoice. This is only possible when an invoice is still a draft.
1022
   */
1023
  public Invoice addLines(InvoiceAddLinesParams params) throws StripeException {
1024
    return addLines(params, (RequestOptions) null);
×
1025
  }
1026

1027
  /**
1028
   * Adds multiple line items to an invoice. This is only possible when an invoice is still a draft.
1029
   */
1030
  public Invoice addLines(InvoiceAddLinesParams params, RequestOptions options)
1031
      throws StripeException {
1032
    String path = String.format("/v1/invoices/%s/add_lines", ApiResource.urlEncodeId(this.getId()));
×
1033
    ApiResource.checkNullTypedParams(path, params);
×
1034
    ApiRequest request =
×
1035
        new ApiRequest(
1036
            BaseAddress.API,
1037
            ApiResource.RequestMethod.POST,
1038
            path,
1039
            ApiRequestParams.paramsToMap(params),
×
1040
            options);
1041
    return getResponseGetter().request(request, Invoice.class);
×
1042
  }
1043

1044
  /**
1045
   * Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of
1046
   * {@code payments}.
1047
   *
1048
   * <p>For Out of Band Payment, the payment is credited to the invoice immediately, increasing the
1049
   * {@code amount_paid} of the invoice and subsequently transitioning the status of the invoice to
1050
   * {@code paid} if necessary.
1051
   *
1052
   * <p>For the PaymentIntent, when the PaymentIntent’s status changes to {@code succeeded}, the
1053
   * payment is credited to the invoice, increasing its {@code amount_paid}. When the invoice is
1054
   * fully paid, the invoice’s status becomes {@code paid}.
1055
   *
1056
   * <p>If the PaymentIntent’s status is already {@code succeeded} when it’s attached, it’s credited
1057
   * to the invoice immediately.
1058
   *
1059
   * <p>See: <a href="https://stripe.com/docs/invoicing/payments/create">Create an invoice
1060
   * payment</a> to learn more.
1061
   */
1062
  public Invoice attachPayment() throws StripeException {
1063
    return attachPayment((Map<String, Object>) null, (RequestOptions) null);
×
1064
  }
1065

1066
  /**
1067
   * Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of
1068
   * {@code payments}.
1069
   *
1070
   * <p>For Out of Band Payment, the payment is credited to the invoice immediately, increasing the
1071
   * {@code amount_paid} of the invoice and subsequently transitioning the status of the invoice to
1072
   * {@code paid} if necessary.
1073
   *
1074
   * <p>For the PaymentIntent, when the PaymentIntent’s status changes to {@code succeeded}, the
1075
   * payment is credited to the invoice, increasing its {@code amount_paid}. When the invoice is
1076
   * fully paid, the invoice’s status becomes {@code paid}.
1077
   *
1078
   * <p>If the PaymentIntent’s status is already {@code succeeded} when it’s attached, it’s credited
1079
   * to the invoice immediately.
1080
   *
1081
   * <p>See: <a href="https://stripe.com/docs/invoicing/payments/create">Create an invoice
1082
   * payment</a> to learn more.
1083
   */
1084
  public Invoice attachPayment(RequestOptions options) throws StripeException {
1085
    return attachPayment((Map<String, Object>) null, options);
×
1086
  }
1087

1088
  /**
1089
   * Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of
1090
   * {@code payments}.
1091
   *
1092
   * <p>For Out of Band Payment, the payment is credited to the invoice immediately, increasing the
1093
   * {@code amount_paid} of the invoice and subsequently transitioning the status of the invoice to
1094
   * {@code paid} if necessary.
1095
   *
1096
   * <p>For the PaymentIntent, when the PaymentIntent’s status changes to {@code succeeded}, the
1097
   * payment is credited to the invoice, increasing its {@code amount_paid}. When the invoice is
1098
   * fully paid, the invoice’s status becomes {@code paid}.
1099
   *
1100
   * <p>If the PaymentIntent’s status is already {@code succeeded} when it’s attached, it’s credited
1101
   * to the invoice immediately.
1102
   *
1103
   * <p>See: <a href="https://stripe.com/docs/invoicing/payments/create">Create an invoice
1104
   * payment</a> to learn more.
1105
   */
1106
  public Invoice attachPayment(Map<String, Object> params) throws StripeException {
1107
    return attachPayment(params, (RequestOptions) null);
×
1108
  }
1109

1110
  /**
1111
   * Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of
1112
   * {@code payments}.
1113
   *
1114
   * <p>For Out of Band Payment, the payment is credited to the invoice immediately, increasing the
1115
   * {@code amount_paid} of the invoice and subsequently transitioning the status of the invoice to
1116
   * {@code paid} if necessary.
1117
   *
1118
   * <p>For the PaymentIntent, when the PaymentIntent’s status changes to {@code succeeded}, the
1119
   * payment is credited to the invoice, increasing its {@code amount_paid}. When the invoice is
1120
   * fully paid, the invoice’s status becomes {@code paid}.
1121
   *
1122
   * <p>If the PaymentIntent’s status is already {@code succeeded} when it’s attached, it’s credited
1123
   * to the invoice immediately.
1124
   *
1125
   * <p>See: <a href="https://stripe.com/docs/invoicing/payments/create">Create an invoice
1126
   * payment</a> to learn more.
1127
   */
1128
  public Invoice attachPayment(Map<String, Object> params, RequestOptions options)
1129
      throws StripeException {
1130
    String path =
×
1131
        String.format("/v1/invoices/%s/attach_payment", ApiResource.urlEncodeId(this.getId()));
×
1132
    ApiRequest request =
×
1133
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
1134
    return getResponseGetter().request(request, Invoice.class);
×
1135
  }
1136

1137
  /**
1138
   * Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of
1139
   * {@code payments}.
1140
   *
1141
   * <p>For Out of Band Payment, the payment is credited to the invoice immediately, increasing the
1142
   * {@code amount_paid} of the invoice and subsequently transitioning the status of the invoice to
1143
   * {@code paid} if necessary.
1144
   *
1145
   * <p>For the PaymentIntent, when the PaymentIntent’s status changes to {@code succeeded}, the
1146
   * payment is credited to the invoice, increasing its {@code amount_paid}. When the invoice is
1147
   * fully paid, the invoice’s status becomes {@code paid}.
1148
   *
1149
   * <p>If the PaymentIntent’s status is already {@code succeeded} when it’s attached, it’s credited
1150
   * to the invoice immediately.
1151
   *
1152
   * <p>See: <a href="https://stripe.com/docs/invoicing/payments/create">Create an invoice
1153
   * payment</a> to learn more.
1154
   */
1155
  public Invoice attachPayment(InvoiceAttachPaymentParams params) throws StripeException {
1156
    return attachPayment(params, (RequestOptions) null);
×
1157
  }
1158

1159
  /**
1160
   * Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of
1161
   * {@code payments}.
1162
   *
1163
   * <p>For Out of Band Payment, the payment is credited to the invoice immediately, increasing the
1164
   * {@code amount_paid} of the invoice and subsequently transitioning the status of the invoice to
1165
   * {@code paid} if necessary.
1166
   *
1167
   * <p>For the PaymentIntent, when the PaymentIntent’s status changes to {@code succeeded}, the
1168
   * payment is credited to the invoice, increasing its {@code amount_paid}. When the invoice is
1169
   * fully paid, the invoice’s status becomes {@code paid}.
1170
   *
1171
   * <p>If the PaymentIntent’s status is already {@code succeeded} when it’s attached, it’s credited
1172
   * to the invoice immediately.
1173
   *
1174
   * <p>See: <a href="https://stripe.com/docs/invoicing/payments/create">Create an invoice
1175
   * payment</a> to learn more.
1176
   */
1177
  public Invoice attachPayment(InvoiceAttachPaymentParams params, RequestOptions options)
1178
      throws StripeException {
1179
    String path =
×
1180
        String.format("/v1/invoices/%s/attach_payment", ApiResource.urlEncodeId(this.getId()));
×
1181
    ApiResource.checkNullTypedParams(path, params);
×
1182
    ApiRequest request =
×
1183
        new ApiRequest(
1184
            BaseAddress.API,
1185
            ApiResource.RequestMethod.POST,
1186
            path,
1187
            ApiRequestParams.paramsToMap(params),
×
1188
            options);
1189
    return getResponseGetter().request(request, Invoice.class);
×
1190
  }
1191

1192
  /**
1193
   * Attaches a PaymentIntent to the invoice, adding it to the list of {@code payments}. When the
1194
   * PaymentIntent’s status changes to {@code succeeded}, the payment is credited to the invoice,
1195
   * increasing its {@code amount_paid}. When the invoice is fully paid, the invoice’s status
1196
   * becomes {@code paid}.
1197
   *
1198
   * <p>If the PaymentIntent’s status is already {@code succeeded} when it is attached, it is
1199
   * credited to the invoice immediately.
1200
   *
1201
   * <p>Related guide: <a href="https://stripe.com/docs/invoicing/payments/create">Create an invoice
1202
   * payment</a>
1203
   */
1204
  public Invoice attachPaymentIntent(Map<String, Object> params) throws StripeException {
1205
    return attachPaymentIntent(params, (RequestOptions) null);
×
1206
  }
1207

1208
  /**
1209
   * Attaches a PaymentIntent to the invoice, adding it to the list of {@code payments}. When the
1210
   * PaymentIntent’s status changes to {@code succeeded}, the payment is credited to the invoice,
1211
   * increasing its {@code amount_paid}. When the invoice is fully paid, the invoice’s status
1212
   * becomes {@code paid}.
1213
   *
1214
   * <p>If the PaymentIntent’s status is already {@code succeeded} when it is attached, it is
1215
   * credited to the invoice immediately.
1216
   *
1217
   * <p>Related guide: <a href="https://stripe.com/docs/invoicing/payments/create">Create an invoice
1218
   * payment</a>
1219
   */
1220
  public Invoice attachPaymentIntent(Map<String, Object> params, RequestOptions options)
1221
      throws StripeException {
1222
    String path =
×
1223
        String.format(
×
1224
            "/v1/invoices/%s/attach_payment_intent", ApiResource.urlEncodeId(this.getId()));
×
1225
    ApiRequest request =
×
1226
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
1227
    return getResponseGetter().request(request, Invoice.class);
×
1228
  }
1229

1230
  /**
1231
   * Attaches a PaymentIntent to the invoice, adding it to the list of {@code payments}. When the
1232
   * PaymentIntent’s status changes to {@code succeeded}, the payment is credited to the invoice,
1233
   * increasing its {@code amount_paid}. When the invoice is fully paid, the invoice’s status
1234
   * becomes {@code paid}.
1235
   *
1236
   * <p>If the PaymentIntent’s status is already {@code succeeded} when it is attached, it is
1237
   * credited to the invoice immediately.
1238
   *
1239
   * <p>Related guide: <a href="https://stripe.com/docs/invoicing/payments/create">Create an invoice
1240
   * payment</a>
1241
   */
1242
  public Invoice attachPaymentIntent(InvoiceAttachPaymentIntentParams params)
1243
      throws StripeException {
1244
    return attachPaymentIntent(params, (RequestOptions) null);
×
1245
  }
1246

1247
  /**
1248
   * Attaches a PaymentIntent to the invoice, adding it to the list of {@code payments}. When the
1249
   * PaymentIntent’s status changes to {@code succeeded}, the payment is credited to the invoice,
1250
   * increasing its {@code amount_paid}. When the invoice is fully paid, the invoice’s status
1251
   * becomes {@code paid}.
1252
   *
1253
   * <p>If the PaymentIntent’s status is already {@code succeeded} when it is attached, it is
1254
   * credited to the invoice immediately.
1255
   *
1256
   * <p>Related guide: <a href="https://stripe.com/docs/invoicing/payments/create">Create an invoice
1257
   * payment</a>
1258
   */
1259
  public Invoice attachPaymentIntent(
1260
      InvoiceAttachPaymentIntentParams params, RequestOptions options) throws StripeException {
1261
    String path =
×
1262
        String.format(
×
1263
            "/v1/invoices/%s/attach_payment_intent", ApiResource.urlEncodeId(this.getId()));
×
1264
    ApiResource.checkNullTypedParams(path, params);
×
1265
    ApiRequest request =
×
1266
        new ApiRequest(
1267
            BaseAddress.API,
1268
            ApiResource.RequestMethod.POST,
1269
            path,
1270
            ApiRequestParams.paramsToMap(params),
×
1271
            options);
1272
    return getResponseGetter().request(request, Invoice.class);
×
1273
  }
1274

1275
  /**
1276
   * This endpoint creates a draft invoice for a given customer. The invoice remains a draft until
1277
   * you <a href="https://stripe.com/docs/api#finalize_invoice">finalize</a> the invoice, which
1278
   * allows you to <a href="https://stripe.com/docs/api#pay_invoice">pay</a> or <a
1279
   * href="https://stripe.com/docs/api#send_invoice">send</a> the invoice to your customers.
1280
   */
1281
  public static Invoice create(Map<String, Object> params) throws StripeException {
1282
    return create(params, (RequestOptions) null);
1✔
1283
  }
1284

1285
  /**
1286
   * This endpoint creates a draft invoice for a given customer. The invoice remains a draft until
1287
   * you <a href="https://stripe.com/docs/api#finalize_invoice">finalize</a> the invoice, which
1288
   * allows you to <a href="https://stripe.com/docs/api#pay_invoice">pay</a> or <a
1289
   * href="https://stripe.com/docs/api#send_invoice">send</a> the invoice to your customers.
1290
   */
1291
  public static Invoice create(Map<String, Object> params, RequestOptions options)
1292
      throws StripeException {
1293
    String path = "/v1/invoices";
1✔
1294
    ApiRequest request =
1✔
1295
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
1296
    return getGlobalResponseGetter().request(request, Invoice.class);
1✔
1297
  }
1298

1299
  /**
1300
   * This endpoint creates a draft invoice for a given customer. The invoice remains a draft until
1301
   * you <a href="https://stripe.com/docs/api#finalize_invoice">finalize</a> the invoice, which
1302
   * allows you to <a href="https://stripe.com/docs/api#pay_invoice">pay</a> or <a
1303
   * href="https://stripe.com/docs/api#send_invoice">send</a> the invoice to your customers.
1304
   */
1305
  public static Invoice create(InvoiceCreateParams params) throws StripeException {
1306
    return create(params, (RequestOptions) null);
1✔
1307
  }
1308

1309
  /**
1310
   * This endpoint creates a draft invoice for a given customer. The invoice remains a draft until
1311
   * you <a href="https://stripe.com/docs/api#finalize_invoice">finalize</a> the invoice, which
1312
   * allows you to <a href="https://stripe.com/docs/api#pay_invoice">pay</a> or <a
1313
   * href="https://stripe.com/docs/api#send_invoice">send</a> the invoice to your customers.
1314
   */
1315
  public static Invoice create(InvoiceCreateParams params, RequestOptions options)
1316
      throws StripeException {
1317
    String path = "/v1/invoices";
1✔
1318
    ApiResource.checkNullTypedParams(path, params);
1✔
1319
    ApiRequest request =
1✔
1320
        new ApiRequest(
1321
            BaseAddress.API,
1322
            ApiResource.RequestMethod.POST,
1323
            path,
1324
            ApiRequestParams.paramsToMap(params),
1✔
1325
            options);
1326
    return getGlobalResponseGetter().request(request, Invoice.class);
1✔
1327
  }
1328

1329
  /**
1330
   * At any time, you can preview the upcoming invoice for a customer. This will show you all the
1331
   * charges that are pending, including subscription renewal charges, invoice item charges, etc. It
1332
   * will also show you any discounts that are applicable to the invoice.
1333
   *
1334
   * <p>Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the
1335
   * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice
1336
   * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the
1337
   * amount that your customer will be billed, you can add, remove, or update pending invoice items,
1338
   * or update the customer’s discount.
1339
   *
1340
   * <p>You can preview the effects of updating a subscription, including a preview of what
1341
   * proration will take place. To ensure that the actual proration is calculated exactly the same
1342
   * as the previewed proration, you should pass the {@code subscription_details.proration_date}
1343
   * parameter when doing the actual subscription update. The recommended way to get only the
1344
   * prorations being previewed is to consider only proration line items where {@code period[start]}
1345
   * is equal to the {@code subscription_details.proration_date} value passed in the request.
1346
   *
1347
   * <p>Note: Currency conversion calculations use the latest exchange rates. Exchange rates may
1348
   * vary between the time of the preview and the time of the actual invoice creation. <a
1349
   * href="https://docs.stripe.com/currencies/conversions">Learn more</a>
1350
   */
1351
  public static Invoice createPreview() throws StripeException {
1352
    return createPreview((Map<String, Object>) null, (RequestOptions) null);
×
1353
  }
1354

1355
  /**
1356
   * At any time, you can preview the upcoming invoice for a customer. This will show you all the
1357
   * charges that are pending, including subscription renewal charges, invoice item charges, etc. It
1358
   * will also show you any discounts that are applicable to the invoice.
1359
   *
1360
   * <p>Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the
1361
   * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice
1362
   * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the
1363
   * amount that your customer will be billed, you can add, remove, or update pending invoice items,
1364
   * or update the customer’s discount.
1365
   *
1366
   * <p>You can preview the effects of updating a subscription, including a preview of what
1367
   * proration will take place. To ensure that the actual proration is calculated exactly the same
1368
   * as the previewed proration, you should pass the {@code subscription_details.proration_date}
1369
   * parameter when doing the actual subscription update. The recommended way to get only the
1370
   * prorations being previewed is to consider only proration line items where {@code period[start]}
1371
   * is equal to the {@code subscription_details.proration_date} value passed in the request.
1372
   *
1373
   * <p>Note: Currency conversion calculations use the latest exchange rates. Exchange rates may
1374
   * vary between the time of the preview and the time of the actual invoice creation. <a
1375
   * href="https://docs.stripe.com/currencies/conversions">Learn more</a>
1376
   */
1377
  public static Invoice createPreview(RequestOptions options) throws StripeException {
1378
    return createPreview((Map<String, Object>) null, options);
×
1379
  }
1380

1381
  /**
1382
   * At any time, you can preview the upcoming invoice for a customer. This will show you all the
1383
   * charges that are pending, including subscription renewal charges, invoice item charges, etc. It
1384
   * will also show you any discounts that are applicable to the invoice.
1385
   *
1386
   * <p>Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the
1387
   * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice
1388
   * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the
1389
   * amount that your customer will be billed, you can add, remove, or update pending invoice items,
1390
   * or update the customer’s discount.
1391
   *
1392
   * <p>You can preview the effects of updating a subscription, including a preview of what
1393
   * proration will take place. To ensure that the actual proration is calculated exactly the same
1394
   * as the previewed proration, you should pass the {@code subscription_details.proration_date}
1395
   * parameter when doing the actual subscription update. The recommended way to get only the
1396
   * prorations being previewed is to consider only proration line items where {@code period[start]}
1397
   * is equal to the {@code subscription_details.proration_date} value passed in the request.
1398
   *
1399
   * <p>Note: Currency conversion calculations use the latest exchange rates. Exchange rates may
1400
   * vary between the time of the preview and the time of the actual invoice creation. <a
1401
   * href="https://docs.stripe.com/currencies/conversions">Learn more</a>
1402
   */
1403
  public static Invoice createPreview(Map<String, Object> params) throws StripeException {
1404
    return createPreview(params, (RequestOptions) null);
×
1405
  }
1406

1407
  /**
1408
   * At any time, you can preview the upcoming invoice for a customer. This will show you all the
1409
   * charges that are pending, including subscription renewal charges, invoice item charges, etc. It
1410
   * will also show you any discounts that are applicable to the invoice.
1411
   *
1412
   * <p>Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the
1413
   * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice
1414
   * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the
1415
   * amount that your customer will be billed, you can add, remove, or update pending invoice items,
1416
   * or update the customer’s discount.
1417
   *
1418
   * <p>You can preview the effects of updating a subscription, including a preview of what
1419
   * proration will take place. To ensure that the actual proration is calculated exactly the same
1420
   * as the previewed proration, you should pass the {@code subscription_details.proration_date}
1421
   * parameter when doing the actual subscription update. The recommended way to get only the
1422
   * prorations being previewed is to consider only proration line items where {@code period[start]}
1423
   * is equal to the {@code subscription_details.proration_date} value passed in the request.
1424
   *
1425
   * <p>Note: Currency conversion calculations use the latest exchange rates. Exchange rates may
1426
   * vary between the time of the preview and the time of the actual invoice creation. <a
1427
   * href="https://docs.stripe.com/currencies/conversions">Learn more</a>
1428
   */
1429
  public static Invoice createPreview(Map<String, Object> params, RequestOptions options)
1430
      throws StripeException {
1431
    String path = "/v1/invoices/create_preview";
×
1432
    ApiRequest request =
×
1433
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
1434
    return getGlobalResponseGetter().request(request, Invoice.class);
×
1435
  }
1436

1437
  /**
1438
   * At any time, you can preview the upcoming invoice for a customer. This will show you all the
1439
   * charges that are pending, including subscription renewal charges, invoice item charges, etc. It
1440
   * will also show you any discounts that are applicable to the invoice.
1441
   *
1442
   * <p>Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the
1443
   * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice
1444
   * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the
1445
   * amount that your customer will be billed, you can add, remove, or update pending invoice items,
1446
   * or update the customer’s discount.
1447
   *
1448
   * <p>You can preview the effects of updating a subscription, including a preview of what
1449
   * proration will take place. To ensure that the actual proration is calculated exactly the same
1450
   * as the previewed proration, you should pass the {@code subscription_details.proration_date}
1451
   * parameter when doing the actual subscription update. The recommended way to get only the
1452
   * prorations being previewed is to consider only proration line items where {@code period[start]}
1453
   * is equal to the {@code subscription_details.proration_date} value passed in the request.
1454
   *
1455
   * <p>Note: Currency conversion calculations use the latest exchange rates. Exchange rates may
1456
   * vary between the time of the preview and the time of the actual invoice creation. <a
1457
   * href="https://docs.stripe.com/currencies/conversions">Learn more</a>
1458
   */
1459
  public static Invoice createPreview(InvoiceCreatePreviewParams params) throws StripeException {
1460
    return createPreview(params, (RequestOptions) null);
×
1461
  }
1462

1463
  /**
1464
   * At any time, you can preview the upcoming invoice for a customer. This will show you all the
1465
   * charges that are pending, including subscription renewal charges, invoice item charges, etc. It
1466
   * will also show you any discounts that are applicable to the invoice.
1467
   *
1468
   * <p>Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the
1469
   * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice
1470
   * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the
1471
   * amount that your customer will be billed, you can add, remove, or update pending invoice items,
1472
   * or update the customer’s discount.
1473
   *
1474
   * <p>You can preview the effects of updating a subscription, including a preview of what
1475
   * proration will take place. To ensure that the actual proration is calculated exactly the same
1476
   * as the previewed proration, you should pass the {@code subscription_details.proration_date}
1477
   * parameter when doing the actual subscription update. The recommended way to get only the
1478
   * prorations being previewed is to consider only proration line items where {@code period[start]}
1479
   * is equal to the {@code subscription_details.proration_date} value passed in the request.
1480
   *
1481
   * <p>Note: Currency conversion calculations use the latest exchange rates. Exchange rates may
1482
   * vary between the time of the preview and the time of the actual invoice creation. <a
1483
   * href="https://docs.stripe.com/currencies/conversions">Learn more</a>
1484
   */
1485
  public static Invoice createPreview(InvoiceCreatePreviewParams params, RequestOptions options)
1486
      throws StripeException {
1487
    String path = "/v1/invoices/create_preview";
×
1488
    ApiResource.checkNullTypedParams(path, params);
×
1489
    ApiRequest request =
×
1490
        new ApiRequest(
1491
            BaseAddress.API,
1492
            ApiResource.RequestMethod.POST,
1493
            path,
1494
            ApiRequestParams.paramsToMap(params),
×
1495
            options);
1496
    return getGlobalResponseGetter().request(request, Invoice.class);
×
1497
  }
1498

1499
  /**
1500
   * Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices
1501
   * that are no longer in a draft state will fail; once an invoice has been finalized or if an
1502
   * invoice is for a subscription, it must be <a
1503
   * href="https://stripe.com/docs/api#void_invoice">voided</a>.
1504
   */
1505
  public Invoice delete() throws StripeException {
1506
    return delete((Map<String, Object>) null, (RequestOptions) null);
1✔
1507
  }
1508

1509
  /**
1510
   * Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices
1511
   * that are no longer in a draft state will fail; once an invoice has been finalized or if an
1512
   * invoice is for a subscription, it must be <a
1513
   * href="https://stripe.com/docs/api#void_invoice">voided</a>.
1514
   */
1515
  public Invoice delete(RequestOptions options) throws StripeException {
1516
    return delete((Map<String, Object>) null, options);
×
1517
  }
1518

1519
  /**
1520
   * Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices
1521
   * that are no longer in a draft state will fail; once an invoice has been finalized or if an
1522
   * invoice is for a subscription, it must be <a
1523
   * href="https://stripe.com/docs/api#void_invoice">voided</a>.
1524
   */
1525
  public Invoice delete(Map<String, Object> params) throws StripeException {
1526
    return delete(params, (RequestOptions) null);
×
1527
  }
1528

1529
  /**
1530
   * Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices
1531
   * that are no longer in a draft state will fail; once an invoice has been finalized or if an
1532
   * invoice is for a subscription, it must be <a
1533
   * href="https://stripe.com/docs/api#void_invoice">voided</a>.
1534
   */
1535
  public Invoice delete(Map<String, Object> params, RequestOptions options) throws StripeException {
1536
    String path = String.format("/v1/invoices/%s", ApiResource.urlEncodeId(this.getId()));
1✔
1537
    ApiRequest request =
1✔
1538
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.DELETE, path, params, options);
1539
    return getResponseGetter().request(request, Invoice.class);
1✔
1540
  }
1541

1542
  /**
1543
   * Stripe automatically finalizes drafts before sending and attempting payment on invoices.
1544
   * However, if you’d like to finalize a draft invoice manually, you can do so using this method.
1545
   */
1546
  public Invoice finalizeInvoice() throws StripeException {
1547
    return finalizeInvoice((Map<String, Object>) null, (RequestOptions) null);
1✔
1548
  }
1549

1550
  /**
1551
   * Stripe automatically finalizes drafts before sending and attempting payment on invoices.
1552
   * However, if you’d like to finalize a draft invoice manually, you can do so using this method.
1553
   */
1554
  public Invoice finalizeInvoice(RequestOptions options) throws StripeException {
1555
    return finalizeInvoice((Map<String, Object>) null, options);
×
1556
  }
1557

1558
  /**
1559
   * Stripe automatically finalizes drafts before sending and attempting payment on invoices.
1560
   * However, if you’d like to finalize a draft invoice manually, you can do so using this method.
1561
   */
1562
  public Invoice finalizeInvoice(Map<String, Object> params) throws StripeException {
1563
    return finalizeInvoice(params, (RequestOptions) null);
×
1564
  }
1565

1566
  /**
1567
   * Stripe automatically finalizes drafts before sending and attempting payment on invoices.
1568
   * However, if you’d like to finalize a draft invoice manually, you can do so using this method.
1569
   */
1570
  public Invoice finalizeInvoice(Map<String, Object> params, RequestOptions options)
1571
      throws StripeException {
1572
    String path = String.format("/v1/invoices/%s/finalize", ApiResource.urlEncodeId(this.getId()));
1✔
1573
    ApiRequest request =
1✔
1574
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
1575
    return getResponseGetter().request(request, Invoice.class);
1✔
1576
  }
1577

1578
  /**
1579
   * Stripe automatically finalizes drafts before sending and attempting payment on invoices.
1580
   * However, if you’d like to finalize a draft invoice manually, you can do so using this method.
1581
   */
1582
  public Invoice finalizeInvoice(InvoiceFinalizeInvoiceParams params) throws StripeException {
1583
    return finalizeInvoice(params, (RequestOptions) null);
1✔
1584
  }
1585

1586
  /**
1587
   * Stripe automatically finalizes drafts before sending and attempting payment on invoices.
1588
   * However, if you’d like to finalize a draft invoice manually, you can do so using this method.
1589
   */
1590
  public Invoice finalizeInvoice(InvoiceFinalizeInvoiceParams params, RequestOptions options)
1591
      throws StripeException {
1592
    String path = String.format("/v1/invoices/%s/finalize", ApiResource.urlEncodeId(this.getId()));
1✔
1593
    ApiResource.checkNullTypedParams(path, params);
1✔
1594
    ApiRequest request =
1✔
1595
        new ApiRequest(
1596
            BaseAddress.API,
1597
            ApiResource.RequestMethod.POST,
1598
            path,
1599
            ApiRequestParams.paramsToMap(params),
1✔
1600
            options);
1601
    return getResponseGetter().request(request, Invoice.class);
1✔
1602
  }
1603

1604
  /**
1605
   * You can list all invoices, or list the invoices for a specific customer. The invoices are
1606
   * returned sorted by creation date, with the most recently created invoices appearing first.
1607
   */
1608
  public static InvoiceCollection list(Map<String, Object> params) throws StripeException {
1609
    return list(params, (RequestOptions) null);
1✔
1610
  }
1611

1612
  /**
1613
   * You can list all invoices, or list the invoices for a specific customer. The invoices are
1614
   * returned sorted by creation date, with the most recently created invoices appearing first.
1615
   */
1616
  public static InvoiceCollection list(Map<String, Object> params, RequestOptions options)
1617
      throws StripeException {
1618
    String path = "/v1/invoices";
1✔
1619
    ApiRequest request =
1✔
1620
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
1621
    return getGlobalResponseGetter().request(request, InvoiceCollection.class);
1✔
1622
  }
1623

1624
  /**
1625
   * You can list all invoices, or list the invoices for a specific customer. The invoices are
1626
   * returned sorted by creation date, with the most recently created invoices appearing first.
1627
   */
1628
  public static InvoiceCollection list(InvoiceListParams params) throws StripeException {
1629
    return list(params, (RequestOptions) null);
1✔
1630
  }
1631

1632
  /**
1633
   * You can list all invoices, or list the invoices for a specific customer. The invoices are
1634
   * returned sorted by creation date, with the most recently created invoices appearing first.
1635
   */
1636
  public static InvoiceCollection list(InvoiceListParams params, RequestOptions options)
1637
      throws StripeException {
1638
    String path = "/v1/invoices";
1✔
1639
    ApiResource.checkNullTypedParams(path, params);
1✔
1640
    ApiRequest request =
1✔
1641
        new ApiRequest(
1642
            BaseAddress.API,
1643
            ApiResource.RequestMethod.GET,
1644
            path,
1645
            ApiRequestParams.paramsToMap(params),
1✔
1646
            options);
1647
    return getGlobalResponseGetter().request(request, InvoiceCollection.class);
1✔
1648
  }
1649

1650
  /**
1651
   * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be
1652
   * written off for accounting purposes.
1653
   */
1654
  public Invoice markUncollectible() throws StripeException {
1655
    return markUncollectible((Map<String, Object>) null, (RequestOptions) null);
1✔
1656
  }
1657

1658
  /**
1659
   * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be
1660
   * written off for accounting purposes.
1661
   */
1662
  public Invoice markUncollectible(RequestOptions options) throws StripeException {
1663
    return markUncollectible((Map<String, Object>) null, options);
×
1664
  }
1665

1666
  /**
1667
   * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be
1668
   * written off for accounting purposes.
1669
   */
1670
  public Invoice markUncollectible(Map<String, Object> params) throws StripeException {
1671
    return markUncollectible(params, (RequestOptions) null);
×
1672
  }
1673

1674
  /**
1675
   * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be
1676
   * written off for accounting purposes.
1677
   */
1678
  public Invoice markUncollectible(Map<String, Object> params, RequestOptions options)
1679
      throws StripeException {
1680
    String path =
1✔
1681
        String.format("/v1/invoices/%s/mark_uncollectible", ApiResource.urlEncodeId(this.getId()));
1✔
1682
    ApiRequest request =
1✔
1683
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
1684
    return getResponseGetter().request(request, Invoice.class);
1✔
1685
  }
1686

1687
  /**
1688
   * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be
1689
   * written off for accounting purposes.
1690
   */
1691
  public Invoice markUncollectible(InvoiceMarkUncollectibleParams params) throws StripeException {
1692
    return markUncollectible(params, (RequestOptions) null);
1✔
1693
  }
1694

1695
  /**
1696
   * Marking an invoice as uncollectible is useful for keeping track of bad debts that can be
1697
   * written off for accounting purposes.
1698
   */
1699
  public Invoice markUncollectible(InvoiceMarkUncollectibleParams params, RequestOptions options)
1700
      throws StripeException {
1701
    String path =
1✔
1702
        String.format("/v1/invoices/%s/mark_uncollectible", ApiResource.urlEncodeId(this.getId()));
1✔
1703
    ApiResource.checkNullTypedParams(path, params);
1✔
1704
    ApiRequest request =
1✔
1705
        new ApiRequest(
1706
            BaseAddress.API,
1707
            ApiResource.RequestMethod.POST,
1708
            path,
1709
            ApiRequestParams.paramsToMap(params),
1✔
1710
            options);
1711
    return getResponseGetter().request(request, Invoice.class);
1✔
1712
  }
1713

1714
  /**
1715
   * Stripe automatically creates and then attempts to collect payment on invoices for customers on
1716
   * subscriptions according to your <a
1717
   * href="https://dashboard.stripe.com/account/billing/automatic">subscriptions settings</a>.
1718
   * However, if you’d like to attempt payment on an invoice out of the normal collection schedule
1719
   * or for some other reason, you can do so.
1720
   */
1721
  public Invoice pay() throws StripeException {
1722
    return pay((Map<String, Object>) null, (RequestOptions) null);
1✔
1723
  }
1724

1725
  /**
1726
   * Stripe automatically creates and then attempts to collect payment on invoices for customers on
1727
   * subscriptions according to your <a
1728
   * href="https://dashboard.stripe.com/account/billing/automatic">subscriptions settings</a>.
1729
   * However, if you’d like to attempt payment on an invoice out of the normal collection schedule
1730
   * or for some other reason, you can do so.
1731
   */
1732
  public Invoice pay(RequestOptions options) throws StripeException {
1733
    return pay((Map<String, Object>) null, options);
×
1734
  }
1735

1736
  /**
1737
   * Stripe automatically creates and then attempts to collect payment on invoices for customers on
1738
   * subscriptions according to your <a
1739
   * href="https://dashboard.stripe.com/account/billing/automatic">subscriptions settings</a>.
1740
   * However, if you’d like to attempt payment on an invoice out of the normal collection schedule
1741
   * or for some other reason, you can do so.
1742
   */
1743
  public Invoice pay(Map<String, Object> params) throws StripeException {
1744
    return pay(params, (RequestOptions) null);
×
1745
  }
1746

1747
  /**
1748
   * Stripe automatically creates and then attempts to collect payment on invoices for customers on
1749
   * subscriptions according to your <a
1750
   * href="https://dashboard.stripe.com/account/billing/automatic">subscriptions settings</a>.
1751
   * However, if you’d like to attempt payment on an invoice out of the normal collection schedule
1752
   * or for some other reason, you can do so.
1753
   */
1754
  public Invoice pay(Map<String, Object> params, RequestOptions options) throws StripeException {
1755
    String path = String.format("/v1/invoices/%s/pay", ApiResource.urlEncodeId(this.getId()));
1✔
1756
    ApiRequest request =
1✔
1757
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
1758
    return getResponseGetter().request(request, Invoice.class);
1✔
1759
  }
1760

1761
  /**
1762
   * Stripe automatically creates and then attempts to collect payment on invoices for customers on
1763
   * subscriptions according to your <a
1764
   * href="https://dashboard.stripe.com/account/billing/automatic">subscriptions settings</a>.
1765
   * However, if you’d like to attempt payment on an invoice out of the normal collection schedule
1766
   * or for some other reason, you can do so.
1767
   */
1768
  public Invoice pay(InvoicePayParams params) throws StripeException {
1769
    return pay(params, (RequestOptions) null);
1✔
1770
  }
1771

1772
  /**
1773
   * Stripe automatically creates and then attempts to collect payment on invoices for customers on
1774
   * subscriptions according to your <a
1775
   * href="https://dashboard.stripe.com/account/billing/automatic">subscriptions settings</a>.
1776
   * However, if you’d like to attempt payment on an invoice out of the normal collection schedule
1777
   * or for some other reason, you can do so.
1778
   */
1779
  public Invoice pay(InvoicePayParams params, RequestOptions options) throws StripeException {
1780
    String path = String.format("/v1/invoices/%s/pay", ApiResource.urlEncodeId(this.getId()));
1✔
1781
    ApiResource.checkNullTypedParams(path, params);
1✔
1782
    ApiRequest request =
1✔
1783
        new ApiRequest(
1784
            BaseAddress.API,
1785
            ApiResource.RequestMethod.POST,
1786
            path,
1787
            ApiRequestParams.paramsToMap(params),
1✔
1788
            options);
1789
    return getResponseGetter().request(request, Invoice.class);
1✔
1790
  }
1791

1792
  /**
1793
   * Removes multiple line items from an invoice. This is only possible when an invoice is still a
1794
   * draft.
1795
   */
1796
  public Invoice removeLines(Map<String, Object> params) throws StripeException {
1797
    return removeLines(params, (RequestOptions) null);
×
1798
  }
1799

1800
  /**
1801
   * Removes multiple line items from an invoice. This is only possible when an invoice is still a
1802
   * draft.
1803
   */
1804
  public Invoice removeLines(Map<String, Object> params, RequestOptions options)
1805
      throws StripeException {
1806
    String path =
×
1807
        String.format("/v1/invoices/%s/remove_lines", ApiResource.urlEncodeId(this.getId()));
×
1808
    ApiRequest request =
×
1809
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
1810
    return getResponseGetter().request(request, Invoice.class);
×
1811
  }
1812

1813
  /**
1814
   * Removes multiple line items from an invoice. This is only possible when an invoice is still a
1815
   * draft.
1816
   */
1817
  public Invoice removeLines(InvoiceRemoveLinesParams params) throws StripeException {
1818
    return removeLines(params, (RequestOptions) null);
×
1819
  }
1820

1821
  /**
1822
   * Removes multiple line items from an invoice. This is only possible when an invoice is still a
1823
   * draft.
1824
   */
1825
  public Invoice removeLines(InvoiceRemoveLinesParams params, RequestOptions options)
1826
      throws StripeException {
1827
    String path =
×
1828
        String.format("/v1/invoices/%s/remove_lines", ApiResource.urlEncodeId(this.getId()));
×
1829
    ApiResource.checkNullTypedParams(path, params);
×
1830
    ApiRequest request =
×
1831
        new ApiRequest(
1832
            BaseAddress.API,
1833
            ApiResource.RequestMethod.POST,
1834
            path,
1835
            ApiRequestParams.paramsToMap(params),
×
1836
            options);
1837
    return getResponseGetter().request(request, Invoice.class);
×
1838
  }
1839

1840
  /** Retrieves the invoice with the given ID. */
1841
  public static Invoice retrieve(String invoice) throws StripeException {
1842
    return retrieve(invoice, (Map<String, Object>) null, (RequestOptions) null);
1✔
1843
  }
1844

1845
  /** Retrieves the invoice with the given ID. */
1846
  public static Invoice retrieve(String invoice, RequestOptions options) throws StripeException {
1847
    return retrieve(invoice, (Map<String, Object>) null, options);
×
1848
  }
1849

1850
  /** Retrieves the invoice with the given ID. */
1851
  public static Invoice retrieve(String invoice, Map<String, Object> params, RequestOptions options)
1852
      throws StripeException {
1853
    String path = String.format("/v1/invoices/%s", ApiResource.urlEncodeId(invoice));
1✔
1854
    ApiRequest request =
1✔
1855
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
1856
    return getGlobalResponseGetter().request(request, Invoice.class);
1✔
1857
  }
1858

1859
  /** Retrieves the invoice with the given ID. */
1860
  public static Invoice retrieve(
1861
      String invoice, InvoiceRetrieveParams params, RequestOptions options) throws StripeException {
1862
    String path = String.format("/v1/invoices/%s", ApiResource.urlEncodeId(invoice));
1✔
1863
    ApiResource.checkNullTypedParams(path, params);
1✔
1864
    ApiRequest request =
1✔
1865
        new ApiRequest(
1866
            BaseAddress.API,
1867
            ApiResource.RequestMethod.GET,
1868
            path,
1869
            ApiRequestParams.paramsToMap(params),
1✔
1870
            options);
1871
    return getGlobalResponseGetter().request(request, Invoice.class);
1✔
1872
  }
1873

1874
  /**
1875
   * Search for invoices you’ve previously created using Stripe’s <a
1876
   * href="https://stripe.com/docs/search#search-query-language">Search Query Language</a>. Don’t
1877
   * use search in read-after-write flows where strict consistency is necessary. Under normal
1878
   * operating conditions, data is searchable in less than a minute. Occasionally, propagation of
1879
   * new or updated data can be up to an hour behind during outages. Search functionality is not
1880
   * available to merchants in India.
1881
   */
1882
  public static InvoiceSearchResult search(Map<String, Object> params) throws StripeException {
1883
    return search(params, (RequestOptions) null);
×
1884
  }
1885

1886
  /**
1887
   * Search for invoices you’ve previously created using Stripe’s <a
1888
   * href="https://stripe.com/docs/search#search-query-language">Search Query Language</a>. Don’t
1889
   * use search in read-after-write flows where strict consistency is necessary. Under normal
1890
   * operating conditions, data is searchable in less than a minute. Occasionally, propagation of
1891
   * new or updated data can be up to an hour behind during outages. Search functionality is not
1892
   * available to merchants in India.
1893
   */
1894
  public static InvoiceSearchResult search(Map<String, Object> params, RequestOptions options)
1895
      throws StripeException {
1896
    String path = "/v1/invoices/search";
×
1897
    ApiRequest request =
×
1898
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
1899
    return getGlobalResponseGetter().request(request, InvoiceSearchResult.class);
×
1900
  }
1901

1902
  /**
1903
   * Search for invoices you’ve previously created using Stripe’s <a
1904
   * href="https://stripe.com/docs/search#search-query-language">Search Query Language</a>. Don’t
1905
   * use search in read-after-write flows where strict consistency is necessary. Under normal
1906
   * operating conditions, data is searchable in less than a minute. Occasionally, propagation of
1907
   * new or updated data can be up to an hour behind during outages. Search functionality is not
1908
   * available to merchants in India.
1909
   */
1910
  public static InvoiceSearchResult search(InvoiceSearchParams params) throws StripeException {
1911
    return search(params, (RequestOptions) null);
1✔
1912
  }
1913

1914
  /**
1915
   * Search for invoices you’ve previously created using Stripe’s <a
1916
   * href="https://stripe.com/docs/search#search-query-language">Search Query Language</a>. Don’t
1917
   * use search in read-after-write flows where strict consistency is necessary. Under normal
1918
   * operating conditions, data is searchable in less than a minute. Occasionally, propagation of
1919
   * new or updated data can be up to an hour behind during outages. Search functionality is not
1920
   * available to merchants in India.
1921
   */
1922
  public static InvoiceSearchResult search(InvoiceSearchParams params, RequestOptions options)
1923
      throws StripeException {
1924
    String path = "/v1/invoices/search";
1✔
1925
    ApiResource.checkNullTypedParams(path, params);
1✔
1926
    ApiRequest request =
1✔
1927
        new ApiRequest(
1928
            BaseAddress.API,
1929
            ApiResource.RequestMethod.GET,
1930
            path,
1931
            ApiRequestParams.paramsToMap(params),
1✔
1932
            options);
1933
    return getGlobalResponseGetter().request(request, InvoiceSearchResult.class);
1✔
1934
  }
1935

1936
  /**
1937
   * Stripe will automatically send invoices to customers according to your <a
1938
   * href="https://dashboard.stripe.com/account/billing/automatic">subscriptions settings</a>.
1939
   * However, if you’d like to manually send an invoice to your customer out of the normal schedule,
1940
   * you can do so. When sending invoices that have already been paid, there will be no reference to
1941
   * the payment in the email.
1942
   *
1943
   * <p>Requests made in test-mode result in no emails being sent, despite sending an {@code
1944
   * invoice.sent} event.
1945
   */
1946
  public Invoice sendInvoice() throws StripeException {
1947
    return sendInvoice((Map<String, Object>) null, (RequestOptions) null);
1✔
1948
  }
1949

1950
  /**
1951
   * Stripe will automatically send invoices to customers according to your <a
1952
   * href="https://dashboard.stripe.com/account/billing/automatic">subscriptions settings</a>.
1953
   * However, if you’d like to manually send an invoice to your customer out of the normal schedule,
1954
   * you can do so. When sending invoices that have already been paid, there will be no reference to
1955
   * the payment in the email.
1956
   *
1957
   * <p>Requests made in test-mode result in no emails being sent, despite sending an {@code
1958
   * invoice.sent} event.
1959
   */
1960
  public Invoice sendInvoice(RequestOptions options) throws StripeException {
1961
    return sendInvoice((Map<String, Object>) null, options);
×
1962
  }
1963

1964
  /**
1965
   * Stripe will automatically send invoices to customers according to your <a
1966
   * href="https://dashboard.stripe.com/account/billing/automatic">subscriptions settings</a>.
1967
   * However, if you’d like to manually send an invoice to your customer out of the normal schedule,
1968
   * you can do so. When sending invoices that have already been paid, there will be no reference to
1969
   * the payment in the email.
1970
   *
1971
   * <p>Requests made in test-mode result in no emails being sent, despite sending an {@code
1972
   * invoice.sent} event.
1973
   */
1974
  public Invoice sendInvoice(Map<String, Object> params) throws StripeException {
1975
    return sendInvoice(params, (RequestOptions) null);
×
1976
  }
1977

1978
  /**
1979
   * Stripe will automatically send invoices to customers according to your <a
1980
   * href="https://dashboard.stripe.com/account/billing/automatic">subscriptions settings</a>.
1981
   * However, if you’d like to manually send an invoice to your customer out of the normal schedule,
1982
   * you can do so. When sending invoices that have already been paid, there will be no reference to
1983
   * the payment in the email.
1984
   *
1985
   * <p>Requests made in test-mode result in no emails being sent, despite sending an {@code
1986
   * invoice.sent} event.
1987
   */
1988
  public Invoice sendInvoice(Map<String, Object> params, RequestOptions options)
1989
      throws StripeException {
1990
    String path = String.format("/v1/invoices/%s/send", ApiResource.urlEncodeId(this.getId()));
1✔
1991
    ApiRequest request =
1✔
1992
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
1993
    return getResponseGetter().request(request, Invoice.class);
1✔
1994
  }
1995

1996
  /**
1997
   * Stripe will automatically send invoices to customers according to your <a
1998
   * href="https://dashboard.stripe.com/account/billing/automatic">subscriptions settings</a>.
1999
   * However, if you’d like to manually send an invoice to your customer out of the normal schedule,
2000
   * you can do so. When sending invoices that have already been paid, there will be no reference to
2001
   * the payment in the email.
2002
   *
2003
   * <p>Requests made in test-mode result in no emails being sent, despite sending an {@code
2004
   * invoice.sent} event.
2005
   */
2006
  public Invoice sendInvoice(InvoiceSendInvoiceParams params) throws StripeException {
2007
    return sendInvoice(params, (RequestOptions) null);
1✔
2008
  }
2009

2010
  /**
2011
   * Stripe will automatically send invoices to customers according to your <a
2012
   * href="https://dashboard.stripe.com/account/billing/automatic">subscriptions settings</a>.
2013
   * However, if you’d like to manually send an invoice to your customer out of the normal schedule,
2014
   * you can do so. When sending invoices that have already been paid, there will be no reference to
2015
   * the payment in the email.
2016
   *
2017
   * <p>Requests made in test-mode result in no emails being sent, despite sending an {@code
2018
   * invoice.sent} event.
2019
   */
2020
  public Invoice sendInvoice(InvoiceSendInvoiceParams params, RequestOptions options)
2021
      throws StripeException {
2022
    String path = String.format("/v1/invoices/%s/send", ApiResource.urlEncodeId(this.getId()));
1✔
2023
    ApiResource.checkNullTypedParams(path, params);
1✔
2024
    ApiRequest request =
1✔
2025
        new ApiRequest(
2026
            BaseAddress.API,
2027
            ApiResource.RequestMethod.POST,
2028
            path,
2029
            ApiRequestParams.paramsToMap(params),
1✔
2030
            options);
2031
    return getResponseGetter().request(request, Invoice.class);
1✔
2032
  }
2033

2034
  /**
2035
   * At any time, you can preview the upcoming invoice for a customer. This will show you all the
2036
   * charges that are pending, including subscription renewal charges, invoice item charges, etc. It
2037
   * will also show you any discounts that are applicable to the invoice.
2038
   *
2039
   * <p>Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the
2040
   * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice
2041
   * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the
2042
   * amount that your customer will be billed, you can add, remove, or update pending invoice items,
2043
   * or update the customer’s discount.
2044
   *
2045
   * <p>You can preview the effects of updating a subscription, including a preview of what
2046
   * proration will take place. To ensure that the actual proration is calculated exactly the same
2047
   * as the previewed proration, you should pass the {@code subscription_details.proration_date}
2048
   * parameter when doing the actual subscription update. The recommended way to get only the
2049
   * prorations being previewed is to consider only proration line items where {@code period[start]}
2050
   * is equal to the {@code subscription_details.proration_date} value passed in the request.
2051
   *
2052
   * <p>Note: Currency conversion calculations use the latest exchange rates. Exchange rates may
2053
   * vary between the time of the preview and the time of the actual invoice creation. <a
2054
   * href="https://docs.stripe.com/currencies/conversions">Learn more</a>
2055
   */
2056
  public static Invoice upcoming() throws StripeException {
2057
    return upcoming((Map<String, Object>) null, (RequestOptions) null);
×
2058
  }
2059

2060
  /**
2061
   * At any time, you can preview the upcoming invoice for a customer. This will show you all the
2062
   * charges that are pending, including subscription renewal charges, invoice item charges, etc. It
2063
   * will also show you any discounts that are applicable to the invoice.
2064
   *
2065
   * <p>Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the
2066
   * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice
2067
   * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the
2068
   * amount that your customer will be billed, you can add, remove, or update pending invoice items,
2069
   * or update the customer’s discount.
2070
   *
2071
   * <p>You can preview the effects of updating a subscription, including a preview of what
2072
   * proration will take place. To ensure that the actual proration is calculated exactly the same
2073
   * as the previewed proration, you should pass the {@code subscription_details.proration_date}
2074
   * parameter when doing the actual subscription update. The recommended way to get only the
2075
   * prorations being previewed is to consider only proration line items where {@code period[start]}
2076
   * is equal to the {@code subscription_details.proration_date} value passed in the request.
2077
   *
2078
   * <p>Note: Currency conversion calculations use the latest exchange rates. Exchange rates may
2079
   * vary between the time of the preview and the time of the actual invoice creation. <a
2080
   * href="https://docs.stripe.com/currencies/conversions">Learn more</a>
2081
   */
2082
  public static Invoice upcoming(Map<String, Object> params) throws StripeException {
2083
    return upcoming(params, (RequestOptions) null);
1✔
2084
  }
2085

2086
  /**
2087
   * At any time, you can preview the upcoming invoice for a customer. This will show you all the
2088
   * charges that are pending, including subscription renewal charges, invoice item charges, etc. It
2089
   * will also show you any discounts that are applicable to the invoice.
2090
   *
2091
   * <p>Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the
2092
   * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice
2093
   * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the
2094
   * amount that your customer will be billed, you can add, remove, or update pending invoice items,
2095
   * or update the customer’s discount.
2096
   *
2097
   * <p>You can preview the effects of updating a subscription, including a preview of what
2098
   * proration will take place. To ensure that the actual proration is calculated exactly the same
2099
   * as the previewed proration, you should pass the {@code subscription_details.proration_date}
2100
   * parameter when doing the actual subscription update. The recommended way to get only the
2101
   * prorations being previewed is to consider only proration line items where {@code period[start]}
2102
   * is equal to the {@code subscription_details.proration_date} value passed in the request.
2103
   *
2104
   * <p>Note: Currency conversion calculations use the latest exchange rates. Exchange rates may
2105
   * vary between the time of the preview and the time of the actual invoice creation. <a
2106
   * href="https://docs.stripe.com/currencies/conversions">Learn more</a>
2107
   */
2108
  public static Invoice upcoming(Map<String, Object> params, RequestOptions options)
2109
      throws StripeException {
2110
    String path = "/v1/invoices/upcoming";
1✔
2111
    ApiRequest request =
1✔
2112
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
2113
    return getGlobalResponseGetter().request(request, Invoice.class);
1✔
2114
  }
2115

2116
  /**
2117
   * At any time, you can preview the upcoming invoice for a customer. This will show you all the
2118
   * charges that are pending, including subscription renewal charges, invoice item charges, etc. It
2119
   * will also show you any discounts that are applicable to the invoice.
2120
   *
2121
   * <p>Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the
2122
   * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice
2123
   * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the
2124
   * amount that your customer will be billed, you can add, remove, or update pending invoice items,
2125
   * or update the customer’s discount.
2126
   *
2127
   * <p>You can preview the effects of updating a subscription, including a preview of what
2128
   * proration will take place. To ensure that the actual proration is calculated exactly the same
2129
   * as the previewed proration, you should pass the {@code subscription_details.proration_date}
2130
   * parameter when doing the actual subscription update. The recommended way to get only the
2131
   * prorations being previewed is to consider only proration line items where {@code period[start]}
2132
   * is equal to the {@code subscription_details.proration_date} value passed in the request.
2133
   *
2134
   * <p>Note: Currency conversion calculations use the latest exchange rates. Exchange rates may
2135
   * vary between the time of the preview and the time of the actual invoice creation. <a
2136
   * href="https://docs.stripe.com/currencies/conversions">Learn more</a>
2137
   */
2138
  public static Invoice upcoming(InvoiceUpcomingParams params) throws StripeException {
2139
    return upcoming(params, (RequestOptions) null);
1✔
2140
  }
2141

2142
  /**
2143
   * At any time, you can preview the upcoming invoice for a customer. This will show you all the
2144
   * charges that are pending, including subscription renewal charges, invoice item charges, etc. It
2145
   * will also show you any discounts that are applicable to the invoice.
2146
   *
2147
   * <p>Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the
2148
   * invoice has not yet been created. As such, the upcoming invoice will not show up in invoice
2149
   * listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the
2150
   * amount that your customer will be billed, you can add, remove, or update pending invoice items,
2151
   * or update the customer’s discount.
2152
   *
2153
   * <p>You can preview the effects of updating a subscription, including a preview of what
2154
   * proration will take place. To ensure that the actual proration is calculated exactly the same
2155
   * as the previewed proration, you should pass the {@code subscription_details.proration_date}
2156
   * parameter when doing the actual subscription update. The recommended way to get only the
2157
   * prorations being previewed is to consider only proration line items where {@code period[start]}
2158
   * is equal to the {@code subscription_details.proration_date} value passed in the request.
2159
   *
2160
   * <p>Note: Currency conversion calculations use the latest exchange rates. Exchange rates may
2161
   * vary between the time of the preview and the time of the actual invoice creation. <a
2162
   * href="https://docs.stripe.com/currencies/conversions">Learn more</a>
2163
   */
2164
  public static Invoice upcoming(InvoiceUpcomingParams params, RequestOptions options)
2165
      throws StripeException {
2166
    String path = "/v1/invoices/upcoming";
1✔
2167
    ApiResource.checkNullTypedParams(path, params);
1✔
2168
    ApiRequest request =
1✔
2169
        new ApiRequest(
2170
            BaseAddress.API,
2171
            ApiResource.RequestMethod.GET,
2172
            path,
2173
            ApiRequestParams.paramsToMap(params),
1✔
2174
            options);
2175
    return getGlobalResponseGetter().request(request, Invoice.class);
1✔
2176
  }
2177

2178
  /**
2179
   * When retrieving an upcoming invoice, you’ll get a <strong>lines</strong> property containing
2180
   * the total count of line items and the first handful of those items. There is also a URL where
2181
   * you can retrieve the full (paginated) list of line items.
2182
   */
2183
  public static InvoiceLineItemCollection upcomingLines() throws StripeException {
2184
    return upcomingLines((Map<String, Object>) null, (RequestOptions) null);
×
2185
  }
2186

2187
  /**
2188
   * When retrieving an upcoming invoice, you’ll get a <strong>lines</strong> property containing
2189
   * the total count of line items and the first handful of those items. There is also a URL where
2190
   * you can retrieve the full (paginated) list of line items.
2191
   */
2192
  public static InvoiceLineItemCollection upcomingLines(Map<String, Object> params)
2193
      throws StripeException {
2194
    return upcomingLines(params, (RequestOptions) null);
×
2195
  }
2196

2197
  /**
2198
   * When retrieving an upcoming invoice, you’ll get a <strong>lines</strong> property containing
2199
   * the total count of line items and the first handful of those items. There is also a URL where
2200
   * you can retrieve the full (paginated) list of line items.
2201
   */
2202
  public static InvoiceLineItemCollection upcomingLines(
2203
      Map<String, Object> params, RequestOptions options) throws StripeException {
2204
    String path = "/v1/invoices/upcoming/lines";
×
2205
    ApiRequest request =
×
2206
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
2207
    return getGlobalResponseGetter().request(request, InvoiceLineItemCollection.class);
×
2208
  }
2209

2210
  /**
2211
   * When retrieving an upcoming invoice, you’ll get a <strong>lines</strong> property containing
2212
   * the total count of line items and the first handful of those items. There is also a URL where
2213
   * you can retrieve the full (paginated) list of line items.
2214
   */
2215
  public static InvoiceLineItemCollection upcomingLines(InvoiceUpcomingLinesParams params)
2216
      throws StripeException {
2217
    return upcomingLines(params, (RequestOptions) null);
×
2218
  }
2219

2220
  /**
2221
   * When retrieving an upcoming invoice, you’ll get a <strong>lines</strong> property containing
2222
   * the total count of line items and the first handful of those items. There is also a URL where
2223
   * you can retrieve the full (paginated) list of line items.
2224
   */
2225
  public static InvoiceLineItemCollection upcomingLines(
2226
      InvoiceUpcomingLinesParams params, RequestOptions options) throws StripeException {
2227
    String path = "/v1/invoices/upcoming/lines";
×
2228
    ApiResource.checkNullTypedParams(path, params);
×
2229
    ApiRequest request =
×
2230
        new ApiRequest(
2231
            BaseAddress.API,
2232
            ApiResource.RequestMethod.GET,
2233
            path,
2234
            ApiRequestParams.paramsToMap(params),
×
2235
            options);
2236
    return getGlobalResponseGetter().request(request, InvoiceLineItemCollection.class);
×
2237
  }
2238

2239
  /**
2240
   * Draft invoices are fully editable. Once an invoice is <a
2241
   * href="https://stripe.com/docs/billing/invoices/workflow#finalized">finalized</a>, monetary
2242
   * values, as well as {@code collection_method}, become uneditable.
2243
   *
2244
   * <p>If you would like to stop the Stripe Billing engine from automatically finalizing,
2245
   * reattempting payments on, sending reminders for, or <a
2246
   * href="https://stripe.com/docs/billing/invoices/reconciliation">automatically reconciling</a>
2247
   * invoices, pass {@code auto_advance=false}.
2248
   */
2249
  @Override
2250
  public Invoice update(Map<String, Object> params) throws StripeException {
2251
    return update(params, (RequestOptions) null);
1✔
2252
  }
2253

2254
  /**
2255
   * Draft invoices are fully editable. Once an invoice is <a
2256
   * href="https://stripe.com/docs/billing/invoices/workflow#finalized">finalized</a>, monetary
2257
   * values, as well as {@code collection_method}, become uneditable.
2258
   *
2259
   * <p>If you would like to stop the Stripe Billing engine from automatically finalizing,
2260
   * reattempting payments on, sending reminders for, or <a
2261
   * href="https://stripe.com/docs/billing/invoices/reconciliation">automatically reconciling</a>
2262
   * invoices, pass {@code auto_advance=false}.
2263
   */
2264
  @Override
2265
  public Invoice update(Map<String, Object> params, RequestOptions options) throws StripeException {
2266
    String path = String.format("/v1/invoices/%s", ApiResource.urlEncodeId(this.getId()));
1✔
2267
    ApiRequest request =
1✔
2268
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
2269
    return getResponseGetter().request(request, Invoice.class);
1✔
2270
  }
2271

2272
  /**
2273
   * Draft invoices are fully editable. Once an invoice is <a
2274
   * href="https://stripe.com/docs/billing/invoices/workflow#finalized">finalized</a>, monetary
2275
   * values, as well as {@code collection_method}, become uneditable.
2276
   *
2277
   * <p>If you would like to stop the Stripe Billing engine from automatically finalizing,
2278
   * reattempting payments on, sending reminders for, or <a
2279
   * href="https://stripe.com/docs/billing/invoices/reconciliation">automatically reconciling</a>
2280
   * invoices, pass {@code auto_advance=false}.
2281
   */
2282
  public Invoice update(InvoiceUpdateParams params) throws StripeException {
2283
    return update(params, (RequestOptions) null);
1✔
2284
  }
2285

2286
  /**
2287
   * Draft invoices are fully editable. Once an invoice is <a
2288
   * href="https://stripe.com/docs/billing/invoices/workflow#finalized">finalized</a>, monetary
2289
   * values, as well as {@code collection_method}, become uneditable.
2290
   *
2291
   * <p>If you would like to stop the Stripe Billing engine from automatically finalizing,
2292
   * reattempting payments on, sending reminders for, or <a
2293
   * href="https://stripe.com/docs/billing/invoices/reconciliation">automatically reconciling</a>
2294
   * invoices, pass {@code auto_advance=false}.
2295
   */
2296
  public Invoice update(InvoiceUpdateParams params, RequestOptions options) throws StripeException {
2297
    String path = String.format("/v1/invoices/%s", ApiResource.urlEncodeId(this.getId()));
1✔
2298
    ApiResource.checkNullTypedParams(path, params);
1✔
2299
    ApiRequest request =
1✔
2300
        new ApiRequest(
2301
            BaseAddress.API,
2302
            ApiResource.RequestMethod.POST,
2303
            path,
2304
            ApiRequestParams.paramsToMap(params),
1✔
2305
            options);
2306
    return getResponseGetter().request(request, Invoice.class);
1✔
2307
  }
2308

2309
  /**
2310
   * Updates multiple line items on an invoice. This is only possible when an invoice is still a
2311
   * draft.
2312
   */
2313
  public Invoice updateLines(Map<String, Object> params) throws StripeException {
2314
    return updateLines(params, (RequestOptions) null);
×
2315
  }
2316

2317
  /**
2318
   * Updates multiple line items on an invoice. This is only possible when an invoice is still a
2319
   * draft.
2320
   */
2321
  public Invoice updateLines(Map<String, Object> params, RequestOptions options)
2322
      throws StripeException {
2323
    String path =
×
2324
        String.format("/v1/invoices/%s/update_lines", ApiResource.urlEncodeId(this.getId()));
×
2325
    ApiRequest request =
×
2326
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
2327
    return getResponseGetter().request(request, Invoice.class);
×
2328
  }
2329

2330
  /**
2331
   * Updates multiple line items on an invoice. This is only possible when an invoice is still a
2332
   * draft.
2333
   */
2334
  public Invoice updateLines(InvoiceUpdateLinesParams params) throws StripeException {
2335
    return updateLines(params, (RequestOptions) null);
×
2336
  }
2337

2338
  /**
2339
   * Updates multiple line items on an invoice. This is only possible when an invoice is still a
2340
   * draft.
2341
   */
2342
  public Invoice updateLines(InvoiceUpdateLinesParams params, RequestOptions options)
2343
      throws StripeException {
2344
    String path =
×
2345
        String.format("/v1/invoices/%s/update_lines", ApiResource.urlEncodeId(this.getId()));
×
2346
    ApiResource.checkNullTypedParams(path, params);
×
2347
    ApiRequest request =
×
2348
        new ApiRequest(
2349
            BaseAddress.API,
2350
            ApiResource.RequestMethod.POST,
2351
            path,
2352
            ApiRequestParams.paramsToMap(params),
×
2353
            options);
2354
    return getResponseGetter().request(request, Invoice.class);
×
2355
  }
2356

2357
  /**
2358
   * Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to <a
2359
   * href="https://stripe.com/docs/api#delete_invoice">deletion</a>, however it only applies to
2360
   * finalized invoices and maintains a papertrail where the invoice can still be found.
2361
   *
2362
   * <p>Consult with local regulations to determine whether and how an invoice might be amended,
2363
   * canceled, or voided in the jurisdiction you’re doing business in. You might need to <a
2364
   * href="https://stripe.com/docs/api#create_invoice">issue another invoice</a> or <a
2365
   * href="https://stripe.com/docs/api#create_credit_note">credit note</a> instead. Stripe
2366
   * recommends that you consult with your legal counsel for advice specific to your business.
2367
   */
2368
  public Invoice voidInvoice() throws StripeException {
2369
    return voidInvoice((Map<String, Object>) null, (RequestOptions) null);
1✔
2370
  }
2371

2372
  /**
2373
   * Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to <a
2374
   * href="https://stripe.com/docs/api#delete_invoice">deletion</a>, however it only applies to
2375
   * finalized invoices and maintains a papertrail where the invoice can still be found.
2376
   *
2377
   * <p>Consult with local regulations to determine whether and how an invoice might be amended,
2378
   * canceled, or voided in the jurisdiction you’re doing business in. You might need to <a
2379
   * href="https://stripe.com/docs/api#create_invoice">issue another invoice</a> or <a
2380
   * href="https://stripe.com/docs/api#create_credit_note">credit note</a> instead. Stripe
2381
   * recommends that you consult with your legal counsel for advice specific to your business.
2382
   */
2383
  public Invoice voidInvoice(RequestOptions options) throws StripeException {
2384
    return voidInvoice((Map<String, Object>) null, options);
×
2385
  }
2386

2387
  /**
2388
   * Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to <a
2389
   * href="https://stripe.com/docs/api#delete_invoice">deletion</a>, however it only applies to
2390
   * finalized invoices and maintains a papertrail where the invoice can still be found.
2391
   *
2392
   * <p>Consult with local regulations to determine whether and how an invoice might be amended,
2393
   * canceled, or voided in the jurisdiction you’re doing business in. You might need to <a
2394
   * href="https://stripe.com/docs/api#create_invoice">issue another invoice</a> or <a
2395
   * href="https://stripe.com/docs/api#create_credit_note">credit note</a> instead. Stripe
2396
   * recommends that you consult with your legal counsel for advice specific to your business.
2397
   */
2398
  public Invoice voidInvoice(Map<String, Object> params) throws StripeException {
2399
    return voidInvoice(params, (RequestOptions) null);
×
2400
  }
2401

2402
  /**
2403
   * Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to <a
2404
   * href="https://stripe.com/docs/api#delete_invoice">deletion</a>, however it only applies to
2405
   * finalized invoices and maintains a papertrail where the invoice can still be found.
2406
   *
2407
   * <p>Consult with local regulations to determine whether and how an invoice might be amended,
2408
   * canceled, or voided in the jurisdiction you’re doing business in. You might need to <a
2409
   * href="https://stripe.com/docs/api#create_invoice">issue another invoice</a> or <a
2410
   * href="https://stripe.com/docs/api#create_credit_note">credit note</a> instead. Stripe
2411
   * recommends that you consult with your legal counsel for advice specific to your business.
2412
   */
2413
  public Invoice voidInvoice(Map<String, Object> params, RequestOptions options)
2414
      throws StripeException {
2415
    String path = String.format("/v1/invoices/%s/void", ApiResource.urlEncodeId(this.getId()));
1✔
2416
    ApiRequest request =
1✔
2417
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
2418
    return getResponseGetter().request(request, Invoice.class);
1✔
2419
  }
2420

2421
  /**
2422
   * Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to <a
2423
   * href="https://stripe.com/docs/api#delete_invoice">deletion</a>, however it only applies to
2424
   * finalized invoices and maintains a papertrail where the invoice can still be found.
2425
   *
2426
   * <p>Consult with local regulations to determine whether and how an invoice might be amended,
2427
   * canceled, or voided in the jurisdiction you’re doing business in. You might need to <a
2428
   * href="https://stripe.com/docs/api#create_invoice">issue another invoice</a> or <a
2429
   * href="https://stripe.com/docs/api#create_credit_note">credit note</a> instead. Stripe
2430
   * recommends that you consult with your legal counsel for advice specific to your business.
2431
   */
2432
  public Invoice voidInvoice(InvoiceVoidInvoiceParams params) throws StripeException {
2433
    return voidInvoice(params, (RequestOptions) null);
1✔
2434
  }
2435

2436
  /**
2437
   * Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to <a
2438
   * href="https://stripe.com/docs/api#delete_invoice">deletion</a>, however it only applies to
2439
   * finalized invoices and maintains a papertrail where the invoice can still be found.
2440
   *
2441
   * <p>Consult with local regulations to determine whether and how an invoice might be amended,
2442
   * canceled, or voided in the jurisdiction you’re doing business in. You might need to <a
2443
   * href="https://stripe.com/docs/api#create_invoice">issue another invoice</a> or <a
2444
   * href="https://stripe.com/docs/api#create_credit_note">credit note</a> instead. Stripe
2445
   * recommends that you consult with your legal counsel for advice specific to your business.
2446
   */
2447
  public Invoice voidInvoice(InvoiceVoidInvoiceParams params, RequestOptions options)
2448
      throws StripeException {
2449
    String path = String.format("/v1/invoices/%s/void", ApiResource.urlEncodeId(this.getId()));
1✔
2450
    ApiResource.checkNullTypedParams(path, params);
1✔
2451
    ApiRequest request =
1✔
2452
        new ApiRequest(
2453
            BaseAddress.API,
2454
            ApiResource.RequestMethod.POST,
2455
            path,
2456
            ApiRequestParams.paramsToMap(params),
1✔
2457
            options);
2458
    return getResponseGetter().request(request, Invoice.class);
1✔
2459
  }
2460

2461
  /**
2462
   * For more details about AmountsDue, please refer to the <a
2463
   * href="https://docs.stripe.com/api">API Reference.</a>
2464
   */
2465
  @Getter
2466
  @Setter
2467
  @EqualsAndHashCode(callSuper = false)
2468
  public static class AmountsDue extends StripeObject {
×
2469
    /** Incremental amount due for this payment in cents (or local equivalent). */
2470
    @SerializedName("amount")
2471
    Long amount;
2472

2473
    /** The amount in cents (or local equivalent) that was paid for this payment. */
2474
    @SerializedName("amount_paid")
2475
    Long amountPaid;
2476

2477
    /**
2478
     * The difference between the payment’s amount and amount_paid, in cents (or local equivalent).
2479
     */
2480
    @SerializedName("amount_remaining")
2481
    Long amountRemaining;
2482

2483
    /** Number of days from when invoice is finalized until the payment is due. */
2484
    @SerializedName("days_until_due")
2485
    Long daysUntilDue;
2486

2487
    /** An arbitrary string attached to the object. Often useful for displaying to users. */
2488
    @SerializedName("description")
2489
    String description;
2490

2491
    /** Date on which a payment plan’s payment is due. */
2492
    @SerializedName("due_date")
2493
    Long dueDate;
2494

2495
    /** Timestamp when the payment was paid. */
2496
    @SerializedName("paid_at")
2497
    Long paidAt;
2498

2499
    /** The status of the payment, one of {@code open}, {@code paid}, or {@code past_due}. */
2500
    @SerializedName("status")
2501
    String status;
2502
  }
2503

2504
  /**
2505
   * For more details about AutomaticTax, please refer to the <a
2506
   * href="https://docs.stripe.com/api">API Reference.</a>
2507
   */
2508
  @Getter
2509
  @Setter
2510
  @EqualsAndHashCode(callSuper = false)
2511
  public static class AutomaticTax extends StripeObject {
1✔
2512
    /**
2513
     * Whether Stripe automatically computes tax on this invoice. Note that incompatible invoice
2514
     * items (invoice items with manually specified <a
2515
     * href="https://stripe.com/docs/api/tax_rates">tax rates</a>, negative amounts, or {@code
2516
     * tax_behavior=unspecified}) cannot be added to automatic tax invoices.
2517
     */
2518
    @SerializedName("enabled")
2519
    Boolean enabled;
2520

2521
    /**
2522
     * The account that's liable for tax. If set, the business address and tax registrations
2523
     * required to perform the tax calculation are loaded from this account. The tax transaction is
2524
     * returned in the report of the connected account.
2525
     */
2526
    @SerializedName("liability")
2527
    Liability liability;
2528

2529
    /**
2530
     * The status of the most recent automated tax calculation for this invoice.
2531
     *
2532
     * <p>One of {@code complete}, {@code failed}, or {@code requires_location_inputs}.
2533
     */
2534
    @SerializedName("status")
2535
    String status;
2536

2537
    /**
2538
     * For more details about Liability, please refer to the <a
2539
     * href="https://docs.stripe.com/api">API Reference.</a>
2540
     */
2541
    @Getter
2542
    @Setter
2543
    @EqualsAndHashCode(callSuper = false)
2544
    public static class Liability extends StripeObject {
×
2545
      /** The connected account being referenced when {@code type} is {@code account}. */
2546
      @SerializedName("account")
2547
      @Getter(lombok.AccessLevel.NONE)
2548
      @Setter(lombok.AccessLevel.NONE)
2549
      ExpandableField<Account> account;
2550

2551
      /**
2552
       * Type of the account referenced.
2553
       *
2554
       * <p>One of {@code account}, or {@code self}.
2555
       */
2556
      @SerializedName("type")
2557
      String type;
2558

2559
      /** Get ID of expandable {@code account} object. */
2560
      public String getAccount() {
2561
        return (this.account != null) ? this.account.getId() : null;
×
2562
      }
2563

2564
      public void setAccount(String id) {
2565
        this.account = ApiResource.setExpandableFieldId(id, this.account);
×
2566
      }
×
2567

2568
      /** Get expanded {@code account}. */
2569
      public Account getAccountObject() {
2570
        return (this.account != null) ? this.account.getExpanded() : null;
×
2571
      }
2572

2573
      public void setAccountObject(Account expandableObject) {
2574
        this.account = new ExpandableField<Account>(expandableObject.getId(), expandableObject);
×
2575
      }
×
2576
    }
2577
  }
2578

2579
  /**
2580
   * For more details about CustomField, please refer to the <a
2581
   * href="https://docs.stripe.com/api">API Reference.</a>
2582
   */
2583
  @Getter
2584
  @Setter
2585
  @EqualsAndHashCode(callSuper = false)
2586
  public static class CustomField extends StripeObject {
×
2587
    /** The name of the custom field. */
2588
    @SerializedName("name")
2589
    String name;
2590

2591
    /** The value of the custom field. */
2592
    @SerializedName("value")
2593
    String value;
2594
  }
2595

2596
  /**
2597
   * For more details about CustomerTaxId, please refer to the <a
2598
   * href="https://docs.stripe.com/api">API Reference.</a>
2599
   */
2600
  @Getter
2601
  @Setter
2602
  @EqualsAndHashCode(callSuper = false)
2603
  public static class CustomerTaxId extends StripeObject {
×
2604
    /**
2605
     * The type of the tax ID, one of {@code ad_nrt}, {@code ar_cuit}, {@code eu_vat}, {@code
2606
     * bo_tin}, {@code br_cnpj}, {@code br_cpf}, {@code cn_tin}, {@code co_nit}, {@code cr_tin},
2607
     * {@code do_rcn}, {@code ec_ruc}, {@code eu_oss_vat}, {@code hr_oib}, {@code pe_ruc}, {@code
2608
     * ro_tin}, {@code rs_pib}, {@code sv_nit}, {@code uy_ruc}, {@code ve_rif}, {@code vn_tin},
2609
     * {@code gb_vat}, {@code nz_gst}, {@code au_abn}, {@code au_arn}, {@code in_gst}, {@code
2610
     * no_vat}, {@code no_voec}, {@code za_vat}, {@code ch_vat}, {@code mx_rfc}, {@code sg_uen},
2611
     * {@code ru_inn}, {@code ru_kpp}, {@code ca_bn}, {@code hk_br}, {@code es_cif}, {@code tw_vat},
2612
     * {@code th_vat}, {@code jp_cn}, {@code jp_rn}, {@code jp_trn}, {@code li_uid}, {@code my_itn},
2613
     * {@code us_ein}, {@code kr_brn}, {@code ca_qst}, {@code ca_gst_hst}, {@code ca_pst_bc}, {@code
2614
     * ca_pst_mb}, {@code ca_pst_sk}, {@code my_sst}, {@code sg_gst}, {@code ae_trn}, {@code
2615
     * cl_tin}, {@code sa_vat}, {@code id_npwp}, {@code my_frp}, {@code il_vat}, {@code ge_vat},
2616
     * {@code ua_vat}, {@code is_vat}, {@code bg_uic}, {@code hu_tin}, {@code si_tin}, {@code
2617
     * ke_pin}, {@code tr_tin}, {@code eg_tin}, {@code ph_tin}, {@code bh_vat}, {@code kz_bin},
2618
     * {@code ng_tin}, {@code om_vat}, {@code de_stn}, {@code ch_uid}, {@code tz_vat}, {@code
2619
     * uz_vat}, {@code uz_tin}, {@code md_vat}, {@code ma_vat}, {@code by_tin}, or {@code unknown}.
2620
     */
2621
    @SerializedName("type")
2622
    String type;
2623

2624
    /** The value of the tax ID. */
2625
    @SerializedName("value")
2626
    String value;
2627
  }
2628

2629
  /**
2630
   * For more details about FromInvoice, please refer to the <a
2631
   * href="https://docs.stripe.com/api">API Reference.</a>
2632
   */
2633
  @Getter
2634
  @Setter
2635
  @EqualsAndHashCode(callSuper = false)
2636
  public static class FromInvoice extends StripeObject {
×
2637
    /** The relation between this invoice and the cloned invoice. */
2638
    @SerializedName("action")
2639
    String action;
2640

2641
    /** The invoice that was cloned. */
2642
    @SerializedName("invoice")
2643
    @Getter(lombok.AccessLevel.NONE)
2644
    @Setter(lombok.AccessLevel.NONE)
2645
    ExpandableField<Invoice> invoice;
2646

2647
    /** Get ID of expandable {@code invoice} object. */
2648
    public String getInvoice() {
2649
      return (this.invoice != null) ? this.invoice.getId() : null;
×
2650
    }
2651

2652
    public void setInvoice(String id) {
2653
      this.invoice = ApiResource.setExpandableFieldId(id, this.invoice);
×
2654
    }
×
2655

2656
    /** Get expanded {@code invoice}. */
2657
    public Invoice getInvoiceObject() {
2658
      return (this.invoice != null) ? this.invoice.getExpanded() : null;
×
2659
    }
2660

2661
    public void setInvoiceObject(Invoice expandableObject) {
2662
      this.invoice = new ExpandableField<Invoice>(expandableObject.getId(), expandableObject);
×
2663
    }
×
2664
  }
2665

2666
  /**
2667
   * For more details about Issuer, please refer to the <a href="https://docs.stripe.com/api">API
2668
   * Reference.</a>
2669
   */
2670
  @Getter
2671
  @Setter
2672
  @EqualsAndHashCode(callSuper = false)
2673
  public static class Issuer extends StripeObject {
1✔
2674
    /** The connected account being referenced when {@code type} is {@code account}. */
2675
    @SerializedName("account")
2676
    @Getter(lombok.AccessLevel.NONE)
2677
    @Setter(lombok.AccessLevel.NONE)
2678
    ExpandableField<Account> account;
2679

2680
    /**
2681
     * Type of the account referenced.
2682
     *
2683
     * <p>One of {@code account}, or {@code self}.
2684
     */
2685
    @SerializedName("type")
2686
    String type;
2687

2688
    /** Get ID of expandable {@code account} object. */
2689
    public String getAccount() {
2690
      return (this.account != null) ? this.account.getId() : null;
×
2691
    }
2692

2693
    public void setAccount(String id) {
2694
      this.account = ApiResource.setExpandableFieldId(id, this.account);
×
2695
    }
×
2696

2697
    /** Get expanded {@code account}. */
2698
    public Account getAccountObject() {
2699
      return (this.account != null) ? this.account.getExpanded() : null;
×
2700
    }
2701

2702
    public void setAccountObject(Account expandableObject) {
2703
      this.account = new ExpandableField<Account>(expandableObject.getId(), expandableObject);
×
2704
    }
×
2705
  }
2706

2707
  /**
2708
   * For more details about PaymentSettings, please refer to the <a
2709
   * href="https://docs.stripe.com/api">API Reference.</a>
2710
   */
2711
  @Getter
2712
  @Setter
2713
  @EqualsAndHashCode(callSuper = false)
2714
  public static class PaymentSettings extends StripeObject {
1✔
2715
    /**
2716
     * ID of the mandate to be used for this invoice. It must correspond to the payment method used
2717
     * to pay the invoice, including the invoice's default_payment_method or default_source, if set.
2718
     */
2719
    @SerializedName("default_mandate")
2720
    String defaultMandate;
2721

2722
    /** Payment-method-specific configuration to provide to the invoice’s PaymentIntent. */
2723
    @SerializedName("payment_method_options")
2724
    PaymentMethodOptions paymentMethodOptions;
2725

2726
    /**
2727
     * The list of payment method types (e.g. card) to provide to the invoice’s PaymentIntent. If
2728
     * not set, Stripe attempts to automatically determine the types to use by looking at the
2729
     * invoice’s default payment method, the subscription’s default payment method, the customer’s
2730
     * default payment method, and your <a
2731
     * href="https://dashboard.stripe.com/settings/billing/invoice">invoice template settings</a>.
2732
     */
2733
    @SerializedName("payment_method_types")
2734
    List<String> paymentMethodTypes;
2735

2736
    /**
2737
     * For more details about PaymentMethodOptions, please refer to the <a
2738
     * href="https://docs.stripe.com/api">API Reference.</a>
2739
     */
2740
    @Getter
2741
    @Setter
2742
    @EqualsAndHashCode(callSuper = false)
2743
    public static class PaymentMethodOptions extends StripeObject {
×
2744
      /**
2745
       * If paying by {@code acss_debit}, this sub-hash contains details about the Canadian
2746
       * pre-authorized debit payment method options to pass to the invoice’s PaymentIntent.
2747
       */
2748
      @SerializedName("acss_debit")
2749
      AcssDebit acssDebit;
2750

2751
      /**
2752
       * If paying by {@code bancontact}, this sub-hash contains details about the Bancontact
2753
       * payment method options to pass to the invoice’s PaymentIntent.
2754
       */
2755
      @SerializedName("bancontact")
2756
      Bancontact bancontact;
2757

2758
      /**
2759
       * If paying by {@code card}, this sub-hash contains details about the Card payment method
2760
       * options to pass to the invoice’s PaymentIntent.
2761
       */
2762
      @SerializedName("card")
2763
      Card card;
2764

2765
      /**
2766
       * If paying by {@code customer_balance}, this sub-hash contains details about the Bank
2767
       * transfer payment method options to pass to the invoice’s PaymentIntent.
2768
       */
2769
      @SerializedName("customer_balance")
2770
      CustomerBalance customerBalance;
2771

2772
      /**
2773
       * If paying by {@code id_bank_transfer}, this sub-hash contains details about the Indonesia
2774
       * bank transfer payment method options to pass to the invoice’s PaymentIntent.
2775
       */
2776
      @SerializedName("id_bank_transfer")
2777
      IdBankTransfer idBankTransfer;
2778

2779
      /**
2780
       * If paying by {@code konbini}, this sub-hash contains details about the Konbini payment
2781
       * method options to pass to the invoice’s PaymentIntent.
2782
       */
2783
      @SerializedName("konbini")
2784
      Konbini konbini;
2785

2786
      /**
2787
       * If paying by {@code sepa_debit}, this sub-hash contains details about the SEPA Direct Debit
2788
       * payment method options to pass to the invoice’s PaymentIntent.
2789
       */
2790
      @SerializedName("sepa_debit")
2791
      SepaDebit sepaDebit;
2792

2793
      /**
2794
       * If paying by {@code us_bank_account}, this sub-hash contains details about the ACH direct
2795
       * debit payment method options to pass to the invoice’s PaymentIntent.
2796
       */
2797
      @SerializedName("us_bank_account")
2798
      UsBankAccount usBankAccount;
2799

2800
      /**
2801
       * For more details about AcssDebit, please refer to the <a
2802
       * href="https://docs.stripe.com/api">API Reference.</a>
2803
       */
2804
      @Getter
2805
      @Setter
2806
      @EqualsAndHashCode(callSuper = false)
2807
      public static class AcssDebit extends StripeObject {
×
2808
        @SerializedName("mandate_options")
2809
        MandateOptions mandateOptions;
2810

2811
        /**
2812
         * Bank account verification method.
2813
         *
2814
         * <p>One of {@code automatic}, {@code instant}, or {@code microdeposits}.
2815
         */
2816
        @SerializedName("verification_method")
2817
        String verificationMethod;
2818

2819
        /**
2820
         * For more details about MandateOptions, please refer to the <a
2821
         * href="https://docs.stripe.com/api">API Reference.</a>
2822
         */
2823
        @Getter
2824
        @Setter
2825
        @EqualsAndHashCode(callSuper = false)
2826
        public static class MandateOptions extends StripeObject {
×
2827
          /**
2828
           * Transaction type of the mandate.
2829
           *
2830
           * <p>One of {@code business}, or {@code personal}.
2831
           */
2832
          @SerializedName("transaction_type")
2833
          String transactionType;
2834
        }
2835
      }
2836

2837
      /**
2838
       * For more details about Bancontact, please refer to the <a
2839
       * href="https://docs.stripe.com/api">API Reference.</a>
2840
       */
2841
      @Getter
2842
      @Setter
2843
      @EqualsAndHashCode(callSuper = false)
2844
      public static class Bancontact extends StripeObject {
×
2845
        /**
2846
         * Preferred language of the Bancontact authorization page that the customer is redirected
2847
         * to.
2848
         *
2849
         * <p>One of {@code de}, {@code en}, {@code fr}, or {@code nl}.
2850
         */
2851
        @SerializedName("preferred_language")
2852
        String preferredLanguage;
2853
      }
2854

2855
      /**
2856
       * For more details about Card, please refer to the <a href="https://docs.stripe.com/api">API
2857
       * Reference.</a>
2858
       */
2859
      @Getter
2860
      @Setter
2861
      @EqualsAndHashCode(callSuper = false)
2862
      public static class Card extends StripeObject {
×
2863
        @SerializedName("installments")
2864
        Installments installments;
2865

2866
        /**
2867
         * We strongly recommend that you rely on our SCA Engine to automatically prompt your
2868
         * customers for authentication based on risk level and <a
2869
         * href="https://stripe.com/docs/strong-customer-authentication">other requirements</a>.
2870
         * However, if you wish to request 3D Secure based on logic from your own fraud engine,
2871
         * provide this option. Read our guide on <a
2872
         * href="https://stripe.com/docs/payments/3d-secure/authentication-flow#manual-three-ds">manually
2873
         * requesting 3D Secure</a> for more information on how this configuration interacts with
2874
         * Radar and our SCA Engine.
2875
         *
2876
         * <p>One of {@code any}, {@code automatic}, or {@code challenge}.
2877
         */
2878
        @SerializedName("request_three_d_secure")
2879
        String requestThreeDSecure;
2880

2881
        /**
2882
         * For more details about Installments, please refer to the <a
2883
         * href="https://docs.stripe.com/api">API Reference.</a>
2884
         */
2885
        @Getter
2886
        @Setter
2887
        @EqualsAndHashCode(callSuper = false)
2888
        public static class Installments extends StripeObject {
×
2889
          /** Whether Installments are enabled for this Invoice. */
2890
          @SerializedName("enabled")
2891
          Boolean enabled;
2892
        }
2893
      }
2894

2895
      /**
2896
       * For more details about CustomerBalance, please refer to the <a
2897
       * href="https://docs.stripe.com/api">API Reference.</a>
2898
       */
2899
      @Getter
2900
      @Setter
2901
      @EqualsAndHashCode(callSuper = false)
2902
      public static class CustomerBalance extends StripeObject {
×
2903
        @SerializedName("bank_transfer")
2904
        BankTransfer bankTransfer;
2905

2906
        /**
2907
         * The funding method type to be used when there are not enough funds in the customer
2908
         * balance. Permitted values include: {@code bank_transfer}.
2909
         *
2910
         * <p>Equal to {@code bank_transfer}.
2911
         */
2912
        @SerializedName("funding_type")
2913
        String fundingType;
2914

2915
        /**
2916
         * For more details about BankTransfer, please refer to the <a
2917
         * href="https://docs.stripe.com/api">API Reference.</a>
2918
         */
2919
        @Getter
2920
        @Setter
2921
        @EqualsAndHashCode(callSuper = false)
2922
        public static class BankTransfer extends StripeObject {
×
2923
          @SerializedName("eu_bank_transfer")
2924
          EuBankTransfer euBankTransfer;
2925

2926
          /**
2927
           * The bank transfer type that can be used for funding. Permitted values include: {@code
2928
           * eu_bank_transfer}, {@code gb_bank_transfer}, {@code jp_bank_transfer}, {@code
2929
           * mx_bank_transfer}, or {@code us_bank_transfer}.
2930
           */
2931
          @SerializedName("type")
2932
          String type;
2933

2934
          /**
2935
           * For more details about EuBankTransfer, please refer to the <a
2936
           * href="https://docs.stripe.com/api">API Reference.</a>
2937
           */
2938
          @Getter
2939
          @Setter
2940
          @EqualsAndHashCode(callSuper = false)
2941
          public static class EuBankTransfer extends StripeObject {
×
2942
            /**
2943
             * The desired country code of the bank account information. Permitted values include:
2944
             * {@code BE}, {@code DE}, {@code ES}, {@code FR}, {@code IE}, or {@code NL}.
2945
             *
2946
             * <p>One of {@code BE}, {@code DE}, {@code ES}, {@code FR}, {@code IE}, or {@code NL}.
2947
             */
2948
            @SerializedName("country")
2949
            String country;
2950
          }
2951
        }
2952
      }
2953

2954
      /**
2955
       * For more details about IdBankTransfer, please refer to the <a
2956
       * href="https://docs.stripe.com/api">API Reference.</a>
2957
       */
2958
      @Getter
2959
      @Setter
2960
      @EqualsAndHashCode(callSuper = false)
NEW
2961
      public static class IdBankTransfer extends StripeObject {}
×
2962

2963
      /**
2964
       * For more details about Konbini, please refer to the <a
2965
       * href="https://docs.stripe.com/api">API Reference.</a>
2966
       */
2967
      @Getter
2968
      @Setter
2969
      @EqualsAndHashCode(callSuper = false)
2970
      public static class Konbini extends StripeObject {}
×
2971

2972
      /**
2973
       * For more details about SepaDebit, please refer to the <a
2974
       * href="https://docs.stripe.com/api">API Reference.</a>
2975
       */
2976
      @Getter
2977
      @Setter
2978
      @EqualsAndHashCode(callSuper = false)
2979
      public static class SepaDebit extends StripeObject {}
×
2980

2981
      /**
2982
       * For more details about UsBankAccount, please refer to the <a
2983
       * href="https://docs.stripe.com/api">API Reference.</a>
2984
       */
2985
      @Getter
2986
      @Setter
2987
      @EqualsAndHashCode(callSuper = false)
2988
      public static class UsBankAccount extends StripeObject {
×
2989
        @SerializedName("financial_connections")
2990
        FinancialConnections financialConnections;
2991

2992
        /**
2993
         * Bank account verification method.
2994
         *
2995
         * <p>One of {@code automatic}, {@code instant}, or {@code microdeposits}.
2996
         */
2997
        @SerializedName("verification_method")
2998
        String verificationMethod;
2999

3000
        /**
3001
         * For more details about FinancialConnections, please refer to the <a
3002
         * href="https://docs.stripe.com/api">API Reference.</a>
3003
         */
3004
        @Getter
3005
        @Setter
3006
        @EqualsAndHashCode(callSuper = false)
3007
        public static class FinancialConnections extends StripeObject {
×
3008
          @SerializedName("filters")
3009
          Filters filters;
3010

3011
          /**
3012
           * The list of permissions to request. The {@code payment_method} permission must be
3013
           * included.
3014
           */
3015
          @SerializedName("permissions")
3016
          List<String> permissions;
3017

3018
          /** Data features requested to be retrieved upon account creation. */
3019
          @SerializedName("prefetch")
3020
          List<String> prefetch;
3021

3022
          /**
3023
           * For more details about Filters, please refer to the <a
3024
           * href="https://docs.stripe.com/api">API Reference.</a>
3025
           */
3026
          @Getter
3027
          @Setter
3028
          @EqualsAndHashCode(callSuper = false)
3029
          public static class Filters extends StripeObject {
×
3030
            /**
3031
             * The account subcategories to use to filter for possible accounts to link. Valid
3032
             * subcategories are {@code checking} and {@code savings}.
3033
             */
3034
            @SerializedName("account_subcategories")
3035
            List<String> accountSubcategories;
3036

3037
            /** The institution to use to filter for possible accounts to link. */
3038
            @SerializedName("institution")
3039
            String institution;
3040
          }
3041
        }
3042
      }
3043
    }
3044
  }
3045

3046
  /**
3047
   * For more details about Rendering, please refer to the <a href="https://docs.stripe.com/api">API
3048
   * Reference.</a>
3049
   */
3050
  @Getter
3051
  @Setter
3052
  @EqualsAndHashCode(callSuper = false)
3053
  public static class Rendering extends StripeObject {
×
3054
    /** How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. */
3055
    @SerializedName("amount_tax_display")
3056
    String amountTaxDisplay;
3057

3058
    /** Invoice pdf rendering options. */
3059
    @SerializedName("pdf")
3060
    Pdf pdf;
3061

3062
    /** ID of the rendering template that the invoice is formatted by. */
3063
    @SerializedName("template")
3064
    String template;
3065

3066
    /** Version of the rendering template that the invoice is using. */
3067
    @SerializedName("template_version")
3068
    Long templateVersion;
3069

3070
    /**
3071
     * For more details about Pdf, please refer to the <a href="https://docs.stripe.com/api">API
3072
     * Reference.</a>
3073
     */
3074
    @Getter
3075
    @Setter
3076
    @EqualsAndHashCode(callSuper = false)
3077
    public static class Pdf extends StripeObject {
×
3078
      /**
3079
       * Page size of invoice pdf. Options include a4, letter, and auto. If set to auto, page size
3080
       * will be switched to a4 or letter based on customer locale.
3081
       *
3082
       * <p>One of {@code a4}, {@code auto}, or {@code letter}.
3083
       */
3084
      @SerializedName("page_size")
3085
      String pageSize;
3086
    }
3087
  }
3088

3089
  /**
3090
   * For more details about ShippingCost, please refer to the <a
3091
   * href="https://docs.stripe.com/api">API Reference.</a>
3092
   */
3093
  @Getter
3094
  @Setter
3095
  @EqualsAndHashCode(callSuper = false)
3096
  public static class ShippingCost extends StripeObject {
×
3097
    /** Total shipping cost before any taxes are applied. */
3098
    @SerializedName("amount_subtotal")
3099
    Long amountSubtotal;
3100

3101
    /** Total tax amount applied due to shipping costs. If no tax was applied, defaults to 0. */
3102
    @SerializedName("amount_tax")
3103
    Long amountTax;
3104

3105
    /** Total shipping cost after taxes are applied. */
3106
    @SerializedName("amount_total")
3107
    Long amountTotal;
3108

3109
    /** The ID of the ShippingRate for this invoice. */
3110
    @SerializedName("shipping_rate")
3111
    @Getter(lombok.AccessLevel.NONE)
3112
    @Setter(lombok.AccessLevel.NONE)
3113
    ExpandableField<ShippingRate> shippingRate;
3114

3115
    /** The taxes applied to the shipping rate. */
3116
    @SerializedName("taxes")
3117
    List<Invoice.ShippingCost.Tax> taxes;
3118

3119
    /** Get ID of expandable {@code shippingRate} object. */
3120
    public String getShippingRate() {
3121
      return (this.shippingRate != null) ? this.shippingRate.getId() : null;
×
3122
    }
3123

3124
    public void setShippingRate(String id) {
3125
      this.shippingRate = ApiResource.setExpandableFieldId(id, this.shippingRate);
×
3126
    }
×
3127

3128
    /** Get expanded {@code shippingRate}. */
3129
    public ShippingRate getShippingRateObject() {
3130
      return (this.shippingRate != null) ? this.shippingRate.getExpanded() : null;
×
3131
    }
3132

3133
    public void setShippingRateObject(ShippingRate expandableObject) {
3134
      this.shippingRate =
×
3135
          new ExpandableField<ShippingRate>(expandableObject.getId(), expandableObject);
×
3136
    }
×
3137

3138
    /**
3139
     * For more details about Tax, please refer to the <a href="https://docs.stripe.com/api">API
3140
     * Reference.</a>
3141
     */
3142
    @Getter
3143
    @Setter
3144
    @EqualsAndHashCode(callSuper = false)
3145
    public static class Tax extends StripeObject {
×
3146
      /** Amount of tax applied for this rate. */
3147
      @SerializedName("amount")
3148
      Long amount;
3149

3150
      /**
3151
       * Tax rates can be applied to <a
3152
       * href="https://stripe.com/docs/billing/invoices/tax-rates">invoices</a>, <a
3153
       * href="https://stripe.com/docs/billing/subscriptions/taxes">subscriptions</a> and <a
3154
       * href="https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates">Checkout
3155
       * Sessions</a> to collect tax.
3156
       *
3157
       * <p>Related guide: <a href="https://stripe.com/docs/billing/taxes/tax-rates">Tax rates</a>
3158
       */
3159
      @SerializedName("rate")
3160
      TaxRate rate;
3161

3162
      /**
3163
       * The reasoning behind this tax, for example, if the product is tax exempt. The possible
3164
       * values for this field may be extended as new tax rules are supported.
3165
       *
3166
       * <p>One of {@code customer_exempt}, {@code not_collecting}, {@code not_subject_to_tax},
3167
       * {@code not_supported}, {@code portion_product_exempt}, {@code portion_reduced_rated},
3168
       * {@code portion_standard_rated}, {@code product_exempt}, {@code product_exempt_holiday},
3169
       * {@code proportionally_rated}, {@code reduced_rated}, {@code reverse_charge}, {@code
3170
       * standard_rated}, {@code taxable_basis_reduced}, or {@code zero_rated}.
3171
       */
3172
      @SerializedName("taxability_reason")
3173
      String taxabilityReason;
3174

3175
      /** The amount on which tax is calculated, in cents (or local equivalent). */
3176
      @SerializedName("taxable_amount")
3177
      Long taxableAmount;
3178
    }
3179
  }
3180

3181
  /**
3182
   * For more details about StatusTransitions, please refer to the <a
3183
   * href="https://docs.stripe.com/api">API Reference.</a>
3184
   */
3185
  @Getter
3186
  @Setter
3187
  @EqualsAndHashCode(callSuper = false)
3188
  public static class StatusTransitions extends StripeObject {
1✔
3189
    /** The time that the invoice draft was finalized. */
3190
    @SerializedName("finalized_at")
3191
    Long finalizedAt;
3192

3193
    /** The time that the invoice was marked uncollectible. */
3194
    @SerializedName("marked_uncollectible_at")
3195
    Long markedUncollectibleAt;
3196

3197
    /** The time that the invoice was paid. */
3198
    @SerializedName("paid_at")
3199
    Long paidAt;
3200

3201
    /** The time that the invoice was voided. */
3202
    @SerializedName("voided_at")
3203
    Long voidedAt;
3204
  }
3205

3206
  /**
3207
   * For more details about SubscriptionDetails, please refer to the <a
3208
   * href="https://docs.stripe.com/api">API Reference.</a>
3209
   */
3210
  @Getter
3211
  @Setter
3212
  @EqualsAndHashCode(callSuper = false)
3213
  public static class SubscriptionDetails extends StripeObject {
1✔
3214
    /**
3215
     * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> defined as
3216
     * subscription metadata when an invoice is created. Becomes an immutable snapshot of the
3217
     * subscription metadata at the time of invoice finalization. <em>Note: This attribute is
3218
     * populated only for invoices created on or after June 29, 2023.</em>
3219
     */
3220
    @SerializedName("metadata")
3221
    Map<String, String> metadata;
3222

3223
    /**
3224
     * If specified, payment collection for this subscription will be paused. Note that the
3225
     * subscription status will be unchanged and will not be updated to {@code paused}. Learn more
3226
     * about <a href="https://stripe.com/billing/subscriptions/pause-payment">pausing
3227
     * collection</a>.
3228
     */
3229
    @SerializedName("pause_collection")
3230
    PauseCollection pauseCollection;
3231

3232
    /**
3233
     * The Pause Collection settings determine how we will pause collection for this subscription
3234
     * and for how long the subscription should be paused.
3235
     */
3236
    @Getter
3237
    @Setter
3238
    @EqualsAndHashCode(callSuper = false)
3239
    public static class PauseCollection extends StripeObject {
×
3240
      /**
3241
       * The payment collection behavior for this subscription while paused. One of {@code
3242
       * keep_as_draft}, {@code mark_uncollectible}, or {@code void}.
3243
       */
3244
      @SerializedName("behavior")
3245
      String behavior;
3246

3247
      /** The time after which the subscription will resume collecting payments. */
3248
      @SerializedName("resumes_at")
3249
      Long resumesAt;
3250
    }
3251
  }
3252

3253
  /**
3254
   * For more details about ThresholdReason, please refer to the <a
3255
   * href="https://docs.stripe.com/api">API Reference.</a>
3256
   */
3257
  @Getter
3258
  @Setter
3259
  @EqualsAndHashCode(callSuper = false)
3260
  public static class ThresholdReason extends StripeObject {
×
3261
    /** The total invoice amount threshold boundary if it triggered the threshold invoice. */
3262
    @SerializedName("amount_gte")
3263
    Long amountGte;
3264

3265
    /** Indicates which line items triggered a threshold invoice. */
3266
    @SerializedName("item_reasons")
3267
    List<Invoice.ThresholdReason.ItemReason> itemReasons;
3268

3269
    /**
3270
     * For more details about ItemReason, please refer to the <a
3271
     * href="https://docs.stripe.com/api">API Reference.</a>
3272
     */
3273
    @Getter
3274
    @Setter
3275
    @EqualsAndHashCode(callSuper = false)
3276
    public static class ItemReason extends StripeObject {
×
3277
      /** The IDs of the line items that triggered the threshold invoice. */
3278
      @SerializedName("line_item_ids")
3279
      List<String> lineItemIds;
3280

3281
      /** The quantity threshold boundary that applied to the given line item. */
3282
      @SerializedName("usage_gte")
3283
      Long usageGte;
3284
    }
3285
  }
3286

3287
  /**
3288
   * For more details about TotalDiscountAmount, please refer to the <a
3289
   * href="https://docs.stripe.com/api">API Reference.</a>
3290
   */
3291
  @Getter
3292
  @Setter
3293
  @EqualsAndHashCode(callSuper = false)
3294
  public static class TotalDiscountAmount extends StripeObject {
×
3295
    /** The amount, in cents (or local equivalent), of the discount. */
3296
    @SerializedName("amount")
3297
    Long amount;
3298

3299
    /** The discount that was applied to get this discount amount. */
3300
    @SerializedName("discount")
3301
    @Getter(lombok.AccessLevel.NONE)
3302
    @Setter(lombok.AccessLevel.NONE)
3303
    ExpandableField<Discount> discount;
3304

3305
    /** Get ID of expandable {@code discount} object. */
3306
    public String getDiscount() {
3307
      return (this.discount != null) ? this.discount.getId() : null;
×
3308
    }
3309

3310
    public void setDiscount(String id) {
3311
      this.discount = ApiResource.setExpandableFieldId(id, this.discount);
×
3312
    }
×
3313

3314
    /** Get expanded {@code discount}. */
3315
    public Discount getDiscountObject() {
3316
      return (this.discount != null) ? this.discount.getExpanded() : null;
×
3317
    }
3318

3319
    public void setDiscountObject(Discount expandableObject) {
3320
      this.discount = new ExpandableField<Discount>(expandableObject.getId(), expandableObject);
×
3321
    }
×
3322
  }
3323

3324
  /**
3325
   * For more details about TotalMarginAmount, please refer to the <a
3326
   * href="https://docs.stripe.com/api">API Reference.</a>
3327
   */
3328
  @Getter
3329
  @Setter
3330
  @EqualsAndHashCode(callSuper = false)
3331
  public static class TotalMarginAmount extends StripeObject {
×
3332
    /** The amount, in cents (or local equivalent), of the reduction in line item amount. */
3333
    @SerializedName("amount")
3334
    Long amount;
3335

3336
    /** The margin that was applied to get this margin amount. */
3337
    @SerializedName("margin")
3338
    @Getter(lombok.AccessLevel.NONE)
3339
    @Setter(lombok.AccessLevel.NONE)
3340
    ExpandableField<Margin> margin;
3341

3342
    /** Get ID of expandable {@code margin} object. */
3343
    public String getMargin() {
3344
      return (this.margin != null) ? this.margin.getId() : null;
×
3345
    }
3346

3347
    public void setMargin(String id) {
3348
      this.margin = ApiResource.setExpandableFieldId(id, this.margin);
×
3349
    }
×
3350

3351
    /** Get expanded {@code margin}. */
3352
    public Margin getMarginObject() {
3353
      return (this.margin != null) ? this.margin.getExpanded() : null;
×
3354
    }
3355

3356
    public void setMarginObject(Margin expandableObject) {
3357
      this.margin = new ExpandableField<Margin>(expandableObject.getId(), expandableObject);
×
3358
    }
×
3359
  }
3360

3361
  /**
3362
   * For more details about TotalPretaxCreditAmount, please refer to the <a
3363
   * href="https://docs.stripe.com/api">API Reference.</a>
3364
   */
3365
  @Getter
3366
  @Setter
3367
  @EqualsAndHashCode(callSuper = false)
3368
  public static class TotalPretaxCreditAmount extends StripeObject {
×
3369
    /** The amount, in cents (or local equivalent), of the pretax credit amount. */
3370
    @SerializedName("amount")
3371
    Long amount;
3372

3373
    /** The credit balance transaction that was applied to get this pretax credit amount. */
3374
    @SerializedName("credit_balance_transaction")
3375
    @Getter(lombok.AccessLevel.NONE)
3376
    @Setter(lombok.AccessLevel.NONE)
3377
    ExpandableField<CreditBalanceTransaction> creditBalanceTransaction;
3378

3379
    /** The discount that was applied to get this pretax credit amount. */
3380
    @SerializedName("discount")
3381
    @Getter(lombok.AccessLevel.NONE)
3382
    @Setter(lombok.AccessLevel.NONE)
3383
    ExpandableField<Discount> discount;
3384

3385
    /** The margin that was applied to get this pretax credit amount. */
3386
    @SerializedName("margin")
3387
    @Getter(lombok.AccessLevel.NONE)
3388
    @Setter(lombok.AccessLevel.NONE)
3389
    ExpandableField<Margin> margin;
3390

3391
    /**
3392
     * Type of the pretax credit amount referenced.
3393
     *
3394
     * <p>One of {@code credit_balance_transaction}, {@code discount}, or {@code margin}.
3395
     */
3396
    @SerializedName("type")
3397
    String type;
3398

3399
    /** Get ID of expandable {@code creditBalanceTransaction} object. */
3400
    public String getCreditBalanceTransaction() {
3401
      return (this.creditBalanceTransaction != null) ? this.creditBalanceTransaction.getId() : null;
×
3402
    }
3403

3404
    public void setCreditBalanceTransaction(String id) {
3405
      this.creditBalanceTransaction =
×
3406
          ApiResource.setExpandableFieldId(id, this.creditBalanceTransaction);
×
3407
    }
×
3408

3409
    /** Get expanded {@code creditBalanceTransaction}. */
3410
    public CreditBalanceTransaction getCreditBalanceTransactionObject() {
3411
      return (this.creditBalanceTransaction != null)
×
3412
          ? this.creditBalanceTransaction.getExpanded()
×
3413
          : null;
×
3414
    }
3415

3416
    public void setCreditBalanceTransactionObject(CreditBalanceTransaction expandableObject) {
3417
      this.creditBalanceTransaction =
×
3418
          new ExpandableField<CreditBalanceTransaction>(expandableObject.getId(), expandableObject);
×
3419
    }
×
3420

3421
    /** Get ID of expandable {@code discount} object. */
3422
    public String getDiscount() {
3423
      return (this.discount != null) ? this.discount.getId() : null;
×
3424
    }
3425

3426
    public void setDiscount(String id) {
3427
      this.discount = ApiResource.setExpandableFieldId(id, this.discount);
×
3428
    }
×
3429

3430
    /** Get expanded {@code discount}. */
3431
    public Discount getDiscountObject() {
3432
      return (this.discount != null) ? this.discount.getExpanded() : null;
×
3433
    }
3434

3435
    public void setDiscountObject(Discount expandableObject) {
3436
      this.discount = new ExpandableField<Discount>(expandableObject.getId(), expandableObject);
×
3437
    }
×
3438

3439
    /** Get ID of expandable {@code margin} object. */
3440
    public String getMargin() {
3441
      return (this.margin != null) ? this.margin.getId() : null;
×
3442
    }
3443

3444
    public void setMargin(String id) {
3445
      this.margin = ApiResource.setExpandableFieldId(id, this.margin);
×
3446
    }
×
3447

3448
    /** Get expanded {@code margin}. */
3449
    public Margin getMarginObject() {
3450
      return (this.margin != null) ? this.margin.getExpanded() : null;
×
3451
    }
3452

3453
    public void setMarginObject(Margin expandableObject) {
3454
      this.margin = new ExpandableField<Margin>(expandableObject.getId(), expandableObject);
×
3455
    }
×
3456
  }
3457

3458
  /**
3459
   * For more details about TotalTaxAmount, please refer to the <a
3460
   * href="https://docs.stripe.com/api">API Reference.</a>
3461
   */
3462
  @Getter
3463
  @Setter
3464
  @EqualsAndHashCode(callSuper = false)
3465
  public static class TotalTaxAmount extends StripeObject {
×
3466
    /** The amount, in cents (or local equivalent), of the tax. */
3467
    @SerializedName("amount")
3468
    Long amount;
3469

3470
    /** Whether this tax amount is inclusive or exclusive. */
3471
    @SerializedName("inclusive")
3472
    Boolean inclusive;
3473

3474
    /** The tax rate that was applied to get this tax amount. */
3475
    @SerializedName("tax_rate")
3476
    @Getter(lombok.AccessLevel.NONE)
3477
    @Setter(lombok.AccessLevel.NONE)
3478
    ExpandableField<TaxRate> taxRate;
3479

3480
    /**
3481
     * The reasoning behind this tax, for example, if the product is tax exempt. The possible values
3482
     * for this field may be extended as new tax rules are supported.
3483
     *
3484
     * <p>One of {@code customer_exempt}, {@code not_collecting}, {@code not_subject_to_tax}, {@code
3485
     * not_supported}, {@code portion_product_exempt}, {@code portion_reduced_rated}, {@code
3486
     * portion_standard_rated}, {@code product_exempt}, {@code product_exempt_holiday}, {@code
3487
     * proportionally_rated}, {@code reduced_rated}, {@code reverse_charge}, {@code standard_rated},
3488
     * {@code taxable_basis_reduced}, or {@code zero_rated}.
3489
     */
3490
    @SerializedName("taxability_reason")
3491
    String taxabilityReason;
3492

3493
    /** The amount on which tax is calculated, in cents (or local equivalent). */
3494
    @SerializedName("taxable_amount")
3495
    Long taxableAmount;
3496

3497
    /** Get ID of expandable {@code taxRate} object. */
3498
    public String getTaxRate() {
3499
      return (this.taxRate != null) ? this.taxRate.getId() : null;
×
3500
    }
3501

3502
    public void setTaxRate(String id) {
3503
      this.taxRate = ApiResource.setExpandableFieldId(id, this.taxRate);
×
3504
    }
×
3505

3506
    /** Get expanded {@code taxRate}. */
3507
    public TaxRate getTaxRateObject() {
3508
      return (this.taxRate != null) ? this.taxRate.getExpanded() : null;
×
3509
    }
3510

3511
    public void setTaxRateObject(TaxRate expandableObject) {
3512
      this.taxRate = new ExpandableField<TaxRate>(expandableObject.getId(), expandableObject);
×
3513
    }
×
3514
  }
3515

3516
  /**
3517
   * For more details about TransferData, please refer to the <a
3518
   * href="https://docs.stripe.com/api">API Reference.</a>
3519
   */
3520
  @Getter
3521
  @Setter
3522
  @EqualsAndHashCode(callSuper = false)
3523
  public static class TransferData extends StripeObject {
×
3524
    /**
3525
     * The amount in cents (or local equivalent) that will be transferred to the destination account
3526
     * when the invoice is paid. By default, the entire amount is transferred to the destination.
3527
     */
3528
    @SerializedName("amount")
3529
    Long amount;
3530

3531
    /** The account where funds from the payment will be transferred to upon payment success. */
3532
    @SerializedName("destination")
3533
    @Getter(lombok.AccessLevel.NONE)
3534
    @Setter(lombok.AccessLevel.NONE)
3535
    ExpandableField<Account> destination;
3536

3537
    /** Get ID of expandable {@code destination} object. */
3538
    public String getDestination() {
3539
      return (this.destination != null) ? this.destination.getId() : null;
×
3540
    }
3541

3542
    public void setDestination(String id) {
3543
      this.destination = ApiResource.setExpandableFieldId(id, this.destination);
×
3544
    }
×
3545

3546
    /** Get expanded {@code destination}. */
3547
    public Account getDestinationObject() {
3548
      return (this.destination != null) ? this.destination.getExpanded() : null;
×
3549
    }
3550

3551
    public void setDestinationObject(Account expandableObject) {
3552
      this.destination = new ExpandableField<Account>(expandableObject.getId(), expandableObject);
×
3553
    }
×
3554
  }
3555

3556
  @Override
3557
  public void setResponseGetter(StripeResponseGetter responseGetter) {
3558
    super.setResponseGetter(responseGetter);
1✔
3559
    trySetResponseGetter(application, responseGetter);
1✔
3560
    trySetResponseGetter(automaticTax, responseGetter);
1✔
3561
    trySetResponseGetter(charge, responseGetter);
1✔
3562
    trySetResponseGetter(customer, responseGetter);
1✔
3563
    trySetResponseGetter(customerAddress, responseGetter);
1✔
3564
    trySetResponseGetter(customerShipping, responseGetter);
1✔
3565
    trySetResponseGetter(defaultPaymentMethod, responseGetter);
1✔
3566
    trySetResponseGetter(defaultSource, responseGetter);
1✔
3567
    trySetResponseGetter(discount, responseGetter);
1✔
3568
    trySetResponseGetter(fromInvoice, responseGetter);
1✔
3569
    trySetResponseGetter(issuer, responseGetter);
1✔
3570
    trySetResponseGetter(lastFinalizationError, responseGetter);
1✔
3571
    trySetResponseGetter(latestRevision, responseGetter);
1✔
3572
    trySetResponseGetter(lines, responseGetter);
1✔
3573
    trySetResponseGetter(onBehalfOf, responseGetter);
1✔
3574
    trySetResponseGetter(paymentIntent, responseGetter);
1✔
3575
    trySetResponseGetter(paymentSettings, responseGetter);
1✔
3576
    trySetResponseGetter(payments, responseGetter);
1✔
3577
    trySetResponseGetter(quote, responseGetter);
1✔
3578
    trySetResponseGetter(rendering, responseGetter);
1✔
3579
    trySetResponseGetter(shippingCost, responseGetter);
1✔
3580
    trySetResponseGetter(shippingDetails, responseGetter);
1✔
3581
    trySetResponseGetter(statusTransitions, responseGetter);
1✔
3582
    trySetResponseGetter(subscription, responseGetter);
1✔
3583
    trySetResponseGetter(subscriptionDetails, responseGetter);
1✔
3584
    trySetResponseGetter(testClock, responseGetter);
1✔
3585
    trySetResponseGetter(thresholdReason, responseGetter);
1✔
3586
    trySetResponseGetter(transferData, responseGetter);
1✔
3587
  }
1✔
3588
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc