| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
|
2
|
|
|
|
|
|
|
## Stripe API - ~/lib/Net/API/Stripe/Billing/Subscription/Item.pm |
|
3
|
|
|
|
|
|
|
## Version v0.1.1 |
|
4
|
|
|
|
|
|
|
## Copyright(c) 2020 DEGUEST Pte. Ltd. |
|
5
|
|
|
|
|
|
|
## Author: Jacques Deguest <jack@deguest.jp> |
|
6
|
|
|
|
|
|
|
## Created 2019/11/02 |
|
7
|
|
|
|
|
|
|
## Modified 2020/05/15 |
|
8
|
|
|
|
|
|
|
## |
|
9
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
|
10
|
|
|
|
|
|
|
## https://stripe.com/docs/api/subscription_items/object |
|
11
|
|
|
|
|
|
|
BEGIN |
|
12
|
|
|
|
|
|
|
{ |
|
13
|
|
|
|
|
|
|
use strict; |
|
14
|
2
|
|
|
2
|
|
24003976
|
use warnings; |
|
|
2
|
|
|
|
|
16
|
|
|
|
2
|
|
|
|
|
62
|
|
|
15
|
2
|
|
|
2
|
|
11
|
use parent qw( Net::API::Stripe::Generic ); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
61
|
|
|
16
|
2
|
|
|
2
|
|
10
|
use vars qw( $VERSION ); |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
10
|
|
|
17
|
2
|
|
|
2
|
|
145
|
our( $VERSION ) = 'v0.1.1'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
120
|
|
|
18
|
2
|
|
|
2
|
|
39
|
}; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use strict; |
|
21
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
36
|
|
|
22
|
2
|
|
|
2
|
|
9
|
|
|
|
2
|
|
|
|
|
42
|
|
|
|
2
|
|
|
|
|
512
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
0
|
|
|
0
|
1
|
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
0
|
|
|
0
|
1
|
|
## Used in upcoming invoice api calls |
|
27
|
|
|
|
|
|
|
|
|
28
|
0
|
|
|
0
|
1
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
1
|
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
0
|
|
|
0
|
1
|
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
0
|
|
|
0
|
1
|
|
|
|
36
|
|
|
|
|
|
|
1; |
|
37
|
0
|
|
|
0
|
1
|
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
0
|
|
|
0
|
1
|
|
=encoding utf8 |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
|
|
0
|
1
|
|
=head1 NAME |
|
42
|
|
|
|
|
|
|
|
|
43
|
0
|
|
|
0
|
1
|
|
Net::API::Stripe::Billing::Subscription::Item - A Stripe Subscription Item Object |
|
44
|
|
|
|
|
|
|
|
|
45
|
0
|
|
|
0
|
1
|
|
=head1 SYNOPSIS |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
|
|
0
|
1
|
|
my $item = $stripe->subscription_item({ |
|
48
|
|
|
|
|
|
|
clear_usage => 1, |
|
49
|
|
|
|
|
|
|
metadata => { transaction_id => 1212, customer_id => 123 }, |
|
50
|
|
|
|
|
|
|
quantity => 1, |
|
51
|
|
|
|
|
|
|
subscription => 'sub_fake123456789', |
|
52
|
|
|
|
|
|
|
}); |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 VERSION |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
v0.1.1 |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Subscription items allow you to create customer subscriptions with more than one plan, making it easy to represent complex billing relationships. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 new( %ARG ) |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Creates a new L<Net::API::Stripe::Billing::Subscription::Item> object. |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 METHODS |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head2 id string |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Unique identifier for the object. |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head2 object string, value is "subscription_item" |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
String representing the object’s type. Objects of the same type share the same value. |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head2 billing_thresholds hash |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This is a L<Net::API::Stripe::Billing::Thresholds> object. |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=over 4 |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item I<usage_gte> integer |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Usage threshold that triggers the subscription to create an invoice |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=back |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 clear_usage() optional |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Delete all usage for a given subscription item. Allowed only when deleted is set to true and the current plan’s usage_type is metered. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This is used in making upcoming invoice items api calls as described here: L<https://stripe.com/docs/api/invoices/upcoming_invoice_lines> |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 created integer |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Time at which the object was created. Measured in seconds since the Unix epoch. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 deleted optional |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
A flag that, if set to true, will delete the specified item. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This is used in making upcoming invoice items api calls as described here: L<https://stripe.com/docs/api/invoices/upcoming_invoice_lines> |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 metadata hash |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
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. |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 plan hash, plan object |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Hash describing the plan the customer is subscribed to. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This is a L<Net::API::Stripe::Billing::Plan> object. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 price object |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
The price the customer is subscribed to. |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
This is a L<Net::API::Stripe::Price> object. |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 quantity positive integer or zero |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
The quantity of the plan to which the customer should be subscribed. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 subscription string |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
The subscription this subscription_item belongs to. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 tax_rates array of hashes |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
The tax rates which apply to this subscription_item. When set, the default_tax_rates on the subscription do not apply to this subscription_item. |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This is an array of L<Net::API::Stripe::Tax::Rate> objects. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 API SAMPLE |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
{ |
|
141
|
|
|
|
|
|
|
"id": "si_fake123456789", |
|
142
|
|
|
|
|
|
|
"object": "subscription_item", |
|
143
|
|
|
|
|
|
|
"billing_thresholds": null, |
|
144
|
|
|
|
|
|
|
"created": 1571397912, |
|
145
|
|
|
|
|
|
|
"metadata": {}, |
|
146
|
|
|
|
|
|
|
"plan": { |
|
147
|
|
|
|
|
|
|
"id": "expert-monthly-jpy", |
|
148
|
|
|
|
|
|
|
"object": "plan", |
|
149
|
|
|
|
|
|
|
"active": true, |
|
150
|
|
|
|
|
|
|
"aggregate_usage": null, |
|
151
|
|
|
|
|
|
|
"amount": 8000, |
|
152
|
|
|
|
|
|
|
"amount_decimal": "8000", |
|
153
|
|
|
|
|
|
|
"billing_scheme": "per_unit", |
|
154
|
|
|
|
|
|
|
"created": 1507273129, |
|
155
|
|
|
|
|
|
|
"currency": "jpy", |
|
156
|
|
|
|
|
|
|
"interval": "month", |
|
157
|
|
|
|
|
|
|
"interval_count": 1, |
|
158
|
|
|
|
|
|
|
"livemode": false, |
|
159
|
|
|
|
|
|
|
"metadata": {}, |
|
160
|
|
|
|
|
|
|
"nickname": null, |
|
161
|
|
|
|
|
|
|
"product": "prod_fake123456789", |
|
162
|
|
|
|
|
|
|
"tiers": null, |
|
163
|
|
|
|
|
|
|
"tiers_mode": null, |
|
164
|
|
|
|
|
|
|
"transform_usage": null, |
|
165
|
|
|
|
|
|
|
"trial_period_days": null, |
|
166
|
|
|
|
|
|
|
"usage_type": "licensed" |
|
167
|
|
|
|
|
|
|
}, |
|
168
|
|
|
|
|
|
|
"quantity": 1, |
|
169
|
|
|
|
|
|
|
"subscription": "sub_fake123456789", |
|
170
|
|
|
|
|
|
|
"tax_rates": [] |
|
171
|
|
|
|
|
|
|
} |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=head1 HISTORY |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head2 v0.1 |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Initial version |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head2 v0.1.1 |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Added the methods clear_usage and deleted used in making upcoming invoice item api calls as explained here L<https://stripe.com/docs/api/invoices/upcoming_invoice_lines> |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 AUTHOR |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Stripe API documentation: |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
L<https://stripe.com/docs/api/subscription_items> |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Copyright (c) 2020-2020 DEGUEST Pte. Ltd. |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
You can use, copy, modify and redistribute this package and associated |
|
198
|
|
|
|
|
|
|
files under the same terms as Perl itself. |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=cut |