line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## Stripe API - ~/lib/Net/API/Stripe/Token.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/tokens/object |
11
|
|
|
|
|
|
|
package Net::API::Stripe::Token; |
12
|
|
|
|
|
|
|
BEGIN |
13
|
|
|
|
|
|
|
{ |
14
|
1
|
|
|
1
|
|
841
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
15
|
1
|
|
|
1
|
|
4
|
use parent qw( Net::API::Stripe::Generic ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
16
|
1
|
|
|
1
|
|
251
|
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 bank_account { shift->_set_get_object( 'bank_account', 'Net::API::Stripe::Payment::BankAccount', @_ ); } |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
0
|
1
|
|
sub card { shift->_set_get_object( 'card', 'Net::API::Stripe::Payment::Card', @_ ); } |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
0
|
1
|
|
sub client_ip { shift->_set_get_scalar( 'client_ip', @_ ); } |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
0
|
1
|
|
sub created { shift->_set_get_datetime( 'created', @_ ); } |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
1
|
|
sub livemode { shift->_set_get_boolean( 'livemode', @_ ); } |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
## account, bank_account, card, person, or pii |
34
|
0
|
|
|
0
|
1
|
|
sub type { shift->_set_get_scalar( 'type', @_ ); } |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
0
|
1
|
|
sub used { shift->_set_get_boolean( 'used', @_ ); } |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=encoding utf8 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Net::API::Stripe::Token - A Stripe Token Object |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SYNOPSIS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $token = $stripe->token({ |
51
|
|
|
|
|
|
|
card => $card_object, |
52
|
|
|
|
|
|
|
client_ip => '1.2.3.4', |
53
|
|
|
|
|
|
|
livemode => $stripe->false, |
54
|
|
|
|
|
|
|
type => 'card', |
55
|
|
|
|
|
|
|
used => $stripe->false, |
56
|
|
|
|
|
|
|
}); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 VERSION |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
v0.100.0 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 DESCRIPTION |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Tokenisation is the process Stripe uses to collect sensitive card or bank account details, or personally identifiable information (PII), directly from your customers in a secure manner. A token representing this information is returned to your server to use. You should use Stripe's recommended payments integrations (L<https://stripe.com/docs/payments>) to perform this process client-side. This ensures that no sensitive card data touches your server, and allows your integration to operate in a PCI-compliant way. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
If you cannot use client-side tokenization, you can also create tokens using the API with either your publishable or secret API key. Keep in mind that if your integration uses this method, you are responsible for any PCI compliance that may be required, and you must keep your secret API key safe. Unlike with client-side tokenization, your customer's information is not sent directly to Stripe, so Stripe cannot determine how it is handled or stored. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Tokens cannot be stored or used more than once. To store card or bank account information for later use, you can create Customer objects (L<Net::API::Stripe::Customer> / L<https://stripe.com/docs/api#customers>) or Custom accounts (L<Net::API::Stripe::Connect::ExternalAccount::Bank> and L<Net::API::Stripe::Connect::ExternalAccount::Card> / L<https://stripe.com/docs/api#external_accounts>). Note that Radar (L<https://stripe.com/docs/radar>), Stripe's integrated solution for automatic fraud protection, supports only integrations that use client-side tokenization. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=over 4 |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item B<new>( %ARG ) |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Creates a new L<Net::API::Stripe::Token> object. |
79
|
|
|
|
|
|
|
It may also take an hash like arguments, that also are method of the same name. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=back |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 METHODS |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=over 4 |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item B<id> string |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Unique identifier for the object. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item B<object> string, value is "token" |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
String representing the objectâs type. Objects of the same type share the same value. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item B<bank_account> hash |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Hash describing the bank account. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This is a L<Net::API::Stripe::Payment::BankAccount> object. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item B<card> hash |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Hash describing the card used to make the charge. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This is a L<Net::API::Stripe::Payment::Card> object. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item B<client_ip> string |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
IP address of the client that generated the token. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item B<created> timestamp |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Time at which the object was created. Measured in seconds since the Unix epoch. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item B<livemode> boolean |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Has the value true if the object exists in live mode or the value false if the object exists in test mode. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item B<type> string |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Type of the token: account, bank_account, card, or pii. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item B<used> boolean |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Whether this token has already been used (tokens can be used only once). |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=back |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 API SAMPLE |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
{ |
132
|
|
|
|
|
|
|
"id": "tok_fake123456789", |
133
|
|
|
|
|
|
|
"object": "token", |
134
|
|
|
|
|
|
|
"card": { |
135
|
|
|
|
|
|
|
"id": "card_fake123456789", |
136
|
|
|
|
|
|
|
"object": "card", |
137
|
|
|
|
|
|
|
"address_city": null, |
138
|
|
|
|
|
|
|
"address_country": null, |
139
|
|
|
|
|
|
|
"address_line1": null, |
140
|
|
|
|
|
|
|
"address_line1_check": null, |
141
|
|
|
|
|
|
|
"address_line2": null, |
142
|
|
|
|
|
|
|
"address_state": null, |
143
|
|
|
|
|
|
|
"address_zip": null, |
144
|
|
|
|
|
|
|
"address_zip_check": null, |
145
|
|
|
|
|
|
|
"brand": "Visa", |
146
|
|
|
|
|
|
|
"country": "US", |
147
|
|
|
|
|
|
|
"cvc_check": null, |
148
|
|
|
|
|
|
|
"dynamic_last4": null, |
149
|
|
|
|
|
|
|
"exp_month": 8, |
150
|
|
|
|
|
|
|
"exp_year": 2020, |
151
|
|
|
|
|
|
|
"fingerprint": "x18XyLUPM6hub5xz", |
152
|
|
|
|
|
|
|
"funding": "credit", |
153
|
|
|
|
|
|
|
"last4": "4242", |
154
|
|
|
|
|
|
|
"metadata": {}, |
155
|
|
|
|
|
|
|
"name": null, |
156
|
|
|
|
|
|
|
"tokenization_method": null |
157
|
|
|
|
|
|
|
}, |
158
|
|
|
|
|
|
|
"client_ip": null, |
159
|
|
|
|
|
|
|
"created": 1571314413, |
160
|
|
|
|
|
|
|
"livemode": false, |
161
|
|
|
|
|
|
|
"type": "card", |
162
|
|
|
|
|
|
|
"used": false |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 HISTORY |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head2 v0.1 |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Initial version |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 AUTHOR |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 SEE ALSO |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Stripe API documentation: |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
L<https://stripe.com/docs/api/tokens>, L<https://stripe.com/docs/payments/cards/collecting/web#create-token> |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Copyright (c) 2019-2020 DEGUEST Pte. Ltd. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
You can use, copy, modify and redistribute this package and associated |
186
|
|
|
|
|
|
|
files under the same terms as Perl itself. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=cut |