line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## Stripe API - ~/lib/Net/API/Stripe/Event.pm |
3
|
|
|
|
|
|
|
## Version v0.101.0 |
4
|
|
|
|
|
|
|
## Copyright(c) 2020 DEGUEST Pte. Ltd. |
5
|
|
|
|
|
|
|
## Author: Jacques Deguest <jack@deguest.jp> |
6
|
|
|
|
|
|
|
## Created 2019/11/02 |
7
|
|
|
|
|
|
|
## Modified 2020/11/16 |
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/events/object |
14
|
|
|
|
|
|
|
package Net::API::Stripe::Event; |
15
|
|
|
|
|
|
|
BEGIN |
16
|
|
|
|
|
|
|
{ |
17
|
2
|
|
|
2
|
|
21427420
|
use strict; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
76
|
|
18
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
61
|
|
19
|
2
|
|
|
2
|
|
14
|
use parent qw( Net::API::Stripe::Generic ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
12
|
|
20
|
2
|
|
|
2
|
|
135
|
use vars qw( $VERSION ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
110
|
|
21
|
2
|
|
|
2
|
|
37
|
our( $VERSION ) = 'v0.101.0'; |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
39
|
|
25
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
480
|
|
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
0
|
1
|
|
sub id { return( shift->_set_get_scalar( 'id', @_ ) ); } |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
0
|
1
|
|
sub object { return( shift->_set_get_scalar( 'object', @_ ) ); } |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
1
|
|
sub account { return( shift->_set_get_scalar( 'account', @_ ) ); } |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
0
|
1
|
|
sub api_version { return( shift->_set_get_scalar( 'api_version', @_ ) ); } |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
0
|
1
|
|
sub created { return( shift->_set_get_datetime( 'created', @_ ) ); } |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
0
|
1
|
|
sub data { return( shift->_set_get_object( 'data', 'Net::API::Stripe::Event::Data', @_ ) ); } |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
0
|
1
|
|
sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); } |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
0
|
1
|
|
sub pending_webhooks { return( shift->_set_get_scalar( 'pending_webhooks', @_ ) ); } |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
0
|
1
|
|
sub request { return( shift->_set_get_object( 'request', 'Net::API::Stripe::Event::Request', @_ ) ); } |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
0
|
1
|
|
sub type { return( shift->_set_get_scalar( 'type', @_ ) ); } |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=encoding utf8 |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 NAME |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Net::API::Stripe::Event - A Stripe Event Object |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 SYNOPSIS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
my $evt = $stripe->event({ |
60
|
|
|
|
|
|
|
api_version => '2020-03-02', |
61
|
|
|
|
|
|
|
data => |
62
|
|
|
|
|
|
|
{ |
63
|
|
|
|
|
|
|
object => $invoice_object, |
64
|
|
|
|
|
|
|
}, |
65
|
|
|
|
|
|
|
livemode => $stripe->false, |
66
|
|
|
|
|
|
|
pending_webhooks => 2, |
67
|
|
|
|
|
|
|
request => |
68
|
|
|
|
|
|
|
{ |
69
|
|
|
|
|
|
|
id => 'req_HwlkQJshckjIsj', |
70
|
|
|
|
|
|
|
idempotency_key => '677A3112-FBAD-4804-BA61-CEF1CC13D155', |
71
|
|
|
|
|
|
|
}, |
72
|
|
|
|
|
|
|
type => 'invoice.created', |
73
|
|
|
|
|
|
|
}); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 VERSION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
v0.101.0 |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 DESCRIPTION |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Events are Stripe's way of letting you know when something interesting happens in your account. When an interesting event occurs, Stripe creates a new Event object. For example, when a charge succeeds, Stripe creates a charge.succeeded event; and when an invoice payment attempt fails, Stripe creates an invoice.payment_failed event. Note that many API requests may cause multiple events to be created. For example, if you create a new subscription for a customer, you will receive both a customer.subscription.created event and a charge.succeeded event. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Events occur when the state of another API resource changes. The state of that resource at the time of the change is embedded in the event's data field. For example, a charge.succeeded event will contain a charge, and an invoice.payment_failed event will contain an invoice. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
As with other API resources, you can use endpoints to L<retrieve an individual event|https://stripe.com/docs/api/events#retrieve_event> or a L<list of events|https://stripe.com/docs/api/events#list_events> from the API. Stripe also have a L<separate webhooks system|http://en.wikipedia.org/wiki/Webhook> for sending the Event objects directly to an endpoint on your server. Webhooks are managed in your L<account settings|https://dashboard.stripe.com/account/webhooks>, and L<Stripe's Using Webhooks|https://stripe.com/docs/webhooks> guide will help you get set up. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
When using Connect, you can also receive notifications of events that occur in connected accounts. For these events, there will be an additional account attribute in the received Event object. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 new( %ARG ) |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Creates a new L<Net::API::Stripe::Event> object. |
96
|
|
|
|
|
|
|
It may also take an hash like arguments, that also are method of the same name. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 METHODS |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 id string |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Unique identifier for the object. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 object string, value is "event" |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
String representing the object’s type. Objects of the same type share the same value. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 account Connect only string |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
The connected account that originated the event. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 api_version string |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
The Stripe API version used to render data. Note: This property is populated only for events on or after October 31, 2014. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 created timestamp |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Time at which the object was created. Measured in seconds since the Unix epoch. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 data hash |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Object containing data associated with the event. This is an L<Net::API::Stripe::Event::Data> object |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 livemode boolean |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Has the value true if the object exists in live mode or the value false if the object exists in test mode. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 pending_webhooks positive integer or zero |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Number of webhooks that have yet to be successfully delivered (i.e., to return a 20x response) to the URLs you’ve specified. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 request hash |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Information on the API request that instigated the event. This is a L<Net::API::Stripe::Event::Request> object. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head2 type string |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Description of the event (e.g., invoice.created or charge.refunded). |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 API SAMPLE |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
{ |
143
|
|
|
|
|
|
|
"id": "evt_fake123456789", |
144
|
|
|
|
|
|
|
"object": "event", |
145
|
|
|
|
|
|
|
"api_version": "2017-02-14", |
146
|
|
|
|
|
|
|
"created": 1528914645, |
147
|
|
|
|
|
|
|
"data": { |
148
|
|
|
|
|
|
|
"object": { |
149
|
|
|
|
|
|
|
"object": "balance", |
150
|
|
|
|
|
|
|
"available": [ |
151
|
|
|
|
|
|
|
{ |
152
|
|
|
|
|
|
|
"currency": "jpy", |
153
|
|
|
|
|
|
|
"amount": 1025751, |
154
|
|
|
|
|
|
|
"source_types": { |
155
|
|
|
|
|
|
|
"card": 1025751 |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
], |
159
|
|
|
|
|
|
|
"connect_reserved": [ |
160
|
|
|
|
|
|
|
{ |
161
|
|
|
|
|
|
|
"currency": "jpy", |
162
|
|
|
|
|
|
|
"amount": 0 |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
], |
165
|
|
|
|
|
|
|
"livemode": false, |
166
|
|
|
|
|
|
|
"pending": [ |
167
|
|
|
|
|
|
|
{ |
168
|
|
|
|
|
|
|
"currency": "jpy", |
169
|
|
|
|
|
|
|
"amount": 0, |
170
|
|
|
|
|
|
|
"source_types": { |
171
|
|
|
|
|
|
|
"card": 0 |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
] |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
}, |
177
|
|
|
|
|
|
|
"livemode": false, |
178
|
|
|
|
|
|
|
"pending_webhooks": 0, |
179
|
|
|
|
|
|
|
"request": { |
180
|
|
|
|
|
|
|
"id": null, |
181
|
|
|
|
|
|
|
"idempotency_key": null |
182
|
|
|
|
|
|
|
}, |
183
|
|
|
|
|
|
|
"type": "balance.available" |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head1 HISTORY |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head2 v0.1 |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
Initial version |
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/events#events>, L<https://stripe.com/docs/api/events/types> |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Copyright (c) 2019-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 |