line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## Stripe API - ~/lib/Net/API/Stripe/Billing/Invoice/Item.pm |
3
|
|
|
|
|
|
|
## Version v0.100.1 |
4
|
|
|
|
|
|
|
## Copyright(c) 2020 DEGUEST Pte. Ltd. |
5
|
|
|
|
|
|
|
## Author: Jacques Deguest <jack@deguest.jp> |
6
|
|
|
|
|
|
|
## Created 2019/11/02 |
7
|
|
|
|
|
|
|
## Modified 2020/10/22 |
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/invoiceitems |
14
|
|
|
|
|
|
|
BEGIN |
15
|
|
|
|
|
|
|
{ |
16
|
|
|
|
|
|
|
use strict; |
17
|
2
|
|
|
2
|
|
24060249
|
use warnings; |
|
2
|
|
|
|
|
16
|
|
|
2
|
|
|
|
|
69
|
|
18
|
2
|
|
|
2
|
|
10
|
use parent qw( Net::API::Stripe::Generic ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
70
|
|
19
|
2
|
|
|
2
|
|
12
|
use vars qw( $VERSION ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
20
|
2
|
|
|
2
|
|
148
|
our( $VERSION ) = 'v0.100.1'; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
118
|
|
21
|
2
|
|
|
2
|
|
42
|
}; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use strict; |
24
|
2
|
|
|
2
|
|
14
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
45
|
|
25
|
2
|
|
|
2
|
|
10
|
|
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
1011
|
|
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
|
|
|
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
0
|
1
|
|
|
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
0
|
0
|
|
|
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
0
|
1
|
|
|
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
0
|
1
|
|
|
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
0
|
1
|
|
|
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
0
|
1
|
|
|
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
0
|
1
|
|
|
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
0
|
1
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
0
|
1
|
|
|
54
|
|
|
|
|
|
|
=encoding utf8 |
55
|
0
|
|
|
0
|
1
|
|
|
56
|
|
|
|
|
|
|
=head1 NAME |
57
|
0
|
|
|
0
|
1
|
|
|
58
|
|
|
|
|
|
|
Net::API::Stripe::Billing::Invoice::Item - A Stripe Invoice Item Object |
59
|
0
|
|
|
0
|
1
|
|
|
60
|
|
|
|
|
|
|
=head1 SYNOPSIS |
61
|
0
|
|
|
0
|
1
|
|
|
62
|
|
|
|
|
|
|
my $invoice_item = $stripe->invoice_item({ |
63
|
0
|
|
|
0
|
1
|
|
amount => 2000, |
64
|
|
|
|
|
|
|
currency => 'jpy', |
65
|
0
|
|
|
0
|
1
|
|
customer => $customer_object, |
66
|
|
|
|
|
|
|
date => '2020-03-17', |
67
|
0
|
|
|
0
|
1
|
|
description => 'Support services', |
68
|
|
|
|
|
|
|
invoice => $invoice_object, |
69
|
0
|
|
|
0
|
0
|
|
metadata => { transaction_id => 1212, customer_id => 987 }, |
70
|
|
|
|
|
|
|
plan => $plan_object, |
71
|
0
|
|
|
0
|
1
|
|
proration => 1, |
72
|
|
|
|
|
|
|
quantity => 7, |
73
|
0
|
|
|
0
|
1
|
|
subscription => $subscription_object, |
74
|
|
|
|
|
|
|
}); |
75
|
0
|
|
|
0
|
1
|
|
|
76
|
|
|
|
|
|
|
=head1 VERSION |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
v0.100.1 |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 DESCRIPTION |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Sometimes you want to add a charge or credit to a customer, but actually charge or credit the customer's card only at the end of a regular billing cycle. This is useful for combining several charges (to minimize per-transaction fees), or for having Stripe tabulate your usage-based billing totals. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 new( %ARG ) |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Creates a new L<Net::API::Stripe::Billing::Invoice::Item> object. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 METHODS |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 id string |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Unique identifier for the object. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 object string, value is "invoiceitem" |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
String representing the object’s type. Objects of the same type share the same value. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 amount integer |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Amount (in the I<currency> specified) of the invoice item. This should always be equal to I<unit_amount * quantity>. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 currency currency |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Three-letter ISO currency code, in lowercase. Must be a supported currency (L<https://stripe.com/docs/currencies>). |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 customer string (expandable) |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
The ID of the customer who will be billed when this invoice item is billed. When expanded, this is a L<Net::API::Stripe::Customer> object. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 date timestamp |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Time at which the object was created. Measured in seconds since the Unix epoch. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 description string |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
An arbitrary string attached to the object. Often useful for displaying to users. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 discountable boolean |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
If true, discounts will apply to this invoice item. Always false for prorations. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 discounts |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
array containing strings. expandable |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
The discounts which apply to the invoice item. Item discounts are applied before invoice discounts. Use expand[]=discounts to expand each discount. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 invoice string (expandable) |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
The ID of the invoice this invoice item belongs to. When expanded, this is a L<Net::API::Stripe::Billing::Invoice> object. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head2 livemode boolean |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Has the value true if the object exists in live mode or the value false if the object exists in test mode. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 metadata hash |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
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. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 period hash |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
The period associated with with this invoice item. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
This is a L<Net::API::Stripe::Billing::Invoice::Period> object. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head2 plan hash, plan object |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
If the invoice item is a proration, the plan of the subscription that the proration was computed for. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
This is a L<Net::API::Stripe::Billing::Plan> object. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head2 price hash, price object |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
The price of the invoice item. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
This is a L<Net::API::Stripe::Price> object. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 proration boolean |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Whether the invoice item was created automatically as a proration adjustment when the customer switched plans. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head2 quantity integer |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Quantity of units for the invoice item. If the invoice item is a proration, the quantity of the subscription that the proration was computed for. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 subscription string (expandable) |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
The subscription that this invoice item has been created for, if any. When expanded, this is a L<Net::API::Stripe::Billing::Subscription> object. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head2 subscription_item string |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
The subscription item that this invoice item has been created for, if any. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head2 tax_rates array of hashes |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
The tax rates which apply to the invoice item. When set, the default_tax_rates on the invoice do not apply to this invoice item. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
This is an array of L<Net::API::Stripe::Tax::Rate> objects. |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head2 unified_proration boolean |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
For prorations this indicates whether Stripe automatically grouped multiple related debit and credit line items into a single combined line item. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head2 unit_amount integer |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Unit Amount (in the currency specified) of the invoice item. |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head2 unit_amount_decimal decimal string |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Same as unit_amount, but contains a decimal value with at most 12 decimal places. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head1 API SAMPLE |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
{ |
197
|
|
|
|
|
|
|
"id": "ii_fake123456789", |
198
|
|
|
|
|
|
|
"object": "invoiceitem", |
199
|
|
|
|
|
|
|
"amount": 8000, |
200
|
|
|
|
|
|
|
"currency": "jpy", |
201
|
|
|
|
|
|
|
"customer": "cus_fake123456789", |
202
|
|
|
|
|
|
|
"date": 1551493020, |
203
|
|
|
|
|
|
|
"description": "Unused time on Provider, Inc entrepreneur monthly membership after 02 Mar 2019", |
204
|
|
|
|
|
|
|
"discountable": false, |
205
|
|
|
|
|
|
|
"invoice": "in_fake123456789", |
206
|
|
|
|
|
|
|
"livemode": false, |
207
|
|
|
|
|
|
|
"metadata": {}, |
208
|
|
|
|
|
|
|
"period": { |
209
|
|
|
|
|
|
|
"end": 1554171359, |
210
|
|
|
|
|
|
|
"start": 1551493020 |
211
|
|
|
|
|
|
|
}, |
212
|
|
|
|
|
|
|
"plan": { |
213
|
|
|
|
|
|
|
"id": "entrepreneur-monthly-jpy", |
214
|
|
|
|
|
|
|
"object": "plan", |
215
|
|
|
|
|
|
|
"active": true, |
216
|
|
|
|
|
|
|
"aggregate_usage": null, |
217
|
|
|
|
|
|
|
"amount": 2000, |
218
|
|
|
|
|
|
|
"amount_decimal": "2000", |
219
|
|
|
|
|
|
|
"billing_scheme": "per_unit", |
220
|
|
|
|
|
|
|
"created": 1541833424, |
221
|
|
|
|
|
|
|
"currency": "jpy", |
222
|
|
|
|
|
|
|
"interval": "month", |
223
|
|
|
|
|
|
|
"interval_count": 1, |
224
|
|
|
|
|
|
|
"livemode": false, |
225
|
|
|
|
|
|
|
"metadata": {}, |
226
|
|
|
|
|
|
|
"nickname": null, |
227
|
|
|
|
|
|
|
"product": "prod_fake123456789", |
228
|
|
|
|
|
|
|
"tiers": null, |
229
|
|
|
|
|
|
|
"tiers_mode": null, |
230
|
|
|
|
|
|
|
"transform_usage": null, |
231
|
|
|
|
|
|
|
"trial_period_days": null, |
232
|
|
|
|
|
|
|
"usage_type": "licensed" |
233
|
|
|
|
|
|
|
}, |
234
|
|
|
|
|
|
|
"proration": true, |
235
|
|
|
|
|
|
|
"quantity": 1, |
236
|
|
|
|
|
|
|
"subscription": "sub_fake123456789", |
237
|
|
|
|
|
|
|
"subscription_item": "si_fake123456789", |
238
|
|
|
|
|
|
|
"tax_rates": [], |
239
|
|
|
|
|
|
|
"unit_amount": 8000, |
240
|
|
|
|
|
|
|
"unit_amount_decimal": "8000" |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=head1 HISTORY |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=head2 v0.1 |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
Initial version |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=head1 AUTHOR |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=head1 SEE ALSO |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
Stripe API documentation: |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
L<https://stripe.com/docs/api/invoiceitems>, L<https://stripe.com/docs/billing/invoices/subscription#adding-upcoming-invoice-items> |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
Copyright (c) 2019-2020 DEGUEST Pte. Ltd. |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
You can use, copy, modify and redistribute this package and associated |
264
|
|
|
|
|
|
|
files under the same terms as Perl itself. |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=cut |