File Coverage

lib/Net/API/Stripe/Token.pm
Criterion Covered Total %
statement 19 28 67.8
branch n/a
condition n/a
subroutine 7 16 43.7
pod 9 9 100.0
total 35 53 66.0


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 <jack@deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2020/05/15
8             ##
9             ##----------------------------------------------------------------------------
10             ## https://stripe.com/docs/api/tokens/object
11             BEGIN
12             {
13             use strict;
14 2     2   23912698 use warnings;
  2         14  
  2         64  
15 2     2   11 use parent qw( Net::API::Stripe::Generic );
  2         6  
  2         69  
16 2     2   11 use vars qw( $VERSION );
  2         5  
  2         16  
17 2     2   219 our( $VERSION ) = 'v0.100.0';
  2         3  
  2         125  
18 2     2   38 };
19              
20             use strict;
21 2     2   11 use warnings;
  2         3  
  2         39  
22 2     2   10  
  2         5  
  2         433  
23              
24 0     0 1    
25              
26 0     0 1    
27              
28 0     0 1    
29              
30 0     0 1   ## account, bank_account, card, person, or pii
31              
32 0     0 1    
33             1;
34 0     0 1   # NOTE: POD
35              
36 0     0 1   =encoding utf8
37              
38             =head1 NAME
39 0     0 1    
40             Net::API::Stripe::Token - A Stripe Token Object
41 0     0 1    
42             =head1 SYNOPSIS
43              
44             my $token = $stripe->token({
45             card => $card_object,
46             client_ip => '1.2.3.4',
47             livemode => $stripe->false,
48             type => 'card',
49             used => $stripe->false,
50             });
51              
52             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
53              
54             =head1 VERSION
55              
56             v0.100.0
57              
58             =head1 DESCRIPTION
59              
60             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.
61              
62             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.
63              
64             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.
65              
66             =head1 CONSTRUCTOR
67              
68             =head2 new( %ARG )
69              
70             Creates a new L<Net::API::Stripe::Token> object.
71             It may also take an hash like arguments, that also are method of the same name.
72              
73             =head1 METHODS
74              
75             =head2 id string
76              
77             Unique identifier for the object.
78              
79             =head2 object string, value is "token"
80              
81             String representing the object’s type. Objects of the same type share the same value.
82              
83             =head2 bank_account hash
84              
85             Hash describing the bank account.
86              
87             This is a L<Net::API::Stripe::Payment::BankAccount> object.
88              
89             =head2 card hash
90              
91             Hash describing the card used to make the charge.
92              
93             This is a L<Net::API::Stripe::Payment::Card> object.
94              
95             =head2 client_ip string
96              
97             IP address of the client that generated the token.
98              
99             =head2 created timestamp
100              
101             Time at which the object was created. Measured in seconds since the Unix epoch.
102              
103             =head2 livemode boolean
104              
105             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
106              
107             =head2 type string
108              
109             Type of the token: account, bank_account, card, or pii.
110              
111             =head2 used boolean
112              
113             Whether this token has already been used (tokens can be used only once).
114              
115             =head1 API SAMPLE
116              
117             {
118             "id": "tok_fake123456789",
119             "object": "token",
120             "card": {
121             "id": "card_fake123456789",
122             "object": "card",
123             "address_city": null,
124             "address_country": null,
125             "address_line1": null,
126             "address_line1_check": null,
127             "address_line2": null,
128             "address_state": null,
129             "address_zip": null,
130             "address_zip_check": null,
131             "brand": "Visa",
132             "country": "US",
133             "cvc_check": null,
134             "dynamic_last4": null,
135             "exp_month": 8,
136             "exp_year": 2020,
137             "fingerprint": "x18XyLUPM6hub5xz",
138             "funding": "credit",
139             "last4": "4242",
140             "metadata": {},
141             "name": null,
142             "tokenization_method": null
143             },
144             "client_ip": null,
145             "created": 1571314413,
146             "livemode": false,
147             "type": "card",
148             "used": false
149             }
150              
151             =head1 HISTORY
152              
153             =head2 v0.1
154              
155             Initial version
156              
157             =head1 AUTHOR
158              
159             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
160              
161             =head1 SEE ALSO
162              
163             Stripe API documentation:
164              
165             L<https://stripe.com/docs/api/tokens>, L<https://stripe.com/docs/payments/cards/collecting/web#create-token>
166              
167             =head1 COPYRIGHT & LICENSE
168              
169             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
170              
171             You can use, copy, modify and redistribute this package and associated
172             files under the same terms as Perl itself.
173              
174             =cut