File Coverage

lib/Net/API/Stripe/Billing/Invoice.pm
Criterion Covered Total %
statement 19 100 19.0
branch n/a
condition n/a
subroutine 7 88 7.9
pod 77 81 95.0
total 103 269 38.2


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Billing/Invoice.pm
3             ## Version v0.101.1
4             ## Copyright(c) 2020 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2020/11/20
8             ## All rights reserved
9             ##
10             ## This program is free software; you can redistribute it and/or modify it
11             ## under the same terms as Perl itself.
12             ##----------------------------------------------------------------------------
13             ## https://stripe.com/docs/api/invoices/object
14             BEGIN
15             {
16             use strict;
17 2     2   24101333 use warnings;
  2         12  
  2         76  
18 2     2   11 use parent qw( Net::API::Stripe::Generic );
  2         4  
  2         59  
19 2     2   10 use vars qw( $VERSION );
  2         4  
  2         10  
20 2     2   181 our( $VERSION ) = 'v0.101.1';
  2         3  
  2         125  
21 2     2   40 };
22              
23             use strict;
24 2     2   12 use warnings;
  2         4  
  2         37  
25 2     2   15  
  2         5  
  2         2970  
26              
27 0     0 1    
28              
29 0     0 1    
30              
31 0     0 1    
32              
33 0     0 1    
34              
35 0     0 1   ## 2019-03-14: Stripe renamed this to application_fee
36             # sub application_fee { return( shift->_set_get_number( 'application_fee', @_ ) ); }
37 0     0 1    
38              
39 0     0 1    
40              
41 0     0 1    
42             {
43 0     0 1   enabled => { type => 'boolean' },
44             status => { type => 'string' },
45             }, @_ ) ); }
46              
47 0     0 0    
48              
49 0     0 1    
50              
51 0     0 1    
52              
53 0     0 1    
54              
55 0     0 1    
56              
57 0     0 1    
58              
59              
60              
61              
62              
63 0     0 1    
64              
65 0     0 1    
66              
67 0     0 1    
68              
69 0     0 0    
70              
71 0     0 1    
72              
73 0     0 1    
74             ## Not used anymore? It's not on the API documentation
75 0     0 1    
76              
77 0     0 1    
78             {
79 0     0 1   code => { type => "scalar" },
80             doc_url => { type => "scalar" },
81 0     0 1   message => { type => "scalar" },
82             param => { type => "scalar" },
83 0     0 1   payment_method_type => { type => "scalar" },
84             type => { type => "scalar" },
85 0     0 1   }, @_ ) ); }
86              
87 0     0 1    
88              
89 0     0 1    
90              
91 0     0 1    
92              
93 0     0 1    
94              
95 0     0 1    
96              
97 0     0 1    
98              
99 0     0 1    
100              
101 0     0 1    
102              
103 0     0 1   {
104             amount_tax_display => { type => 'string' },
105 0     0 1   }, @_ ) ); }
106              
107 0     0 1    
108              
109 0     0 1    
110              
111 0     0 1    
112              
113 0     0 1    
114              
115 0     0 1    
116             # Does not seem to exist anymore in the API documentation...
117              
118 0     0 0    
119              
120 0     0 1    
121             {
122 0     0 1   return( shift->_set_get_class_array( 'total_discount_amounts',
123             {
124 0     0 1   amount => { type => 'number' },
125             discount => { type => 'object', class => 'Net::API::Stripe::Billing::Discount' },
126             }, @_ ) );
127             }
128              
129              
130              
131             amount => { type => "number" },
132             destination => { type => "scalar" },
133             }, @_ ) ); }
134 0     0 1    
135              
136 0     0 1   1;
137              
138 0     0 1    
139             =encoding utf8
140 0     0 1    
141             =head1 NAME
142 0     0 1    
143             Net::API::Stripe::Billing::Invoice - A Stripe Invoice
144 0     0 1    
145             =head1 SYNOPSIS
146 0     0 1    
147             my $stripe = Net::API::Stripe->new( conf_file => './settings.json', expand => 'all' ) || die( Net::API::Stripe->error );
148 0     0 1   my $inv = $stripe->invoices( create =>
149             {
150 0     0 1   account_country => 'jp',
151             account_name => 'John Doe',
152 0     0 1   amount_due => 2000,
153             amount_paid => 500,
154 0     0 1   amount_remaining => 1500
155             billing => 'charge_automatically',
156 0     0 1   charge => 'ch_fake123456789',
157             currency => 'jpy',
158 0     0 1   customer => $customer_object,
159             customer_address => $stripe->address({
160 0     0 1   line1 => '1-2-3 Sugamo, Bukyo-ku',
161             line2 => 'Taro Bldg'.
162 0     0 1   city => 'Tokyo',
163             postal_code => '123-4567',
164 0     0 1   country => 'jp',
165             }),
166 0     0 1   customer_email => 'john.doe@example.com',
167             customer_name => 'John Doe',
168             description => 'Invoice for professional services',
169             due_date => '2020-04-01',
170             }) || die( $stripe->error );
171 0     0 1    
172             =head1 VERSION
173 0     0 1    
174             v0.101.1
175 0     0 1    
176             =head1 DESCRIPTION
177 0     0 1    
178             Invoices are statements of amounts owed by a customer, and are either generated one-off, or generated periodically from a subscription.
179 0     0 1    
180             They contain invoice items (L<Net::API::Stripe::Billing::Invoice::Item> / L<https://stripe.com/docs/api/invoices#invoiceitems>), and proration adjustments that may be caused by subscription upgrades/downgrades (if necessary).
181 0     0 1    
182             If your invoice is configured to be billed through automatic charges, Stripe automatically finalizes your invoice and attempts payment. Note that finalizing the invoice, when automatic (L<https://stripe.com/docs/billing/invoices/workflow/#auto_advance>), does not happen immediately as the invoice is created. Stripe waits until one hour after the last webhook was successfully sent (or the last webhook timed out after failing). If you (and the platforms you may have connected to) have no webhooks configured, Stripe waits one hour after creation to finalize the invoice.
183 0     0 1    
184             If your invoice is configured to be billed by sending an email, then based on your email settings, Stripe will email the invoice to your customer and await payment. These emails can contain a link to a hosted page to pay the invoice.
185 0     0 1    
186             Stripe applies any customer credit on the account before determining the amount due for the invoice (i.e., the amount that will be actually charged). If the amount due for the invoice is less than L<Stripe's minimum allowed charge per currency|https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts>, the invoice is automatically marked paid, and Stripe adds the amount due to the customer's running account balance which is applied to the next invoice.
187 0     0 1    
188             More details on the customer's account balance are L<here|https://stripe.com/docs/api/customers/object#customer_object-account_balance>.
189              
190 0     0 0   =head1 CONSTRUCTOR
191              
192 0     0 1   =head2 new
193              
194 0     0 1   Provided with an hash of key-value properties and this creates a new L<Net::API::Stripe::Billing::Invoice> object.
195              
196 0     0 1   =head1 METHODS
197              
198             =head2 id string
199              
200 0     0 1   Unique identifier for the object.
201              
202             =head2 object string, value is "invoice"
203              
204             String representing the object’s type. Objects of the same type share the same value.
205              
206             =head2 account_country string
207 0     0 1    
208             The country of the business associated with this invoice, most often the business creating the invoice.
209 0     0 1    
210             =head2 account_name string
211 0     0 1    
212             The public name of the business associated with this invoice, most often the business creating the invoice.
213              
214             =head2 account_tax_ids array containing strings expandable
215              
216 0     0 1   The account tax IDs associated with the invoice. Only editable when the invoice is a draft.
217              
218             When expanded, this contains an array of L<Net::API::Stripe::Billing::TaxID> objects.
219              
220             =head2 amount_due integer
221              
222             Final amount due at this time for this invoice. If the invoice’s total is smaller than the minimum charge amount, for example, or if there is account credit that can be applied to the invoice, the amount_due may be 0. If there is a positive starting_balance for the invoice (the customer owes money), the amount_due will also take that into account. The charge that gets generated for the invoice will be for the amount specified in amount_due.
223              
224             =head2 amount_paid integer
225              
226             The amount, in JPY, that was paid.
227              
228             =head2 amount_remaining integer
229              
230             The amount remaining, in JPY, that is due.
231              
232             =head2 application
233              
234             Expandable.
235              
236             Set or gets an L<Net::API::Stripe::Connect::Account> object or id.
237              
238             ID of the Connect Application that created the invoice.
239              
240             =head2 application_fee_amount integer
241              
242             The fee in JPY that will be applied to the invoice and transferred to the application owner’s Stripe account when the invoice is paid.
243              
244             =head2 attempt_count positive integer or zero
245              
246             Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count. In other words, manual payment attempts after the first attempt do not affect the retry schedule.
247              
248             =head2 attempted boolean
249              
250             Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the invoice.created webhook, for example, so you might not want to display that invoice as unpaid to your users.
251              
252             =head2 auto_advance boolean
253              
254             Controls whether Stripe will perform automatic collection of the invoice. When false, the invoice’s state will not automatically advance without an explicit action.
255              
256             =head2 automatic_tax hash
257              
258             Settings and latest results for automatic tax lookup for this invoice.
259              
260             =over 4
261              
262             =item * C<enabled> boolean
263              
264             Whether Stripe automatically computes tax on this invoice. Note that incompatible invoice items (invoice items with manually specified tax rates, negative amounts, or tax_behavior=unspecified) cannot be added to automatic tax invoices.
265              
266             =item * C<status> enum
267              
268             The status of the most recent automated tax calculation for this invoice.
269              
270             Possible enum values
271              
272             =over 8
273              
274             =item * C<requires_location_inputs>
275              
276             The location details supplied on the customer aren’t valid or don’t provide enough location information to accurately determine tax rates for the customer.
277              
278             =item * C<complete>
279              
280             Stripe successfully calculated tax automatically on this invoice.
281              
282             =item * C<failed>
283              
284             The Stripe Tax service failed, please try again later.
285              
286             =back
287              
288             =back
289              
290             =head2 billing string
291              
292             This is an undocumented property, but that appears in Stripe's own API object example. It contains C<charge_automatically>
293              
294             =head2 billing_reason string
295              
296             Indicates the reason why the invoice was created. subscription_cycle indicates an invoice created by a subscription advancing into a new period. subscription_create indicates an invoice created due to creating a subscription. subscription_update indicates an invoice created due to updating a subscription. subscription is set for all old invoices to indicate either a change to a subscription or a period advancement. manual is set for all invoices unrelated to a subscription (for example: created via the invoice editor). The upcoming value is reserved for simulated invoices per the upcoming invoice endpoint. subscription_threshold indicates an invoice created due to a billing threshold being reached.
297              
298             =head2 charge string (expandable)
299              
300             ID of the latest charge generated for this invoice, if any. When expanded, this is a L<Net::API::Stripe::Charge> object.
301              
302             =head2 collection_method string
303              
304             Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions.
305              
306             =head2 created timestamp
307              
308             Time at which the object was created. Measured in seconds since the Unix epoch.
309              
310             =head2 currency currency
311              
312             Three-letter ISO currency code, in lowercase. Must be a supported currency.
313              
314             =head2 custom_fields array of hashes
315              
316             Custom fields displayed on the invoice. This is an array of L<Net::API::Stripe::CustomField> objects.
317              
318             =over 4
319              
320             =item * <name>
321              
322             The name of the custom field.
323              
324             =item * <value>
325              
326             The value of the custom field.
327              
328             =back
329              
330             =head2 customer string (expandable)
331              
332             This is a Stripe Customer id, or when expanded, this is a L<Net::API::Stripe::Customer> object.
333              
334             =head2 customer_address hash
335              
336             The customer’s address. Until the invoice is finalized, this field will equal customer.address. Once the invoice is finalised, this field will no longer be updated.
337              
338             This is a L<Net::API::Stripe::Address> object.
339              
340             =head2 customer_email string
341              
342             The customer’s email. Until the invoice is finalized, this field will equal customer.email. Once the invoice is finalised, this field will no longer be updated.
343              
344             =head2 customer_name string
345              
346             The customer’s name. Until the invoice is finalized, this field will equal customer.name. Once the invoice is finalized, this field will no longer be updated.
347              
348             =head2 customer_phone string
349              
350             The customer’s phone number. Until the invoice is finalized, this field will equal customer.phone. Once the invoice is finalized, this field will no longer be updated.
351              
352             =head2 customer_shipping hash
353              
354             The customer’s shipping information. Until the invoice is finalized, this field will equal customer.shipping. Once the invoice is finalized, this field will no longer be updated.
355              
356             This is a L<Net::API::Stripe::Shipping> object.
357              
358             =head2 customer_tax_exempt string
359              
360             The customer’s tax exempt status. Until the invoice is finalized, this field will equal customer.tax_exempt. Once the invoice is finalized, this field will no longer be updated.
361              
362             =head2 customer_tax_ids array of hashes
363              
364             The customer’s tax IDs. Until the invoice is finalized, this field will contain the same tax IDs as customer.tax_ids. Once the invoice is finalized, this field will no longer be updated.
365              
366             This is a L<Net::API::Stripe::Customer::TaxIds> object.
367              
368             =head2 default_payment_method string (expandable)
369              
370             ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription’s default payment method, if any, or to the default payment method in the customer’s invoice settings.
371              
372             When expanded, this is a L<Net::API::Stripe::Payment::Method> object.
373              
374             =head2 default_source string (expandable)
375              
376             ID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription’s default source, if any, or to the customer’s default source.
377              
378             When expanded, this is a L<Net::API::Stripe::Payment::Source> object.
379              
380             =head2 default_tax_rates array of hashes
381              
382             The tax rates applied to this invoice, if any.
383              
384             This is an array of L<Net::API::Stripe::Tax::Rate> object.
385              
386             =head2 description string
387              
388             An arbitrary string attached to the object. Often useful for displaying to users. Referenced as ‘memo’ in the Dashboard.
389              
390             =head2 discount hash, discount object
391              
392             This is a L<Net::API::Stripe::Billing::Discount> object
393              
394             =head2 discounts expandable
395              
396             The discounts applied to the invoice. Line item discounts are applied before invoice discounts. Use `expand[]=discounts` to expand each discount.
397              
398             When expanded this is an L<Net::API::Stripe::Billing::Discount> object.
399              
400             =head2 due_date timestamp
401              
402             The date on which payment for this invoice is due. This value will be null for invoices where collection_method=charge_automatically.
403              
404             =head2 ending_balance integer
405              
406             Ending customer balance after the invoice is finalized. Invoices are finalized approximately an hour after successful webhook delivery or when payment collection is attempted for the invoice. If the invoice has not been finalized yet, this will be null.
407              
408             =head2 footer string
409              
410             Footer displayed on the invoice.
411              
412             =head2 forgiven boolean
413              
414             Boolean value defining if the invoice was paid.
415              
416             Not part of the Stripe documentation anymore but present in data returned.
417              
418             =head2 hosted_invoice_url string
419              
420             The URL for the hosted invoice page, which allows customers to view and pay an invoice. If the invoice has not been finalized yet, this will be null.
421              
422             =head2 invoice_pdf string
423              
424             The link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null.
425              
426             =head2 last_finalization_error hash
427              
428             The error encountered during the previous attempt to finalize the invoice. This field is cleared when the invoice is successfully finalized.
429              
430             It has the following properties:
431              
432             =over 4
433              
434             =item I<code> string
435              
436             For some errors that could be handled programmatically, a short string indicating the [error code](/docs/error-codes) reported.
437              
438             =item I<doc_url> string
439              
440             A URL to more information about the [error code](/docs/error-codes) reported.
441              
442             =item I<message> string
443              
444             A human-readable message providing more details about the error. For card errors, these messages can be shown to your users.
445              
446             =item I<param> string
447              
448             If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field.
449              
450             =item I<payment_method_type> string
451              
452             If the error is specific to the type of payment method, the payment method type that had a problem. This field is only populated for invoice-related errors.
453              
454             =item I<type> string
455              
456             The type of error returned. One of C<api_connection_error>, C<api_error>, C<authentication_error>, C<card_error>, C<idempotency_error>, C<invalid_request_error>, or C<rate_limit_error>
457              
458             =back
459              
460             =head2 lines list
461              
462             The individual line items that make up the invoice. lines is sorted as follows: invoice items in reverse chronological order, followed by the subscription, if any.
463              
464             This is a L<Net::API::Stripe::Billing::Invoice::Lines> object.
465              
466             =head2 livemode boolean
467              
468             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
469              
470             =head2 metadata hash
471              
472             Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
473              
474             =head2 next_payment_attempt timestamp
475              
476             The time at which payment will next be attempted. This value will be null for invoices where collection_method=send_invoice.
477              
478             =head2 number string
479              
480             A unique, identifying string that appears on emails sent to the customer for this invoice. This starts with the customer’s unique invoice_prefix if it is specified.
481              
482             =head2 on_behalf_of
483              
484             Expandable
485              
486             Sets or gets an L<Net::API::Stripe::Connect::Account> object or id.
487              
488             =head2 paid boolean
489              
490             Whether payment was successfully collected for this invoice. An invoice can be paid (most commonly) with a charge or with credit from the customer’s account balance.
491              
492             =head2 paid_out_of_band boolean
493              
494             Returns true if the invoice was manually marked paid, returns false if the invoice hasn’t been paid yet or was paid on Stripe.
495              
496             =head2 payment_intent string (expandable)
497              
498             The PaymentIntent associated with this invoice. The PaymentIntent is generated when the invoice is finalized, and can then be used to pay the invoice. Note that voiding an invoice will cancel the PaymentIntent.
499              
500             When expanded, this is a L<Net::API::Stripe::Payment::Intent> object.
501              
502             =head2 payment_settings hash
503              
504             Sets or gets a L<Net::API::Stripe::Payment::Settings> object.
505              
506             =head2 period_end timestamp
507              
508             End of the usage period during which invoice items were added to this invoice.
509              
510             =head2 period_start timestamp
511              
512             Start of the usage period during which invoice items were added to this invoice.
513              
514             =head2 post_payment_credit_notes_amount integer
515              
516             Total amount of all post-payment credit notes issued for this invoice.
517              
518             =head2 pre_payment_credit_notes_amount integer
519              
520             Total amount of all pre-payment credit notes issued for this invoice.
521              
522             =head2 quote
523              
524             Expandable.
525              
526             Sets or gets a L<Net::API::Stripe::Billing::Quote> object or id.
527              
528             =head2 receipt_number string
529              
530             This is the transaction number that appears on email receipts sent for this invoice.
531              
532             =head2 rendering_options hash
533              
534             Options for invoice PDF rendering.
535              
536             =over 4
537              
538             =item * C<amount_tax_display> string
539              
540             How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
541              
542             =back
543              
544             =head2 starting_balance integer
545              
546             Starting customer balance before the invoice is finalized. If the invoice has not been finalized yet, this will be the current customer balance.
547              
548             =head2 statement_descriptor string
549              
550             Extra information about an invoice for the customer’s credit card statement.
551              
552             =head2 status string
553              
554             The status of the invoice, one of draft, open, paid, uncollectible, or void. Learn more
555              
556             =head2 status_transitions hash
557              
558             This is a L<Net::API::Stripe::Billing::Invoice::StatusTransition> object.
559              
560             =head2 subscription string (expandable)
561              
562             The subscription that this invoice was prepared for, if any. When expanded, this is a L<Net::API::Stripe::Billing::Subscription> object.
563              
564             =head2 subscription_proration_date integer
565              
566             Only set for upcoming invoices that preview prorations. The time used to calculate prorations.
567              
568             =head2 subtotal integer
569              
570             Total of all subscriptions, invoice items, and prorations on the invoice before any discount or tax is applied.
571              
572             =head2 subtotal_excluding_tax integer
573              
574             The integer amount in JPY representing the subtotal of the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated
575              
576             =head2 tax integer
577              
578             The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice.
579              
580             =head2 test_clock string
581              
582             Expandable
583              
584             Sets or gets the L<Net::API::Stripe::Billing::TestClock> object or ID of the test clock this invoice belongs to.
585              
586             =head2 threshold_reason hash
587              
588             If billing_reason is set to subscription_threshold this returns more information on which threshold rules triggered the invoice.
589              
590             =over 4
591              
592             =item * C<amount_gte> integer
593              
594             The total invoice amount threshold boundary if it triggered the threshold invoice.
595              
596             =item * C<item_reasons> array of hashes
597              
598             Indicates which line items triggered a threshold invoice.
599              
600             =over 8
601              
602             =item * C<line_item_ids> array containing strings
603              
604             The IDs of the line items that triggered the threshold invoice.
605              
606             =item * C<usage_gte> integer
607              
608             The quantity threshold boundary that applied to the given line item.
609              
610             =back
611              
612             =back
613              
614             =head2 total integer
615              
616             Total after discounts and taxes.
617              
618             =head2 total_discount_amounts array of hashes
619              
620             The aggregate amounts calculated per discount across all line items.
621              
622             =over 4
623              
624             =item * C<amount> integer
625              
626             The amount, in JPY, of the discount.
627              
628             =item * C<discount> string
629              
630             Expandable
631              
632             The discount that was applied to get this discount amount.
633              
634             =back
635              
636             =head2 total_excluding_tax integer
637              
638             The integer amount in JPY representing the total amount of the invoice including all discounts but excluding all tax.
639              
640             Properties are:
641              
642             =over 4
643              
644             =item I<amount> integer
645              
646             The amount, in JPY, of the discount.
647              
648             =item I<discount> string expandable
649              
650             The discount that was applied to get this discount amount.
651              
652             =back
653              
654             =head2 total_tax_amounts array of hashes
655              
656             The aggregate amounts calculated per tax rate for all line items.
657              
658             This is an array of L<Net::API::Stripe::Billing::Invoice::TaxAmount> objects.
659              
660             =head2 transfer_data hash
661              
662             The account (if any) the payment will be attributed to for tax reporting, and where funds from the payment will be transferred to for the invoice.
663              
664             It has the following properties:
665              
666             =over 4
667              
668             =item I<amount> integer
669              
670             The amount in JPY that will be transferred to the destination account when the invoice is paid. By default, the entire amount is transferred to the destination.
671              
672             =item I<destination> string
673              
674             The account where funds from the payment will be transferred to upon payment success.
675              
676             =back
677              
678             =head2 webhooks_delivered_at timestamp
679              
680             The time at which webhooks for this invoice were successfully delivered (if the invoice had no webhooks to deliver, this will match created). Invoice payment is delayed until webhooks are delivered, or until all webhook delivery attempts have been exhausted.
681              
682             =head1 API SAMPLE
683              
684             {
685             "id": "in_fake1234567890",
686             "object": "invoice",
687             "account_country": "JP",
688             "account_name": "Angels, Inc",
689             "account_tax_ids": null,
690             "amount_due": 5300,
691             "amount_paid": 0,
692             "amount_remaining": 5300,
693             "application": null,
694             "application_fee_amount": null,
695             "attempt_count": 0,
696             "attempted": false,
697             "auto_advance": true,
698             "automatic_tax": {
699             "enabled": false,
700             "status": null
701             },
702             "billing_reason": "manual",
703             "charge": null,
704             "collection_method": "charge_automatically",
705             "created": 1657660441,
706             "currency": "jpy",
707             "custom_fields": null,
708             "customer": "cus_fake123456789990",
709             "customer_address": null,
710             "customer_email": null,
711             "customer_name": null,
712             "customer_phone": null,
713             "customer_shipping": null,
714             "customer_tax_exempt": "none",
715             "customer_tax_ids": [],
716             "default_payment_method": null,
717             "default_source": null,
718             "default_tax_rates": [],
719             "description": null,
720             "discount": null,
721             "discounts": [],
722             "due_date": null,
723             "ending_balance": null,
724             "footer": null,
725             "hosted_invoice_url": null,
726             "invoice_pdf": null,
727             "last_finalization_error": null,
728             "lines": {
729             "object": "list",
730             "data": [
731             {
732             "id": "il_fake1234567890",
733             "object": "line_item",
734             "amount": 5300,
735             "amount_excluding_tax": 5300,
736             "currency": "jpy",
737             "description": "My First Invoice Item (created for API docs)",
738             "discount_amounts": [],
739             "discountable": true,
740             "discounts": [],
741             "invoice_item": "ii_fake1234567890",
742             "livemode": false,
743             "metadata": {},
744             "period": {
745             "end": 1657660440,
746             "start": 1657660440
747             },
748             "price": {
749             "id": "price_fake1234567890",
750             "object": "price",
751             "active": true,
752             "billing_scheme": "per_unit",
753             "created": 1649731261,
754             "currency": "jpy",
755             "custom_unit_amount": null,
756             "livemode": false,
757             "lookup_key": null,
758             "metadata": {},
759             "nickname": null,
760             "product": "prod_fake1234567890",
761             "recurring": null,
762             "tax_behavior": "unspecified",
763             "tiers_mode": null,
764             "transform_quantity": null,
765             "type": "one_time",
766             "unit_amount": 5300,
767             "unit_amount_decimal": "5300"
768             },
769             "proration": false,
770             "proration_details": {
771             "credited_items": null
772             },
773             "quantity": 1,
774             "subscription": null,
775             "tax_amounts": [],
776             "tax_rates": [],
777             "type": "invoiceitem",
778             "unit_amount_excluding_tax": "5300"
779             }
780             ],
781             "has_more": false,
782             "url": "/v1/invoices/in_fake1234567890/lines"
783             },
784             "livemode": false,
785             "metadata": {},
786             "next_payment_attempt": 1657664041,
787             "number": null,
788             "on_behalf_of": null,
789             "paid": false,
790             "paid_out_of_band": false,
791             "payment_intent": null,
792             "payment_settings": {
793             "payment_method_options": null,
794             "payment_method_types": null
795             },
796             "period_end": 1657660440,
797             "period_start": 1657660440,
798             "post_payment_credit_notes_amount": 0,
799             "pre_payment_credit_notes_amount": 0,
800             "quote": null,
801             "receipt_number": null,
802             "rendering_options": null,
803             "starting_balance": 0,
804             "statement_descriptor": null,
805             "status": "draft",
806             "status_transitions": {
807             "finalized_at": null,
808             "marked_uncollectible_at": null,
809             "paid_at": null,
810             "voided_at": null
811             },
812             "subscription": null,
813             "subtotal": 5300,
814             "subtotal_excluding_tax": 5300,
815             "tax": null,
816             "test_clock": null,
817             "total": 5300,
818             "total_discount_amounts": [],
819             "total_excluding_tax": 5300,
820             "total_tax_amounts": [],
821             "transfer_data": null,
822             "webhooks_delivered_at": null
823             }
824              
825             =head1 HISTORY
826              
827             =head2 v0.1
828              
829             Initial version
830              
831             =head1 STRIPE HISTORY
832              
833             =head2 2019-12-03
834              
835             Customer balances applied to all invoices are now debited or credited back to the customer when voided. Earlier, applied customer balances were not returned back to the customer and were consumed.
836              
837             =over 4
838              
839             =item * To achieve this behavior in earlier API versions:
840              
841             =over 8
842              
843             =item * Set consume_applied_balance to false when voiding invoices in /v1/invoices/:id/void.
844              
845             =item * Set invoice_customer_balance_settings[consume_applied_balance_on_void] to false in /v1/subscriptions create or update to force this behavior for Invoices voided by a Subscription.
846              
847             =item * Set subscription_data[invoice_customer_balance_settings][consume_applied_balance_on_void] to false in /v1/checkout/sessions create to force this behavior for Invoices voided by Subscriptions created with Checkout.
848              
849             =back
850              
851             =back
852              
853             =head2 2019-03-14
854              
855             There are a few changes to the invoice object:
856              
857             =over 4
858              
859             =item * A I<status_transitions> hash now contains the timestamps when an invoice was finalized, paid, marked uncollectible, or voided.
860              
861             =item * The I<date> property has been renamed to created.
862              
863             =item * The I<finalized_at> property has been moved into the I<status_transitions> hash.
864              
865             =back
866              
867             =head2 2018-11-08
868              
869             The I<closed> property on the invoice object controls automatic collection. I<closed> has been deprecated in favor of the more specific I<auto_advance> field. Where you might have set I<closed=true> on invoices in the past, set I<auto_advance=false>.
870              
871             =head2 2018-11-08
872              
873             Instead of checking the I<forgiven> field on an invoice, check for the I<uncollectible> status.
874              
875             Instead of setting the I<forgiven> field on an invoice, mark it as uncollectible.
876              
877             =head2 2022-08-27
878              
879             Stripe has removed L</tax_percent> from objects and requests in favor of L<tax rates|https://stripe.com/docs/api/tax_rates>.
880              
881             =head2 2022-07-12
882              
883             The following methods were added by Stripe:
884              
885             =over 4
886              
887             =item * L</application>
888              
889             =item * L</automatic_tax>
890              
891             =item * L</on_behalf_of>
892              
893             =item * L</paid_out_of_band>
894              
895             =item * L</payment_settings>
896              
897             =item * L</quote>
898              
899             =item * L</rendering_options>
900              
901             =item * L</subtotal_excluding_tax>
902              
903             =item * L</test_clock>
904              
905             =item * L</total_excluding_tax>
906              
907             =back
908              
909             =head1 AUTHOR
910              
911             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
912              
913             =head1 SEE ALSO
914              
915             Stripe API documentation:
916              
917             L<https://stripe.com/docs/api/invoices>, L<https://stripe.com/docs/billing/invoices/sending>
918              
919             =head1 COPYRIGHT & LICENSE
920              
921             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
922              
923             You can use, copy, modify and redistribute this package and associated
924             files under the same terms as Perl itself.
925              
926             =cut