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