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

stripe / stripe-java / #16493

03 Oct 2024 07:15PM UTC coverage: 12.942% (+0.08%) from 12.864%
#16493

push

github

web-flow
Merge Stripe-java v27.0.0 to beta branch (#1888)

409 of 1651 new or added lines in 88 files covered. (24.77%)

31 existing lines in 7 files now uncovered.

18773 of 145050 relevant lines covered (12.94%)

0.13 hits per line

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

33.2
/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
  @SerializedName("total_pretax_credit_amounts")
644
  List<Invoice.TotalPretaxCreditAmount> totalPretaxCreditAmounts;
645

646
  /** The aggregate amounts calculated per tax rate for all line items. */
647
  @SerializedName("total_tax_amounts")
648
  List<Invoice.TotalTaxAmount> totalTaxAmounts;
649

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

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

667
  /** Get ID of expandable {@code application} object. */
668
  public String getApplication() {
669
    return (this.application != null) ? this.application.getId() : null;
1✔
670
  }
671

672
  public void setApplication(String id) {
673
    this.application = ApiResource.setExpandableFieldId(id, this.application);
×
674
  }
×
675

676
  /** Get expanded {@code application}. */
677
  public Application getApplicationObject() {
678
    return (this.application != null) ? this.application.getExpanded() : null;
×
679
  }
680

681
  public void setApplicationObject(Application expandableObject) {
682
    this.application = new ExpandableField<Application>(expandableObject.getId(), expandableObject);
×
683
  }
×
684

685
  /** Get ID of expandable {@code charge} object. */
686
  public String getCharge() {
687
    return (this.charge != null) ? this.charge.getId() : null;
1✔
688
  }
689

690
  public void setCharge(String id) {
691
    this.charge = ApiResource.setExpandableFieldId(id, this.charge);
×
692
  }
×
693

694
  /** Get expanded {@code charge}. */
695
  public Charge getChargeObject() {
696
    return (this.charge != null) ? this.charge.getExpanded() : null;
1✔
697
  }
698

699
  public void setChargeObject(Charge expandableObject) {
700
    this.charge = new ExpandableField<Charge>(expandableObject.getId(), expandableObject);
×
701
  }
×
702

703
  /** Get ID of expandable {@code customer} object. */
704
  public String getCustomer() {
705
    return (this.customer != null) ? this.customer.getId() : null;
1✔
706
  }
707

708
  public void setCustomer(String id) {
709
    this.customer = ApiResource.setExpandableFieldId(id, this.customer);
×
710
  }
×
711

712
  /** Get expanded {@code customer}. */
713
  public Customer getCustomerObject() {
714
    return (this.customer != null) ? this.customer.getExpanded() : null;
1✔
715
  }
716

717
  public void setCustomerObject(Customer expandableObject) {
718
    this.customer = new ExpandableField<Customer>(expandableObject.getId(), expandableObject);
×
719
  }
×
720

721
  /** Get ID of expandable {@code defaultPaymentMethod} object. */
722
  public String getDefaultPaymentMethod() {
723
    return (this.defaultPaymentMethod != null) ? this.defaultPaymentMethod.getId() : null;
1✔
724
  }
725

726
  public void setDefaultPaymentMethod(String id) {
727
    this.defaultPaymentMethod = ApiResource.setExpandableFieldId(id, this.defaultPaymentMethod);
×
728
  }
×
729

730
  /** Get expanded {@code defaultPaymentMethod}. */
731
  public PaymentMethod getDefaultPaymentMethodObject() {
732
    return (this.defaultPaymentMethod != null) ? this.defaultPaymentMethod.getExpanded() : null;
×
733
  }
734

735
  public void setDefaultPaymentMethodObject(PaymentMethod expandableObject) {
736
    this.defaultPaymentMethod =
×
737
        new ExpandableField<PaymentMethod>(expandableObject.getId(), expandableObject);
×
738
  }
×
739

740
  /** Get ID of expandable {@code defaultSource} object. */
741
  public String getDefaultSource() {
742
    return (this.defaultSource != null) ? this.defaultSource.getId() : null;
1✔
743
  }
744

745
  public void setDefaultSource(String id) {
746
    this.defaultSource = ApiResource.setExpandableFieldId(id, this.defaultSource);
×
747
  }
×
748

749
  /** Get expanded {@code defaultSource}. */
750
  public PaymentSource getDefaultSourceObject() {
751
    return (this.defaultSource != null) ? this.defaultSource.getExpanded() : null;
×
752
  }
753

754
  public void setDefaultSourceObject(PaymentSource expandableObject) {
755
    this.defaultSource =
×
756
        new ExpandableField<PaymentSource>(expandableObject.getId(), expandableObject);
×
757
  }
×
758

759
  /** Get ID of expandable {@code latestRevision} object. */
760
  public String getLatestRevision() {
761
    return (this.latestRevision != null) ? this.latestRevision.getId() : null;
1✔
762
  }
763

764
  public void setLatestRevision(String id) {
765
    this.latestRevision = ApiResource.setExpandableFieldId(id, this.latestRevision);
×
766
  }
×
767

768
  /** Get expanded {@code latestRevision}. */
769
  public Invoice getLatestRevisionObject() {
770
    return (this.latestRevision != null) ? this.latestRevision.getExpanded() : null;
×
771
  }
772

773
  public void setLatestRevisionObject(Invoice expandableObject) {
774
    this.latestRevision = new ExpandableField<Invoice>(expandableObject.getId(), expandableObject);
×
775
  }
×
776

777
  /** Get ID of expandable {@code onBehalfOf} object. */
778
  public String getOnBehalfOf() {
779
    return (this.onBehalfOf != null) ? this.onBehalfOf.getId() : null;
1✔
780
  }
781

782
  public void setOnBehalfOf(String id) {
783
    this.onBehalfOf = ApiResource.setExpandableFieldId(id, this.onBehalfOf);
×
784
  }
×
785

786
  /** Get expanded {@code onBehalfOf}. */
787
  public Account getOnBehalfOfObject() {
788
    return (this.onBehalfOf != null) ? this.onBehalfOf.getExpanded() : null;
×
789
  }
790

791
  public void setOnBehalfOfObject(Account expandableObject) {
792
    this.onBehalfOf = new ExpandableField<Account>(expandableObject.getId(), expandableObject);
×
793
  }
×
794

795
  /** Get ID of expandable {@code paymentIntent} object. */
796
  public String getPaymentIntent() {
797
    return (this.paymentIntent != null) ? this.paymentIntent.getId() : null;
1✔
798
  }
799

800
  public void setPaymentIntent(String id) {
801
    this.paymentIntent = ApiResource.setExpandableFieldId(id, this.paymentIntent);
×
802
  }
×
803

804
  /** Get expanded {@code paymentIntent}. */
805
  public PaymentIntent getPaymentIntentObject() {
806
    return (this.paymentIntent != null) ? this.paymentIntent.getExpanded() : null;
×
807
  }
808

809
  public void setPaymentIntentObject(PaymentIntent expandableObject) {
810
    this.paymentIntent =
×
811
        new ExpandableField<PaymentIntent>(expandableObject.getId(), expandableObject);
×
812
  }
×
813

814
  /** Get ID of expandable {@code quote} object. */
815
  public String getQuote() {
816
    return (this.quote != null) ? this.quote.getId() : null;
1✔
817
  }
818

819
  public void setQuote(String id) {
820
    this.quote = ApiResource.setExpandableFieldId(id, this.quote);
×
821
  }
×
822

823
  /** Get expanded {@code quote}. */
824
  public Quote getQuoteObject() {
825
    return (this.quote != null) ? this.quote.getExpanded() : null;
×
826
  }
827

828
  public void setQuoteObject(Quote expandableObject) {
829
    this.quote = new ExpandableField<Quote>(expandableObject.getId(), expandableObject);
×
830
  }
×
831

832
  /** Get ID of expandable {@code subscription} object. */
833
  public String getSubscription() {
834
    return (this.subscription != null) ? this.subscription.getId() : null;
1✔
835
  }
836

837
  public void setSubscription(String id) {
838
    this.subscription = ApiResource.setExpandableFieldId(id, this.subscription);
×
839
  }
×
840

841
  /** Get expanded {@code subscription}. */
842
  public Subscription getSubscriptionObject() {
843
    return (this.subscription != null) ? this.subscription.getExpanded() : null;
×
844
  }
845

846
  public void setSubscriptionObject(Subscription expandableObject) {
847
    this.subscription =
×
848
        new ExpandableField<Subscription>(expandableObject.getId(), expandableObject);
×
849
  }
×
850

851
  /** Get ID of expandable {@code testClock} object. */
852
  public String getTestClock() {
853
    return (this.testClock != null) ? this.testClock.getId() : null;
1✔
854
  }
855

856
  public void setTestClock(String id) {
857
    this.testClock = ApiResource.setExpandableFieldId(id, this.testClock);
×
858
  }
×
859

860
  /** Get expanded {@code testClock}. */
861
  public TestClock getTestClockObject() {
862
    return (this.testClock != null) ? this.testClock.getExpanded() : null;
×
863
  }
864

865
  public void setTestClockObject(TestClock expandableObject) {
866
    this.testClock = new ExpandableField<TestClock>(expandableObject.getId(), expandableObject);
×
867
  }
×
868

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2457
  @Getter
2458
  @Setter
2459
  @EqualsAndHashCode(callSuper = false)
2460
  public static class AmountsDue extends StripeObject {
×
2461
    /** Incremental amount due for this payment in cents (or local equivalent). */
2462
    @SerializedName("amount")
2463
    Long amount;
2464

2465
    /** The amount in cents (or local equivalent) that was paid for this payment. */
2466
    @SerializedName("amount_paid")
2467
    Long amountPaid;
2468

2469
    /**
2470
     * The difference between the payment’s amount and amount_paid, in cents (or local equivalent).
2471
     */
2472
    @SerializedName("amount_remaining")
2473
    Long amountRemaining;
2474

2475
    /** Number of days from when invoice is finalized until the payment is due. */
2476
    @SerializedName("days_until_due")
2477
    Long daysUntilDue;
2478

2479
    /** An arbitrary string attached to the object. Often useful for displaying to users. */
2480
    @SerializedName("description")
2481
    String description;
2482

2483
    /** Date on which a payment plan’s payment is due. */
2484
    @SerializedName("due_date")
2485
    Long dueDate;
2486

2487
    /** Timestamp when the payment was paid. */
2488
    @SerializedName("paid_at")
2489
    Long paidAt;
2490

2491
    /** The status of the payment, one of {@code open}, {@code paid}, or {@code past_due}. */
2492
    @SerializedName("status")
2493
    String status;
2494
  }
2495

2496
  @Getter
2497
  @Setter
2498
  @EqualsAndHashCode(callSuper = false)
2499
  public static class AutomaticTax extends StripeObject {
1✔
2500
    /**
2501
     * Whether Stripe automatically computes tax on this invoice. Note that incompatible invoice
2502
     * items (invoice items with manually specified <a
2503
     * href="https://stripe.com/docs/api/tax_rates">tax rates</a>, negative amounts, or {@code
2504
     * tax_behavior=unspecified}) cannot be added to automatic tax invoices.
2505
     */
2506
    @SerializedName("enabled")
2507
    Boolean enabled;
2508

2509
    /**
2510
     * The account that's liable for tax. If set, the business address and tax registrations
2511
     * required to perform the tax calculation are loaded from this account. The tax transaction is
2512
     * returned in the report of the connected account.
2513
     */
2514
    @SerializedName("liability")
2515
    Liability liability;
2516

2517
    /**
2518
     * The status of the most recent automated tax calculation for this invoice.
2519
     *
2520
     * <p>One of {@code complete}, {@code failed}, or {@code requires_location_inputs}.
2521
     */
2522
    @SerializedName("status")
2523
    String status;
2524

2525
    @Getter
2526
    @Setter
2527
    @EqualsAndHashCode(callSuper = false)
2528
    public static class Liability extends StripeObject {
×
2529
      /** The connected account being referenced when {@code type} is {@code account}. */
2530
      @SerializedName("account")
2531
      @Getter(lombok.AccessLevel.NONE)
2532
      @Setter(lombok.AccessLevel.NONE)
2533
      ExpandableField<Account> account;
2534

2535
      /**
2536
       * Type of the account referenced.
2537
       *
2538
       * <p>One of {@code account}, or {@code self}.
2539
       */
2540
      @SerializedName("type")
2541
      String type;
2542

2543
      /** Get ID of expandable {@code account} object. */
2544
      public String getAccount() {
2545
        return (this.account != null) ? this.account.getId() : null;
×
2546
      }
2547

2548
      public void setAccount(String id) {
2549
        this.account = ApiResource.setExpandableFieldId(id, this.account);
×
2550
      }
×
2551

2552
      /** Get expanded {@code account}. */
2553
      public Account getAccountObject() {
2554
        return (this.account != null) ? this.account.getExpanded() : null;
×
2555
      }
2556

2557
      public void setAccountObject(Account expandableObject) {
2558
        this.account = new ExpandableField<Account>(expandableObject.getId(), expandableObject);
×
2559
      }
×
2560
    }
2561
  }
2562

2563
  @Getter
2564
  @Setter
2565
  @EqualsAndHashCode(callSuper = false)
2566
  public static class CustomField extends StripeObject {
×
2567
    /** The name of the custom field. */
2568
    @SerializedName("name")
2569
    String name;
2570

2571
    /** The value of the custom field. */
2572
    @SerializedName("value")
2573
    String value;
2574
  }
2575

2576
  @Getter
2577
  @Setter
2578
  @EqualsAndHashCode(callSuper = false)
2579
  public static class CustomerTaxId extends StripeObject {
×
2580
    /**
2581
     * The type of the tax ID, one of {@code ad_nrt}, {@code ar_cuit}, {@code eu_vat}, {@code
2582
     * bo_tin}, {@code br_cnpj}, {@code br_cpf}, {@code cn_tin}, {@code co_nit}, {@code cr_tin},
2583
     * {@code do_rcn}, {@code ec_ruc}, {@code eu_oss_vat}, {@code hr_oib}, {@code pe_ruc}, {@code
2584
     * ro_tin}, {@code rs_pib}, {@code sv_nit}, {@code uy_ruc}, {@code ve_rif}, {@code vn_tin},
2585
     * {@code gb_vat}, {@code nz_gst}, {@code au_abn}, {@code au_arn}, {@code in_gst}, {@code
2586
     * no_vat}, {@code no_voec}, {@code za_vat}, {@code ch_vat}, {@code mx_rfc}, {@code sg_uen},
2587
     * {@code ru_inn}, {@code ru_kpp}, {@code ca_bn}, {@code hk_br}, {@code es_cif}, {@code tw_vat},
2588
     * {@code th_vat}, {@code jp_cn}, {@code jp_rn}, {@code jp_trn}, {@code li_uid}, {@code my_itn},
2589
     * {@code us_ein}, {@code kr_brn}, {@code ca_qst}, {@code ca_gst_hst}, {@code ca_pst_bc}, {@code
2590
     * ca_pst_mb}, {@code ca_pst_sk}, {@code my_sst}, {@code sg_gst}, {@code ae_trn}, {@code
2591
     * cl_tin}, {@code sa_vat}, {@code id_npwp}, {@code my_frp}, {@code il_vat}, {@code ge_vat},
2592
     * {@code ua_vat}, {@code is_vat}, {@code bg_uic}, {@code hu_tin}, {@code si_tin}, {@code
2593
     * ke_pin}, {@code tr_tin}, {@code eg_tin}, {@code ph_tin}, {@code bh_vat}, {@code kz_bin},
2594
     * {@code ng_tin}, {@code om_vat}, {@code de_stn}, {@code ch_uid}, or {@code unknown}.
2595
     */
2596
    @SerializedName("type")
2597
    String type;
2598

2599
    /** The value of the tax ID. */
2600
    @SerializedName("value")
2601
    String value;
2602
  }
2603

2604
  @Getter
2605
  @Setter
2606
  @EqualsAndHashCode(callSuper = false)
2607
  public static class FromInvoice extends StripeObject {
×
2608
    /** The relation between this invoice and the cloned invoice. */
2609
    @SerializedName("action")
2610
    String action;
2611

2612
    /** The invoice that was cloned. */
2613
    @SerializedName("invoice")
2614
    @Getter(lombok.AccessLevel.NONE)
2615
    @Setter(lombok.AccessLevel.NONE)
2616
    ExpandableField<Invoice> invoice;
2617

2618
    /** Get ID of expandable {@code invoice} object. */
2619
    public String getInvoice() {
2620
      return (this.invoice != null) ? this.invoice.getId() : null;
×
2621
    }
2622

2623
    public void setInvoice(String id) {
2624
      this.invoice = ApiResource.setExpandableFieldId(id, this.invoice);
×
2625
    }
×
2626

2627
    /** Get expanded {@code invoice}. */
2628
    public Invoice getInvoiceObject() {
2629
      return (this.invoice != null) ? this.invoice.getExpanded() : null;
×
2630
    }
2631

2632
    public void setInvoiceObject(Invoice expandableObject) {
2633
      this.invoice = new ExpandableField<Invoice>(expandableObject.getId(), expandableObject);
×
2634
    }
×
2635
  }
2636

2637
  @Getter
2638
  @Setter
2639
  @EqualsAndHashCode(callSuper = false)
2640
  public static class Issuer extends StripeObject {
1✔
2641
    /** The connected account being referenced when {@code type} is {@code account}. */
2642
    @SerializedName("account")
2643
    @Getter(lombok.AccessLevel.NONE)
2644
    @Setter(lombok.AccessLevel.NONE)
2645
    ExpandableField<Account> account;
2646

2647
    /**
2648
     * Type of the account referenced.
2649
     *
2650
     * <p>One of {@code account}, or {@code self}.
2651
     */
2652
    @SerializedName("type")
2653
    String type;
2654

2655
    /** Get ID of expandable {@code account} object. */
2656
    public String getAccount() {
2657
      return (this.account != null) ? this.account.getId() : null;
×
2658
    }
2659

2660
    public void setAccount(String id) {
2661
      this.account = ApiResource.setExpandableFieldId(id, this.account);
×
2662
    }
×
2663

2664
    /** Get expanded {@code account}. */
2665
    public Account getAccountObject() {
2666
      return (this.account != null) ? this.account.getExpanded() : null;
×
2667
    }
2668

2669
    public void setAccountObject(Account expandableObject) {
2670
      this.account = new ExpandableField<Account>(expandableObject.getId(), expandableObject);
×
2671
    }
×
2672
  }
2673

2674
  @Getter
2675
  @Setter
2676
  @EqualsAndHashCode(callSuper = false)
2677
  public static class PaymentSettings extends StripeObject {
1✔
2678
    /**
2679
     * ID of the mandate to be used for this invoice. It must correspond to the payment method used
2680
     * to pay the invoice, including the invoice's default_payment_method or default_source, if set.
2681
     */
2682
    @SerializedName("default_mandate")
2683
    String defaultMandate;
2684

2685
    /** Payment-method-specific configuration to provide to the invoice’s PaymentIntent. */
2686
    @SerializedName("payment_method_options")
2687
    PaymentMethodOptions paymentMethodOptions;
2688

2689
    /**
2690
     * The list of payment method types (e.g. card) to provide to the invoice’s PaymentIntent. If
2691
     * not set, Stripe attempts to automatically determine the types to use by looking at the
2692
     * invoice’s default payment method, the subscription’s default payment method, the customer’s
2693
     * default payment method, and your <a
2694
     * href="https://dashboard.stripe.com/settings/billing/invoice">invoice template settings</a>.
2695
     */
2696
    @SerializedName("payment_method_types")
2697
    List<String> paymentMethodTypes;
2698

2699
    @Getter
2700
    @Setter
2701
    @EqualsAndHashCode(callSuper = false)
2702
    public static class PaymentMethodOptions extends StripeObject {
×
2703
      /**
2704
       * If paying by {@code acss_debit}, this sub-hash contains details about the Canadian
2705
       * pre-authorized debit payment method options to pass to the invoice’s PaymentIntent.
2706
       */
2707
      @SerializedName("acss_debit")
2708
      AcssDebit acssDebit;
2709

2710
      /**
2711
       * If paying by {@code bancontact}, this sub-hash contains details about the Bancontact
2712
       * payment method options to pass to the invoice’s PaymentIntent.
2713
       */
2714
      @SerializedName("bancontact")
2715
      Bancontact bancontact;
2716

2717
      /**
2718
       * If paying by {@code card}, this sub-hash contains details about the Card payment method
2719
       * options to pass to the invoice’s PaymentIntent.
2720
       */
2721
      @SerializedName("card")
2722
      Card card;
2723

2724
      /**
2725
       * If paying by {@code customer_balance}, this sub-hash contains details about the Bank
2726
       * transfer payment method options to pass to the invoice’s PaymentIntent.
2727
       */
2728
      @SerializedName("customer_balance")
2729
      CustomerBalance customerBalance;
2730

2731
      /**
2732
       * If paying by {@code konbini}, this sub-hash contains details about the Konbini payment
2733
       * method options to pass to the invoice’s PaymentIntent.
2734
       */
2735
      @SerializedName("konbini")
2736
      Konbini konbini;
2737

2738
      /**
2739
       * If paying by {@code sepa_debit}, this sub-hash contains details about the SEPA Direct Debit
2740
       * payment method options to pass to the invoice’s PaymentIntent.
2741
       */
2742
      @SerializedName("sepa_debit")
2743
      SepaDebit sepaDebit;
2744

2745
      /**
2746
       * If paying by {@code us_bank_account}, this sub-hash contains details about the ACH direct
2747
       * debit payment method options to pass to the invoice’s PaymentIntent.
2748
       */
2749
      @SerializedName("us_bank_account")
2750
      UsBankAccount usBankAccount;
2751

2752
      @Getter
2753
      @Setter
2754
      @EqualsAndHashCode(callSuper = false)
2755
      public static class AcssDebit extends StripeObject {
×
2756
        @SerializedName("mandate_options")
2757
        MandateOptions mandateOptions;
2758

2759
        /**
2760
         * Bank account verification method.
2761
         *
2762
         * <p>One of {@code automatic}, {@code instant}, or {@code microdeposits}.
2763
         */
2764
        @SerializedName("verification_method")
2765
        String verificationMethod;
2766

2767
        @Getter
2768
        @Setter
2769
        @EqualsAndHashCode(callSuper = false)
2770
        public static class MandateOptions extends StripeObject {
×
2771
          /**
2772
           * Transaction type of the mandate.
2773
           *
2774
           * <p>One of {@code business}, or {@code personal}.
2775
           */
2776
          @SerializedName("transaction_type")
2777
          String transactionType;
2778
        }
2779
      }
2780

2781
      @Getter
2782
      @Setter
2783
      @EqualsAndHashCode(callSuper = false)
2784
      public static class Bancontact extends StripeObject {
×
2785
        /**
2786
         * Preferred language of the Bancontact authorization page that the customer is redirected
2787
         * to.
2788
         *
2789
         * <p>One of {@code de}, {@code en}, {@code fr}, or {@code nl}.
2790
         */
2791
        @SerializedName("preferred_language")
2792
        String preferredLanguage;
2793
      }
2794

2795
      @Getter
2796
      @Setter
2797
      @EqualsAndHashCode(callSuper = false)
2798
      public static class Card extends StripeObject {
×
2799
        @SerializedName("installments")
2800
        Installments installments;
2801

2802
        /**
2803
         * We strongly recommend that you rely on our SCA Engine to automatically prompt your
2804
         * customers for authentication based on risk level and <a
2805
         * href="https://stripe.com/docs/strong-customer-authentication">other requirements</a>.
2806
         * However, if you wish to request 3D Secure based on logic from your own fraud engine,
2807
         * provide this option. Read our guide on <a
2808
         * href="https://stripe.com/docs/payments/3d-secure/authentication-flow#manual-three-ds">manually
2809
         * requesting 3D Secure</a> for more information on how this configuration interacts with
2810
         * Radar and our SCA Engine.
2811
         *
2812
         * <p>One of {@code any}, {@code automatic}, or {@code challenge}.
2813
         */
2814
        @SerializedName("request_three_d_secure")
2815
        String requestThreeDSecure;
2816

2817
        @Getter
2818
        @Setter
2819
        @EqualsAndHashCode(callSuper = false)
2820
        public static class Installments extends StripeObject {
×
2821
          /** Whether Installments are enabled for this Invoice. */
2822
          @SerializedName("enabled")
2823
          Boolean enabled;
2824
        }
2825
      }
2826

2827
      @Getter
2828
      @Setter
2829
      @EqualsAndHashCode(callSuper = false)
2830
      public static class CustomerBalance extends StripeObject {
×
2831
        @SerializedName("bank_transfer")
2832
        BankTransfer bankTransfer;
2833

2834
        /**
2835
         * The funding method type to be used when there are not enough funds in the customer
2836
         * balance. Permitted values include: {@code bank_transfer}.
2837
         *
2838
         * <p>Equal to {@code bank_transfer}.
2839
         */
2840
        @SerializedName("funding_type")
2841
        String fundingType;
2842

2843
        @Getter
2844
        @Setter
2845
        @EqualsAndHashCode(callSuper = false)
2846
        public static class BankTransfer extends StripeObject {
×
2847
          @SerializedName("eu_bank_transfer")
2848
          EuBankTransfer euBankTransfer;
2849

2850
          /**
2851
           * The bank transfer type that can be used for funding. Permitted values include: {@code
2852
           * eu_bank_transfer}, {@code gb_bank_transfer}, {@code jp_bank_transfer}, {@code
2853
           * mx_bank_transfer}, or {@code us_bank_transfer}.
2854
           */
2855
          @SerializedName("type")
2856
          String type;
2857

2858
          @Getter
2859
          @Setter
2860
          @EqualsAndHashCode(callSuper = false)
2861
          public static class EuBankTransfer extends StripeObject {
×
2862
            /**
2863
             * The desired country code of the bank account information. Permitted values include:
2864
             * {@code BE}, {@code DE}, {@code ES}, {@code FR}, {@code IE}, or {@code NL}.
2865
             *
2866
             * <p>One of {@code BE}, {@code DE}, {@code ES}, {@code FR}, {@code IE}, or {@code NL}.
2867
             */
2868
            @SerializedName("country")
2869
            String country;
2870
          }
2871
        }
2872
      }
2873

2874
      @Getter
2875
      @Setter
2876
      @EqualsAndHashCode(callSuper = false)
2877
      public static class Konbini extends StripeObject {}
×
2878

2879
      @Getter
2880
      @Setter
2881
      @EqualsAndHashCode(callSuper = false)
2882
      public static class SepaDebit extends StripeObject {}
×
2883

2884
      @Getter
2885
      @Setter
2886
      @EqualsAndHashCode(callSuper = false)
2887
      public static class UsBankAccount extends StripeObject {
×
2888
        @SerializedName("financial_connections")
2889
        FinancialConnections financialConnections;
2890

2891
        /**
2892
         * Bank account verification method.
2893
         *
2894
         * <p>One of {@code automatic}, {@code instant}, or {@code microdeposits}.
2895
         */
2896
        @SerializedName("verification_method")
2897
        String verificationMethod;
2898

2899
        @Getter
2900
        @Setter
2901
        @EqualsAndHashCode(callSuper = false)
2902
        public static class FinancialConnections extends StripeObject {
×
2903
          @SerializedName("filters")
2904
          Filters filters;
2905

2906
          /**
2907
           * The list of permissions to request. The {@code payment_method} permission must be
2908
           * included.
2909
           */
2910
          @SerializedName("permissions")
2911
          List<String> permissions;
2912

2913
          /** Data features requested to be retrieved upon account creation. */
2914
          @SerializedName("prefetch")
2915
          List<String> prefetch;
2916

2917
          @Getter
2918
          @Setter
2919
          @EqualsAndHashCode(callSuper = false)
2920
          public static class Filters extends StripeObject {
×
2921
            /**
2922
             * The account subcategories to use to filter for possible accounts to link. Valid
2923
             * subcategories are {@code checking} and {@code savings}.
2924
             */
2925
            @SerializedName("account_subcategories")
2926
            List<String> accountSubcategories;
2927

2928
            /** The institution to use to filter for possible accounts to link. */
2929
            @SerializedName("institution")
2930
            String institution;
2931
          }
2932
        }
2933
      }
2934
    }
2935
  }
2936

2937
  @Getter
2938
  @Setter
2939
  @EqualsAndHashCode(callSuper = false)
2940
  public static class Rendering extends StripeObject {
×
2941
    /** How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. */
2942
    @SerializedName("amount_tax_display")
2943
    String amountTaxDisplay;
2944

2945
    /** Invoice pdf rendering options. */
2946
    @SerializedName("pdf")
2947
    Pdf pdf;
2948

2949
    /** ID of the rendering template that the invoice is formatted by. */
2950
    @SerializedName("template")
2951
    String template;
2952

2953
    /** Version of the rendering template that the invoice is using. */
2954
    @SerializedName("template_version")
2955
    Long templateVersion;
2956

2957
    @Getter
2958
    @Setter
2959
    @EqualsAndHashCode(callSuper = false)
2960
    public static class Pdf extends StripeObject {
×
2961
      /**
2962
       * Page size of invoice pdf. Options include a4, letter, and auto. If set to auto, page size
2963
       * will be switched to a4 or letter based on customer locale.
2964
       *
2965
       * <p>One of {@code a4}, {@code auto}, or {@code letter}.
2966
       */
2967
      @SerializedName("page_size")
2968
      String pageSize;
2969
    }
2970
  }
2971

2972
  @Getter
2973
  @Setter
2974
  @EqualsAndHashCode(callSuper = false)
2975
  public static class ShippingCost extends StripeObject {
×
2976
    /** Total shipping cost before any taxes are applied. */
2977
    @SerializedName("amount_subtotal")
2978
    Long amountSubtotal;
2979

2980
    /** Total tax amount applied due to shipping costs. If no tax was applied, defaults to 0. */
2981
    @SerializedName("amount_tax")
2982
    Long amountTax;
2983

2984
    /** Total shipping cost after taxes are applied. */
2985
    @SerializedName("amount_total")
2986
    Long amountTotal;
2987

2988
    /** The ID of the ShippingRate for this invoice. */
2989
    @SerializedName("shipping_rate")
2990
    @Getter(lombok.AccessLevel.NONE)
2991
    @Setter(lombok.AccessLevel.NONE)
2992
    ExpandableField<ShippingRate> shippingRate;
2993

2994
    /** The taxes applied to the shipping rate. */
2995
    @SerializedName("taxes")
2996
    List<Invoice.ShippingCost.Tax> taxes;
2997

2998
    /** Get ID of expandable {@code shippingRate} object. */
2999
    public String getShippingRate() {
3000
      return (this.shippingRate != null) ? this.shippingRate.getId() : null;
×
3001
    }
3002

3003
    public void setShippingRate(String id) {
3004
      this.shippingRate = ApiResource.setExpandableFieldId(id, this.shippingRate);
×
3005
    }
×
3006

3007
    /** Get expanded {@code shippingRate}. */
3008
    public ShippingRate getShippingRateObject() {
3009
      return (this.shippingRate != null) ? this.shippingRate.getExpanded() : null;
×
3010
    }
3011

3012
    public void setShippingRateObject(ShippingRate expandableObject) {
3013
      this.shippingRate =
×
3014
          new ExpandableField<ShippingRate>(expandableObject.getId(), expandableObject);
×
3015
    }
×
3016

3017
    @Getter
3018
    @Setter
3019
    @EqualsAndHashCode(callSuper = false)
3020
    public static class Tax extends StripeObject {
×
3021
      /** Amount of tax applied for this rate. */
3022
      @SerializedName("amount")
3023
      Long amount;
3024

3025
      /**
3026
       * Tax rates can be applied to <a
3027
       * href="https://stripe.com/docs/billing/invoices/tax-rates">invoices</a>, <a
3028
       * href="https://stripe.com/docs/billing/subscriptions/taxes">subscriptions</a> and <a
3029
       * href="https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates">Checkout
3030
       * Sessions</a> to collect tax.
3031
       *
3032
       * <p>Related guide: <a href="https://stripe.com/docs/billing/taxes/tax-rates">Tax rates</a>
3033
       */
3034
      @SerializedName("rate")
3035
      TaxRate rate;
3036

3037
      /**
3038
       * The reasoning behind this tax, for example, if the product is tax exempt. The possible
3039
       * values for this field may be extended as new tax rules are supported.
3040
       *
3041
       * <p>One of {@code customer_exempt}, {@code not_collecting}, {@code not_subject_to_tax},
3042
       * {@code not_supported}, {@code portion_product_exempt}, {@code portion_reduced_rated},
3043
       * {@code portion_standard_rated}, {@code product_exempt}, {@code product_exempt_holiday},
3044
       * {@code proportionally_rated}, {@code reduced_rated}, {@code reverse_charge}, {@code
3045
       * standard_rated}, {@code taxable_basis_reduced}, or {@code zero_rated}.
3046
       */
3047
      @SerializedName("taxability_reason")
3048
      String taxabilityReason;
3049

3050
      /** The amount on which tax is calculated, in cents (or local equivalent). */
3051
      @SerializedName("taxable_amount")
3052
      Long taxableAmount;
3053
    }
3054
  }
3055

3056
  @Getter
3057
  @Setter
3058
  @EqualsAndHashCode(callSuper = false)
3059
  public static class StatusTransitions extends StripeObject {
1✔
3060
    /** The time that the invoice draft was finalized. */
3061
    @SerializedName("finalized_at")
3062
    Long finalizedAt;
3063

3064
    /** The time that the invoice was marked uncollectible. */
3065
    @SerializedName("marked_uncollectible_at")
3066
    Long markedUncollectibleAt;
3067

3068
    /** The time that the invoice was paid. */
3069
    @SerializedName("paid_at")
3070
    Long paidAt;
3071

3072
    /** The time that the invoice was voided. */
3073
    @SerializedName("voided_at")
3074
    Long voidedAt;
3075
  }
3076

3077
  @Getter
3078
  @Setter
3079
  @EqualsAndHashCode(callSuper = false)
3080
  public static class SubscriptionDetails extends StripeObject {
1✔
3081
    /**
3082
     * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> defined as
3083
     * subscription metadata when an invoice is created. Becomes an immutable snapshot of the
3084
     * subscription metadata at the time of invoice finalization. <em>Note: This attribute is
3085
     * populated only for invoices created on or after June 29, 2023.</em>
3086
     */
3087
    @SerializedName("metadata")
3088
    Map<String, String> metadata;
3089

3090
    /**
3091
     * If specified, payment collection for this subscription will be paused. Note that the
3092
     * subscription status will be unchanged and will not be updated to {@code paused}. Learn more
3093
     * about <a href="https://stripe.com/billing/subscriptions/pause-payment">pausing
3094
     * collection</a>.
3095
     */
3096
    @SerializedName("pause_collection")
3097
    PauseCollection pauseCollection;
3098

3099
    /**
3100
     * The Pause Collection settings determine how we will pause collection for this subscription
3101
     * and for how long the subscription should be paused.
3102
     */
3103
    @Getter
3104
    @Setter
3105
    @EqualsAndHashCode(callSuper = false)
3106
    public static class PauseCollection extends StripeObject {
×
3107
      /**
3108
       * The payment collection behavior for this subscription while paused. One of {@code
3109
       * keep_as_draft}, {@code mark_uncollectible}, or {@code void}.
3110
       */
3111
      @SerializedName("behavior")
3112
      String behavior;
3113

3114
      /** The time after which the subscription will resume collecting payments. */
3115
      @SerializedName("resumes_at")
3116
      Long resumesAt;
3117
    }
3118
  }
3119

3120
  @Getter
3121
  @Setter
3122
  @EqualsAndHashCode(callSuper = false)
3123
  public static class ThresholdReason extends StripeObject {
×
3124
    /** The total invoice amount threshold boundary if it triggered the threshold invoice. */
3125
    @SerializedName("amount_gte")
3126
    Long amountGte;
3127

3128
    /** Indicates which line items triggered a threshold invoice. */
3129
    @SerializedName("item_reasons")
3130
    List<Invoice.ThresholdReason.ItemReason> itemReasons;
3131

3132
    @Getter
3133
    @Setter
3134
    @EqualsAndHashCode(callSuper = false)
3135
    public static class ItemReason extends StripeObject {
×
3136
      /** The IDs of the line items that triggered the threshold invoice. */
3137
      @SerializedName("line_item_ids")
3138
      List<String> lineItemIds;
3139

3140
      /** The quantity threshold boundary that applied to the given line item. */
3141
      @SerializedName("usage_gte")
3142
      Long usageGte;
3143
    }
3144
  }
3145

3146
  @Getter
3147
  @Setter
3148
  @EqualsAndHashCode(callSuper = false)
3149
  public static class TotalDiscountAmount extends StripeObject {
×
3150
    /** The amount, in cents (or local equivalent), of the discount. */
3151
    @SerializedName("amount")
3152
    Long amount;
3153

3154
    /** The discount that was applied to get this discount amount. */
3155
    @SerializedName("discount")
3156
    @Getter(lombok.AccessLevel.NONE)
3157
    @Setter(lombok.AccessLevel.NONE)
3158
    ExpandableField<Discount> discount;
3159

3160
    /** Get ID of expandable {@code discount} object. */
3161
    public String getDiscount() {
3162
      return (this.discount != null) ? this.discount.getId() : null;
×
3163
    }
3164

3165
    public void setDiscount(String id) {
3166
      this.discount = ApiResource.setExpandableFieldId(id, this.discount);
×
3167
    }
×
3168

3169
    /** Get expanded {@code discount}. */
3170
    public Discount getDiscountObject() {
3171
      return (this.discount != null) ? this.discount.getExpanded() : null;
×
3172
    }
3173

3174
    public void setDiscountObject(Discount expandableObject) {
3175
      this.discount = new ExpandableField<Discount>(expandableObject.getId(), expandableObject);
×
3176
    }
×
3177
  }
3178

3179
  @Getter
3180
  @Setter
3181
  @EqualsAndHashCode(callSuper = false)
3182
  public static class TotalMarginAmount extends StripeObject {
×
3183
    /** The amount, in cents (or local equivalent), of the reduction in line item amount. */
3184
    @SerializedName("amount")
3185
    Long amount;
3186

3187
    /** The margin that was applied to get this margin amount. */
3188
    @SerializedName("margin")
3189
    @Getter(lombok.AccessLevel.NONE)
3190
    @Setter(lombok.AccessLevel.NONE)
3191
    ExpandableField<Margin> margin;
3192

3193
    /** Get ID of expandable {@code margin} object. */
3194
    public String getMargin() {
3195
      return (this.margin != null) ? this.margin.getId() : null;
×
3196
    }
3197

3198
    public void setMargin(String id) {
3199
      this.margin = ApiResource.setExpandableFieldId(id, this.margin);
×
3200
    }
×
3201

3202
    /** Get expanded {@code margin}. */
3203
    public Margin getMarginObject() {
3204
      return (this.margin != null) ? this.margin.getExpanded() : null;
×
3205
    }
3206

3207
    public void setMarginObject(Margin expandableObject) {
3208
      this.margin = new ExpandableField<Margin>(expandableObject.getId(), expandableObject);
×
3209
    }
×
3210
  }
3211

3212
  @Getter
3213
  @Setter
3214
  @EqualsAndHashCode(callSuper = false)
NEW
3215
  public static class TotalPretaxCreditAmount extends StripeObject {
×
3216
    /** The amount, in cents (or local equivalent), of the pretax credit amount. */
3217
    @SerializedName("amount")
3218
    Long amount;
3219

3220
    /** The credit balance transaction that was applied to get this pretax credit amount. */
3221
    @SerializedName("credit_balance_transaction")
3222
    @Getter(lombok.AccessLevel.NONE)
3223
    @Setter(lombok.AccessLevel.NONE)
3224
    ExpandableField<CreditBalanceTransaction> creditBalanceTransaction;
3225

3226
    /** The discount that was applied to get this pretax credit amount. */
3227
    @SerializedName("discount")
3228
    @Getter(lombok.AccessLevel.NONE)
3229
    @Setter(lombok.AccessLevel.NONE)
3230
    ExpandableField<Discount> discount;
3231

3232
    /** The margin that was applied to get this pretax credit amount. */
3233
    @SerializedName("margin")
3234
    @Getter(lombok.AccessLevel.NONE)
3235
    @Setter(lombok.AccessLevel.NONE)
3236
    ExpandableField<Margin> margin;
3237

3238
    /**
3239
     * Type of the pretax credit amount referenced.
3240
     *
3241
     * <p>One of {@code credit_balance_transaction}, {@code discount}, or {@code margin}.
3242
     */
3243
    @SerializedName("type")
3244
    String type;
3245

3246
    /** Get ID of expandable {@code creditBalanceTransaction} object. */
3247
    public String getCreditBalanceTransaction() {
NEW
3248
      return (this.creditBalanceTransaction != null) ? this.creditBalanceTransaction.getId() : null;
×
3249
    }
3250

3251
    public void setCreditBalanceTransaction(String id) {
NEW
3252
      this.creditBalanceTransaction =
×
NEW
3253
          ApiResource.setExpandableFieldId(id, this.creditBalanceTransaction);
×
NEW
3254
    }
×
3255

3256
    /** Get expanded {@code creditBalanceTransaction}. */
3257
    public CreditBalanceTransaction getCreditBalanceTransactionObject() {
NEW
3258
      return (this.creditBalanceTransaction != null)
×
NEW
3259
          ? this.creditBalanceTransaction.getExpanded()
×
NEW
3260
          : null;
×
3261
    }
3262

3263
    public void setCreditBalanceTransactionObject(CreditBalanceTransaction expandableObject) {
NEW
3264
      this.creditBalanceTransaction =
×
NEW
3265
          new ExpandableField<CreditBalanceTransaction>(expandableObject.getId(), expandableObject);
×
NEW
3266
    }
×
3267

3268
    /** Get ID of expandable {@code discount} object. */
3269
    public String getDiscount() {
NEW
3270
      return (this.discount != null) ? this.discount.getId() : null;
×
3271
    }
3272

3273
    public void setDiscount(String id) {
NEW
3274
      this.discount = ApiResource.setExpandableFieldId(id, this.discount);
×
NEW
3275
    }
×
3276

3277
    /** Get expanded {@code discount}. */
3278
    public Discount getDiscountObject() {
NEW
3279
      return (this.discount != null) ? this.discount.getExpanded() : null;
×
3280
    }
3281

3282
    public void setDiscountObject(Discount expandableObject) {
NEW
3283
      this.discount = new ExpandableField<Discount>(expandableObject.getId(), expandableObject);
×
NEW
3284
    }
×
3285

3286
    /** Get ID of expandable {@code margin} object. */
3287
    public String getMargin() {
NEW
3288
      return (this.margin != null) ? this.margin.getId() : null;
×
3289
    }
3290

3291
    public void setMargin(String id) {
NEW
3292
      this.margin = ApiResource.setExpandableFieldId(id, this.margin);
×
NEW
3293
    }
×
3294

3295
    /** Get expanded {@code margin}. */
3296
    public Margin getMarginObject() {
NEW
3297
      return (this.margin != null) ? this.margin.getExpanded() : null;
×
3298
    }
3299

3300
    public void setMarginObject(Margin expandableObject) {
NEW
3301
      this.margin = new ExpandableField<Margin>(expandableObject.getId(), expandableObject);
×
NEW
3302
    }
×
3303
  }
3304

3305
  @Getter
3306
  @Setter
3307
  @EqualsAndHashCode(callSuper = false)
3308
  public static class TotalTaxAmount extends StripeObject {
×
3309
    /** The amount, in cents (or local equivalent), of the tax. */
3310
    @SerializedName("amount")
3311
    Long amount;
3312

3313
    /** Whether this tax amount is inclusive or exclusive. */
3314
    @SerializedName("inclusive")
3315
    Boolean inclusive;
3316

3317
    /** The tax rate that was applied to get this tax amount. */
3318
    @SerializedName("tax_rate")
3319
    @Getter(lombok.AccessLevel.NONE)
3320
    @Setter(lombok.AccessLevel.NONE)
3321
    ExpandableField<TaxRate> taxRate;
3322

3323
    /**
3324
     * The reasoning behind this tax, for example, if the product is tax exempt. The possible values
3325
     * for this field may be extended as new tax rules are supported.
3326
     *
3327
     * <p>One of {@code customer_exempt}, {@code not_collecting}, {@code not_subject_to_tax}, {@code
3328
     * not_supported}, {@code portion_product_exempt}, {@code portion_reduced_rated}, {@code
3329
     * portion_standard_rated}, {@code product_exempt}, {@code product_exempt_holiday}, {@code
3330
     * proportionally_rated}, {@code reduced_rated}, {@code reverse_charge}, {@code standard_rated},
3331
     * {@code taxable_basis_reduced}, or {@code zero_rated}.
3332
     */
3333
    @SerializedName("taxability_reason")
3334
    String taxabilityReason;
3335

3336
    /** The amount on which tax is calculated, in cents (or local equivalent). */
3337
    @SerializedName("taxable_amount")
3338
    Long taxableAmount;
3339

3340
    /** Get ID of expandable {@code taxRate} object. */
3341
    public String getTaxRate() {
3342
      return (this.taxRate != null) ? this.taxRate.getId() : null;
×
3343
    }
3344

3345
    public void setTaxRate(String id) {
3346
      this.taxRate = ApiResource.setExpandableFieldId(id, this.taxRate);
×
3347
    }
×
3348

3349
    /** Get expanded {@code taxRate}. */
3350
    public TaxRate getTaxRateObject() {
3351
      return (this.taxRate != null) ? this.taxRate.getExpanded() : null;
×
3352
    }
3353

3354
    public void setTaxRateObject(TaxRate expandableObject) {
3355
      this.taxRate = new ExpandableField<TaxRate>(expandableObject.getId(), expandableObject);
×
3356
    }
×
3357
  }
3358

3359
  @Getter
3360
  @Setter
3361
  @EqualsAndHashCode(callSuper = false)
3362
  public static class TransferData extends StripeObject {
×
3363
    /**
3364
     * The amount in cents (or local equivalent) that will be transferred to the destination account
3365
     * when the invoice is paid. By default, the entire amount is transferred to the destination.
3366
     */
3367
    @SerializedName("amount")
3368
    Long amount;
3369

3370
    /** The account where funds from the payment will be transferred to upon payment success. */
3371
    @SerializedName("destination")
3372
    @Getter(lombok.AccessLevel.NONE)
3373
    @Setter(lombok.AccessLevel.NONE)
3374
    ExpandableField<Account> destination;
3375

3376
    /** Get ID of expandable {@code destination} object. */
3377
    public String getDestination() {
3378
      return (this.destination != null) ? this.destination.getId() : null;
×
3379
    }
3380

3381
    public void setDestination(String id) {
3382
      this.destination = ApiResource.setExpandableFieldId(id, this.destination);
×
3383
    }
×
3384

3385
    /** Get expanded {@code destination}. */
3386
    public Account getDestinationObject() {
3387
      return (this.destination != null) ? this.destination.getExpanded() : null;
×
3388
    }
3389

3390
    public void setDestinationObject(Account expandableObject) {
3391
      this.destination = new ExpandableField<Account>(expandableObject.getId(), expandableObject);
×
3392
    }
×
3393
  }
3394

3395
  @Override
3396
  public void setResponseGetter(StripeResponseGetter responseGetter) {
3397
    super.setResponseGetter(responseGetter);
1✔
3398
    trySetResponseGetter(application, responseGetter);
1✔
3399
    trySetResponseGetter(automaticTax, responseGetter);
1✔
3400
    trySetResponseGetter(charge, responseGetter);
1✔
3401
    trySetResponseGetter(customer, responseGetter);
1✔
3402
    trySetResponseGetter(customerAddress, responseGetter);
1✔
3403
    trySetResponseGetter(customerShipping, responseGetter);
1✔
3404
    trySetResponseGetter(defaultPaymentMethod, responseGetter);
1✔
3405
    trySetResponseGetter(defaultSource, responseGetter);
1✔
3406
    trySetResponseGetter(discount, responseGetter);
1✔
3407
    trySetResponseGetter(fromInvoice, responseGetter);
1✔
3408
    trySetResponseGetter(issuer, responseGetter);
1✔
3409
    trySetResponseGetter(lastFinalizationError, responseGetter);
1✔
3410
    trySetResponseGetter(latestRevision, responseGetter);
1✔
3411
    trySetResponseGetter(lines, responseGetter);
1✔
3412
    trySetResponseGetter(onBehalfOf, responseGetter);
1✔
3413
    trySetResponseGetter(paymentIntent, responseGetter);
1✔
3414
    trySetResponseGetter(paymentSettings, responseGetter);
1✔
3415
    trySetResponseGetter(payments, responseGetter);
1✔
3416
    trySetResponseGetter(quote, responseGetter);
1✔
3417
    trySetResponseGetter(rendering, responseGetter);
1✔
3418
    trySetResponseGetter(shippingCost, responseGetter);
1✔
3419
    trySetResponseGetter(shippingDetails, responseGetter);
1✔
3420
    trySetResponseGetter(statusTransitions, responseGetter);
1✔
3421
    trySetResponseGetter(subscription, responseGetter);
1✔
3422
    trySetResponseGetter(subscriptionDetails, responseGetter);
1✔
3423
    trySetResponseGetter(testClock, responseGetter);
1✔
3424
    trySetResponseGetter(thresholdReason, responseGetter);
1✔
3425
    trySetResponseGetter(transferData, responseGetter);
1✔
3426
  }
1✔
3427
}
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