line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## Stripe API - ~/lib/Net/API/Stripe/Billing/UsageRecord.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/usage_records |
11
|
|
|
|
|
|
|
package Net::API::Stripe::Billing::UsageRecord; |
12
|
|
|
|
|
|
|
BEGIN |
13
|
|
|
|
|
|
|
{ |
14
|
1
|
|
|
1
|
|
802
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
27
|
|
15
|
1
|
|
|
1
|
|
5
|
use parent qw( Net::API::Stripe::Generic ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
16
|
1
|
|
|
1
|
|
156
|
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 livemode { shift->_set_get_boolean( 'livemode', @_ ); } |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
0
|
1
|
|
sub quantity { shift->_set_get_number( 'quantity', @_ ); } |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
0
|
1
|
|
sub subscription_item { shift->_set_get_scalar( 'subscription_item', @_ ); } |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
0
|
1
|
|
sub timestamp { shift->_set_get_datetime( 'timestamp', @_ ); } |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=encoding utf8 |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 NAME |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Net::API::Stripe::Billing::UsageRecord - A Stripe Usage Record Object |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 SYNOPSIS |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $usage_record = $stripe->usage_record({ |
44
|
|
|
|
|
|
|
quantity => 1, |
45
|
|
|
|
|
|
|
subscription_item => $subscription_item_object, |
46
|
|
|
|
|
|
|
# Can be a unix timestamp or an iso 8601 date |
47
|
|
|
|
|
|
|
timestamp => '2020-04-01', |
48
|
|
|
|
|
|
|
}); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 VERSION |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
v0.100.0 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Usage records allow you to report customer usage and metrics to Stripe for metered billing of subscription plans. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=over 4 |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item B<new>( %ARG ) |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Creates a new L<Net::API::Stripe::Billing::UsageRecord> object. |
65
|
|
|
|
|
|
|
It may also take an hash like arguments, that also are method of the same name. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=back |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 METHODS |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=over 4 |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item B<id> string |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Unique identifier for the object. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item B<object> string, value is "usage_record" |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
String representing the objectâs type. Objects of the same type share the same value. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item B<livemode> boolean |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Has the value true if the object exists in live mode or the value false if the object exists in test mode. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item B<quantity> positive integer or zero |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
The usage quantity for the specified date. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item B<subscription_item> string |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
The ID of the subscription item this usage record contains data for. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item B<timestamp> timestamp |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
The timestamp when this usage occurred. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=back |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 API SAMPLE |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
{ |
102
|
|
|
|
|
|
|
"id": "mbur_fake123456789", |
103
|
|
|
|
|
|
|
"object": "usage_record", |
104
|
|
|
|
|
|
|
"livemode": false, |
105
|
|
|
|
|
|
|
"quantity": 100, |
106
|
|
|
|
|
|
|
"subscription_item": "si_fake123456789", |
107
|
|
|
|
|
|
|
"timestamp": 1571397911 |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 HISTORY |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 v0.1 |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Initial version |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 AUTHOR |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 SEE ALSO |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Stripe API documentation: |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
L<https://stripe.com/docs/api/usage_records>, L<https://stripe.com/docs/billing/subscriptions/metered-billing> |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Copyright (c) 2019-2020 DEGUEST Pte. Ltd. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
You can use, copy, modify and redistribute this package and associated |
131
|
|
|
|
|
|
|
files under the same terms as Perl itself. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |