File Coverage

blib/lib/Net/API/Stripe/Billing/Invoice.pm
Criterion Covered Total %
statement 7 73 9.5
branch n/a
condition n/a
subroutine 3 69 4.3
pod 62 66 93.9
total 72 208 34.6


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Billing/Invoice.pm
3             ## Version v0.100.0
4             ## Copyright(c) 2019 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <@sitael.tokyo.deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2020/05/15
8             ##
9             ##----------------------------------------------------------------------------
10             ## https://stripe.com/docs/api/invoices/object
11             package Net::API::Stripe::Billing::Invoice;
12             BEGIN
13             {
14 1     1   873 use strict;
  1         2  
  1         29  
15 1     1   4 use parent qw( Net::API::Stripe::Generic );
  1         2  
  1         4  
16 1     1   910 our( $VERSION ) = 'v0.100.0';
17             };
18              
19 0     0 1   sub id { shift->_set_get_scalar( 'id', @_ ); }
20              
21 0     0 1   sub object { shift->_set_get_scalar( 'object', @_ ); }
22              
23 0     0 1   sub account_country { return( shift->_set_get_scalar( 'account_country', @_ ) ); }
24              
25 0     0 1   sub account_name { return( shift->_set_get_scalar( 'account_name', @_ ) ); }
26              
27 0     0 1   sub amount_due { shift->_set_get_number( 'amount_due', @_ ); }
28              
29 0     0 1   sub amount_paid { shift->_set_get_number( 'amount_paid', @_ ); }
30              
31 0     0 1   sub amount_remaining { shift->_set_get_number( 'amount_remaining', @_ ); }
32              
33             ## 2019-03-14: Stripe renamed this to application_fee
34             # sub application_fee { shift->_set_get_number( 'application_fee', @_ ); }
35 0     0 0   sub application_fee { return( shift->application_fee_amount( @_ ) ); }
36              
37 0     0 1   sub application_fee_amount { return( shift->_set_get_number( 'application_fee_amount', @_ ) ); }
38              
39 0     0 1   sub attempt_count { shift->_set_get_scalar( 'attempt_count', @_ ); }
40              
41 0     0 1   sub attempted { shift->_set_get_boolean( 'attempted', @_ ); }
42              
43 0     0 1   sub auto_advance { shift->_set_get_boolean( 'auto_advance', @_ ); }
44              
45 0     0 1   sub billing { shift->_set_get_scalar( 'billing', @_ ); }
46              
47 0     0 1   sub billing_reason { shift->_set_get_scalar( 'billing_reason', @_ ); }
48              
49 0     0 1   sub charge { shift->_set_get_scalar_or_object( 'charge', 'Net::API::Stripe::Charge', @_ ); }
50              
51 0     0 0   sub closed { shift->_set_get_scalar( 'closed', @_ ); }
52              
53 0     0 1   sub collection_method { shift->_set_get_scalar( 'collection_method', @_ ); }
54              
55 0     0 1   sub created { shift->_set_get_datetime( 'created', @_ ); }
56              
57 0     0 1   sub currency { shift->_set_get_scalar( 'currency', @_ ); }
58              
59 0     0 1   sub custom_fields { return( shift->_set_get_object_array( 'custom_fields', 'Net::API::Stripe::CustomField', @_ ) ); }
60              
61 0     0 1   sub customer { shift->_set_get_scalar_or_object( 'customer', 'Net::API::Stripe::Customer', @_ ); }
62              
63 0     0 1   sub customer_address { return( shift->_set_get_object( 'customer_address', 'Net::API::Stripe::Address', @_ ) ); }
64              
65 0     0 1   sub customer_email { return( shift->_set_get_scalar( 'customer_email', @_ ) ); }
66              
67 0     0 1   sub customer_name { return( shift->_set_get_scalar( 'customer_name', @_ ) ); }
68              
69 0     0 1   sub customer_phone { return( shift->_set_get_scalar( 'customer_phone', @_ ) ); }
70              
71 0     0 1   sub customer_shipping { return( shift->_set_get_object( 'customer_shipping', 'Net::API::Stripe::Shipping', @_ ) ); }
72              
73 0     0 1   sub customer_tax_exempt { shift->_set_get_scalar( 'customer_tax_exempt', @_ ); }
74              
75 0     0 1   sub customer_tax_ids { shift->_set_get_object_array( 'customer_tax_ids', 'Net::API::Stripe::Customer::TaxId', @_ ); }
76              
77 0     0 1   sub date { shift->_set_get_datetime( 'date', @_ ); }
78              
79 0     0 1   sub default_payment_method { return( shift->_set_get_scalar_or_object( 'default_payment_method', 'Net::API::Stripe::Payment::Method', @_ ) ); }
80              
81 0     0 1   sub default_source { return( shift->_set_get_scalar_or_object( 'default_source', 'Net::API::Stripe::Payment::Source', @_ ) ); }
82              
83 0     0 1   sub default_tax_rates { return( shift->_set_get_object_array( 'default_tax_rates', 'Net::API::Stripe::Tax::Rate', @_ ) ); }
84              
85 0     0 1   sub description { shift->_set_get_scalar( 'description', @_ ); }
86              
87 0     0 1   sub discount { shift->_set_get_object( 'discount', 'Net::API::Stripe::Billing::Discount', @_ ); }
88              
89 0     0 1   sub due_date { shift->_set_get_datetime( 'due_date', @_ ); }
90              
91 0     0 1   sub ending_balance { shift->_set_get_number( 'ending_balance', @_ ); }
92              
93 0     0 1   sub footer { shift->_set_get_scalar( 'footer', @_ ); }
94              
95 0     0 1   sub forgiven { shift->_set_get_scalar( 'forgiven', @_ ); }
96              
97             ## Not used anymore? It's not on the API documentation
98 0     0 0   sub hosted_invoice_payment_pending { shift->_set_get_scalar( 'hosted_invoice_payment_pending', @_ ); }
99              
100 0     0 1   sub hosted_invoice_url { shift->_set_get_uri( 'hosted_invoice_url', @_ ); }
101              
102 0     0 1   sub invoice_pdf { shift->_set_get_uri( 'invoice_pdf', @_ ); }
103              
104 0     0 1   sub lines { shift->_set_get_object( 'lines', 'Net::API::Stripe::Billing::Invoice::Lines', @_ ); }
105              
106 0     0 1   sub livemode { shift->_set_get_boolean( 'livemode', @_ ); }
107              
108 0     0 1   sub metadata { shift->_set_get_hash( 'metadata', @_ ); }
109              
110 0     0 1   sub next_payment_attempt { shift->_set_get_datetime( 'next_payment_attempt', @_ ); }
111              
112 0     0 1   sub number { shift->_set_get_scalar( 'number', @_ ); }
113              
114 0     0 1   sub paid { shift->_set_get_boolean( 'paid', @_ ); }
115              
116 0     0 1   sub payment_intent { shift->_set_get_scalar_or_object( 'payment_intent', 'Net::API::Stripe::Payment::Intent', @_ ); }
117              
118 0     0 1   sub period_end { shift->_set_get_datetime( 'period_end', @_ ); }
119              
120 0     0 1   sub period_start { shift->_set_get_datetime( 'period_start', @_ ); }
121              
122 0     0 1   sub post_payment_credit_notes_amount { return( shift->_set_get_number( 'post_payment_credit_notes_amount', @_ ) ); }
123              
124 0     0 1   sub pre_payment_credit_notes_amount { return( shift->_set_get_number( ' pre_payment_credit_notes_amount', @_ ) ); }
125              
126 0     0 1   sub receipt_number { shift->_set_get_scalar( 'receipt_number', @_ ); }
127              
128 0     0 1   sub starting_balance { shift->_set_get_number( 'starting_balance', @_ ); }
129              
130 0     0 1   sub statement_descriptor { shift->_set_get_scalar( 'statement_descriptor', @_ ); }
131              
132 0     0 1   sub status { shift->_set_get_scalar( 'status', @_ ); }
133              
134 0     0 1   sub status_transitions { return( shift->_set_get_object( 'status_transitions', 'Net::API::Stripe::Billing::Invoice::StatusTransition', @_ ) ); }
135              
136 0     0 1   sub subscription { shift->_set_get_scalar_or_object( 'subscription', 'Net::API::Stripe::Billing::Subscription', @_ ); }
137              
138 0     0 1   sub subscription_proration_date { shift->_set_get_scalar( 'subscription_proration_date', @_ ); }
139              
140 0     0 1   sub subtotal { shift->_set_get_number( 'subtotal', @_ ); }
141              
142 0     0 1   sub tax { shift->_set_get_number( 'tax', @_ ); }
143              
144             ## Does not seem to exist anymore in the API documentation...
145 0     0 0   sub tax_percent { shift->_set_get_number( 'tax_percent', @_ ); }
146              
147 0     0 1   sub threshold_reason { return( shift->_set_get_hash( 'threshold_reason', @_ ) ); }
148              
149 0     0 1   sub total { shift->_set_get_number( 'total', @_ ); }
150              
151 0     0 1   sub total_tax_amounts { shift->_set_get_object_array( 'total_tax_amounts', 'Net::API::Stripe::Billing::Invoice::TaxAmount', @_ ); }
152              
153 0     0 1   sub webhooks_delivered_at { shift->_set_get_datetime( 'webhooks_delivered_at', @_ ); }
154              
155             1;
156              
157             __END__
158              
159             =encoding utf8
160              
161             =head1 NAME
162              
163             Net::API::Stripe::Billing::Invoice - A Stripe Invoice
164              
165             =head1 SYNOPSIS
166              
167             my $stripe = Net::API::Stripe->new( conf_file => './settings.json', expand => 'all' ) || die( Net::API::Stripe->error );
168             my $inv = $stripe->invoices( create =>
169             {
170             account_country => 'jp',
171             account_name => 'John Doe',
172             amount_due => 2000,
173             amount_paid => 500,
174             amount_remaining => 1500
175             billing => 'charge_automatically',
176             charge => 'ch_fake123456789',
177             currency => 'jpy',
178             customer => $customer_object,
179             customer_address => $stripe->address({
180             line1 => '1-2-3 Sugamo, Bukyo-ku',
181             line2 => 'Taro Bldg'.
182             city => 'Tokyo',
183             postal_code => '123-4567',
184             country => 'jp',
185             }),
186             customer_email => 'john.doe@example.com',
187             customer_name => 'John Doe',
188             description => 'Invoice for professional services',
189             due_date => '2020-04-01',
190             }) || die( $stripe->error );
191              
192             =head1 VERSION
193              
194             v0.100.0
195              
196             =head1 DESCRIPTION
197              
198             Invoices are statements of amounts owed by a customer, and are either generated one-off, or generated periodically from a subscription.
199              
200             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).
201              
202             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.
203              
204             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.
205              
206             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.
207              
208             More details on the customer's account balance are L<here|https://stripe.com/docs/api/customers/object#customer_object-account_balance>.
209              
210             =head1 CONSTRUCTOR
211              
212             =over 4
213              
214             =item B<new>( %ARG )
215              
216             Creates a new L<Net::API::Stripe::Billing::Invoice> object.
217              
218             =back
219              
220             =head1 METHODS
221              
222             =over 4
223              
224             =item B<id> string
225              
226             Unique identifier for the object.
227              
228             =item B<object> string, value is "invoice"
229              
230             String representing the object’s type. Objects of the same type share the same value.
231              
232             =item B<account_country> string
233              
234             The country of the business associated with this invoice, most often the business creating the invoice.
235              
236             =item B<account_name> string
237              
238             The public name of the business associated with this invoice, most often the business creating the invoice.
239              
240             =item B<amount_due> integer
241              
242             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.
243              
244             =item B<amount_paid> integer
245              
246             The amount, in JPY, that was paid.
247              
248             =item B<amount_remaining> integer
249              
250             The amount remaining, in JPY, that is due.
251              
252             =item B<application_fee_amount> integer
253              
254             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.
255              
256             =item B<attempt_count> positive integer or zero
257              
258             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.
259              
260             =item B<attempted> boolean
261              
262             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.
263              
264             =item B<auto_advance> boolean
265              
266             Controls whether Stripe will perform automatic collection of the invoice. When false, the invoice’s state will not automatically advance without an explicit action.
267              
268             =item B<billing> string
269              
270             This is an undocumented property, but that appears in Stripe's own API object example. It contains C<charge_automatically>
271              
272             =item B<billing_reason> string
273              
274             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.
275              
276             =item B<charge> string (expandable)
277              
278             ID of the latest charge generated for this invoice, if any. When expanded, this is a L<Net::API::Stripe::Charge> object.
279              
280             =item B<collection_method> string
281              
282             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.
283              
284             =item B<created> timestamp
285              
286             Time at which the object was created. Measured in seconds since the Unix epoch.
287              
288             =item B<currency> currency
289              
290             Three-letter ISO currency code, in lowercase. Must be a supported currency.
291              
292             =item B<custom_fields> array of hashes
293              
294             Custom fields displayed on the invoice. This is an array of L<Net::API::Stripe::CustomField> objects.
295              
296             =item B<customer> string (expandable)
297              
298             This is a Stripe Customer id, or when expanded, this is a L<Net::API::Stripe::Customer> object.
299              
300             =item B<customer_address> hash
301              
302             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.
303              
304             This is a L<Net::API::Stripe::Address> object.
305              
306             =item B<customer_email> string
307              
308             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.
309              
310             =item B<customer_name> string
311              
312             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.
313              
314             =item B<customer_phone> string
315              
316             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.
317              
318             =item B<customer_shipping> hash
319              
320             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.
321              
322             This is a L<Net::API::Stripe::Shipping> object.
323              
324             =item B<customer_tax_exempt> string
325              
326             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.
327              
328             =item B<customer_tax_ids> array of hashes
329              
330             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.
331              
332             This is a L<Net::API::Stripe::Customer::TaxIds> object.
333              
334             =item B<default_payment_method> string (expandable)
335              
336             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.
337              
338             When expanded, this is a L<Net::API::Stripe::Payment::Method> object.
339              
340             =item B<default_source> string (expandable)
341              
342             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.
343              
344             When expanded, this is a L<Net::API::Stripe::Payment::Source> object.
345              
346             =item B<default_tax_rates> array of hashes
347              
348             The tax rates applied to this invoice, if any.
349              
350             This is an array of L<Net::API::Stripe::Tax::Rate> object.
351              
352             =item B<description> string
353              
354             An arbitrary string attached to the object. Often useful for displaying to users. Referenced as ‘memo’ in the Dashboard.
355              
356             =item B<discount> hash, discount object
357              
358             This is a L<Net::API::Stripe::Billing::Discount> object
359              
360             =item B<due_date> timestamp
361              
362             The date on which payment for this invoice is due. This value will be null for invoices where collection_method=charge_automatically.
363              
364             =item B<ending_balance> integer
365              
366             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.
367              
368             =item B<footer> string
369              
370             Footer displayed on the invoice.
371              
372             =item B<forgiven> boolean
373              
374             =item B<hosted_invoice_url> string
375              
376             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.
377              
378             =item B<invoice_pdf> string
379              
380             The link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null.
381              
382             =item B<lines> list
383              
384             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.
385              
386             This is a L<Net::API::Stripe::Billing::Invoice::Lines> object.
387              
388             =item B<livemode> boolean
389              
390             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
391              
392             =item B<metadata> hash
393              
394             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.
395              
396             =item B<next_payment_attempt> timestamp
397              
398             The time at which payment will next be attempted. This value will be null for invoices where collection_method=send_invoice.
399              
400             =item B<number> string
401              
402             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.
403              
404             =item B<paid> boolean
405              
406             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.
407              
408             =item B<payment_intent> string (expandable)
409              
410             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.
411              
412             When expanded, this is a L<Net::API::Stripe::Payment::Intent> object.
413              
414             =item B<period_end> timestamp
415              
416             End of the usage period during which invoice items were added to this invoice.
417              
418             =item B<period_start> timestamp
419              
420             Start of the usage period during which invoice items were added to this invoice.
421              
422             =item B<post_payment_credit_notes_amount> integer
423              
424             Total amount of all post-payment credit notes issued for this invoice.
425              
426             =item B<pre_payment_credit_notes_amount> integer
427              
428             Total amount of all pre-payment credit notes issued for this invoice.
429              
430             =item B<receipt_number> string
431              
432             This is the transaction number that appears on email receipts sent for this invoice.
433              
434             =item B<starting_balance> integer
435              
436             Starting customer balance before the invoice is finalized. If the invoice has not been finalized yet, this will be the current customer balance.
437              
438             =item B<statement_descriptor> string
439              
440             Extra information about an invoice for the customer’s credit card statement.
441              
442             =item B<status> string
443              
444             The status of the invoice, one of draft, open, paid, uncollectible, or void. Learn more
445              
446             =item B<status_transitions> hash
447              
448             This is a L<Net::API::Stripe::Billing::Invoice::StatusTransition> object.
449              
450             =item B<subscription> string (expandable)
451              
452             The subscription that this invoice was prepared for, if any. When expanded, this is a L<Net::API::Stripe::Billing::Subscription> object.
453              
454             =item B<subscription_proration_date> integer
455              
456             Only set for upcoming invoices that preview prorations. The time used to calculate prorations.
457              
458             =item B<subtotal> integer
459              
460             Total of all subscriptions, invoice items, and prorations on the invoice before any discount or tax is applied.
461              
462             =item B<tax> integer
463              
464             The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice.
465              
466             =item B<threshold_reason> hash
467              
468             If billing_reason is set to subscription_threshold this returns more information on which threshold rules triggered the invoice.
469              
470             =item B<total> integer
471              
472             Total after discounts and taxes.
473              
474             =item B<total_tax_amounts> array of hashes
475              
476             The aggregate amounts calculated per tax rate for all line items.
477              
478             This is an array of L<Net::API::Stripe::Billing::Invoice::TaxAmount> objects.
479              
480             =item B<webhooks_delivered_at> timestamp
481              
482             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.
483              
484             =back
485              
486             =head1 API SAMPLE
487              
488             {
489             "id": "in_fake123456789",
490             "object": "invoice",
491             "account_country": "JP",
492             "account_name": "Provider, Inc",
493             "amount_due": 8000,
494             "amount_paid": 8000,
495             "amount_remaining": 0,
496             "application_fee_amount": null,
497             "attempt_count": 1,
498             "attempted": true,
499             "auto_advance": false,
500             "billing": "charge_automatically",
501             "billing_reason": "subscription",
502             "charge": "ch_fake1234567890",
503             "collection_method": "charge_automatically",
504             "created": 1507273919,
505             "currency": "jpy",
506             "custom_fields": null,
507             "customer": "cus_fake1234567890",
508             "customer_address": null,
509             "customer_email": "john.doe@example.com",
510             "customer_name": null,
511             "customer_phone": null,
512             "customer_shipping": null,
513             "customer_tax_exempt": "none",
514             "customer_tax_ids": [],
515             "default_payment_method": null,
516             "default_source": null,
517             "default_tax_rates": [],
518             "description": null,
519             "discount": null,
520             "due_date": null,
521             "ending_balance": 0,
522             "footer": null,
523             "hosted_invoice_url": "https://pay.stripe.com/invoice/invst_lksjkljslmckhsjcbncmbcn",
524             "invoice_pdf": "https://pay.stripe.com/invoice/invst_lksjkljslmckhsjcbncmbcn/pdf",
525             "lines": {
526             "data": [
527             {
528             "id": "sli_fake123456789",
529             "object": "line_item",
530             "amount": 8000,
531             "currency": "jpy",
532             "description": "1 × Provider, Inc professional monthly membership (at Â¥8,000 / month)",
533             "discountable": true,
534             "livemode": false,
535             "metadata": {},
536             "period": {
537             "end": 1559441759,
538             "start": 1556763359
539             },
540             "plan": {
541             "id": "professional-monthly-jpy",
542             "object": "plan",
543             "active": true,
544             "aggregate_usage": null,
545             "amount": 8000,
546             "amount_decimal": "8000",
547             "billing_scheme": "per_unit",
548             "created": 1541833564,
549             "currency": "jpy",
550             "interval": "month",
551             "interval_count": 1,
552             "livemode": false,
553             "metadata": {},
554             "nickname": null,
555             "product": "prod_fake123456789",
556             "tiers": null,
557             "tiers_mode": null,
558             "transform_usage": null,
559             "trial_period_days": null,
560             "usage_type": "licensed"
561             },
562             "proration": false,
563             "quantity": 1,
564             "subscription": "sub_fake123456789",
565             "subscription_item": "si_fake123456789",
566             "tax_amounts": [],
567             "tax_rates": [],
568             "type": "subscription"
569             }
570             ],
571             "has_more": false,
572             "object": "list",
573             "url": "/v1/invoices/in_fake123456789/lines"
574             },
575             "livemode": false,
576             "metadata": {},
577             "next_payment_attempt": null,
578             "number": "53DB91F-0001",
579             "paid": true,
580             "payment_intent": null,
581             "period_end": 1507273919,
582             "period_start": 1507273919,
583             "post_payment_credit_notes_amount": 0,
584             "pre_payment_credit_notes_amount": 0,
585             "receipt_number": "2066-1929",
586             "starting_balance": 0,
587             "statement_descriptor": null,
588             "status": "paid",
589             "status_transitions": {
590             "finalized_at": 1507273919,
591             "marked_uncollectible_at": null,
592             "paid_at": 1507273919,
593             "voided_at": null
594             },
595             "subscription": "sub_fake123456789",
596             "subtotal": 8000,
597             "tax": null,
598             "tax_percent": null,
599             "total": 8000,
600             "total_tax_amounts": [],
601             "webhooks_delivered_at": 1507273920
602             }
603              
604             =head1 HISTORY
605              
606             =head2 v0.1
607              
608             Initial version
609              
610             =head1 STRIPE HISTORY
611              
612             =head1 2019-12-03
613              
614             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.
615              
616             =over 4
617              
618             =item * To achieve this behavior in earlier API versions:
619              
620             =over 8
621              
622             =item * Set consume_applied_balance to false when voiding invoices in /v1/invoices/:id/void.
623              
624             =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.
625              
626             =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.
627              
628             =back
629              
630             =back
631              
632             =head2 2019-03-14
633              
634             There are a few changes to the invoice object:
635              
636             =over 4
637              
638             =item * A I<status_transitions> hash now contains the timestamps when an invoice was finalized, paid, marked uncollectible, or voided.
639              
640             =item * The I<date> property has been renamed to created.
641              
642             =item * The I<finalized_at> property has been moved into the I<status_transitions> hash.
643              
644             =back
645              
646             =head2 2018-11-08
647              
648             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>.
649              
650              
651             =head2 2018-11-08
652              
653             Instead of checking the I<forgiven> field on an invoice, check for the I<uncollectible> status.
654              
655             Instead of setting the I<forgiven> field on an invoice, mark it as uncollectible.
656              
657             =head1 AUTHOR
658              
659             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
660              
661             =head1 SEE ALSO
662              
663             Stripe API documentation:
664              
665             L<https://stripe.com/docs/api/invoices>, L<https://stripe.com/docs/billing/invoices/sending>
666              
667             =head1 COPYRIGHT & LICENSE
668              
669             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
670              
671             You can use, copy, modify and redistribute this package and associated
672             files under the same terms as Perl itself.
673              
674             =cut