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