File Coverage

lib/Net/API/Stripe/Balance.pm
Criterion Covered Total %
statement 19 26 73.0
branch n/a
condition n/a
subroutine 7 14 50.0
pod 7 7 100.0
total 33 47 70.2


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Balance.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/15
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/balance/balance_object
14             BEGIN
15             {
16             use strict;
17 2     2   24167936 use warnings;
  2         17  
  2         59  
18 2     2   12 use parent qw( Net::API::Stripe::Generic );
  2         4  
  2         57  
19 2     2   10 use vars qw( $VERSION );
  2         3  
  2         11  
20 2     2   144 our( $VERSION ) = 'v0.101.0';
  2         3  
  2         116  
21 2     2   38 };
22              
23             use strict;
24 2     2   10 use warnings;
  2         3  
  2         40  
25 2     2   9  
  2         4  
  2         361  
26              
27 0     0 1   ## Array of Net::API::Stripe::Connect::Transfer
28              
29             ## Array of Net::API::Stripe::Balance::ConnectReserved
30 0     0 1    
31              
32             {
33 0     0 1   available => { type => 'object', package => 'Net::API::Stripe::Balance::Pending' },
34             }, @_ ) ); }
35 0     0 1    
36              
37 0     0 1   # Array of Net::API::Stripe::Balance::Pending
38              
39             1;
40              
41              
42 0     0 1   =encoding utf8
43              
44             =head1 NAME
45 0     0 1    
46             Net::API::Stripe::Balance - The Balance object
47              
48             =head1 SYNOPSIS
49              
50             my $object = $stripe->balances( 'retrieve' ) || die( $stripe->error );
51              
52             =head1 VERSION
53              
54             v0.101.0
55              
56             =head1 DESCRIPTION
57              
58             This is an object representing your Stripe balance. You can retrieve it to see the balance currently on your Stripe account.
59              
60             You can also retrieve the balance history, which contains a list of transactions (L<https://stripe.com/docs/reporting/balance-transaction-types>) that contributed to the balance (charges, payouts, and so forth).
61              
62             The available and pending amounts for each currency are broken down further by payment source types.
63              
64             =head1 CONSTRUCTOR
65              
66             =head2 new( %ARG )
67              
68             Creates a new L<Net::API::Stripe::Balance> object.
69              
70             =head1 METHODS
71              
72             =head2 object string, value is "balance"
73              
74             String representing the object’s type. Objects of the same type share the same value.
75              
76             =head2 available array of L<Net::API::Stripe::Connect::Transfer>
77              
78             Funds that are available to be transferred or paid out, whether automatically by Stripe or explicitly via the Transfers API or Payouts API. The available balance for each currency and payment type can be found in the source_types property.
79              
80             Currently this is an array of L<Net::API::Stripe::Connect::Transfer>, but I am considering revising that in light of the documentation of the Stripe API.
81              
82             =head2 amount integer
83              
84             Balance amount.
85              
86             =head2 currency currency
87              
88             Three-letter ISO currency code, in lowercase. Must be a supported currency.
89              
90             =head2 source_types hash
91              
92             Breakdown of balance by source types.
93              
94             =over 4
95              
96             =item I<bank_account> integer
97              
98             Amount for bank account.
99              
100             =item I<card> integer
101              
102             Amount for card.
103              
104             =back
105              
106             =head2 connect_reserved array of L<Net::API::Stripe::Balance::ConnectReserved> objects.
107              
108             Funds held due to negative balances on connected Custom accounts. The connect reserve balance for each currency and payment type can be found in the source_types property.
109              
110             =over 4
111              
112             =item I<amount> integer
113              
114             Balance amount.
115              
116             =item I<currency> currency
117              
118             Three-letter ISO currency code, in lowercase. Must be a supported currency.
119              
120             =item I<source_types> hash
121              
122             Breakdown of balance by source types.
123              
124             =back
125              
126             =head2 instant_available array of hashes
127              
128             Funds that can be paid out using Instant Payouts.
129              
130             This is a L<Net::API::Stripe::Balance::Pending> object.
131              
132             It contains the following properties:
133              
134             =over 4
135              
136             =item I<amount> integer
137              
138             Balance amount.
139              
140             =item I<currency> number
141              
142             Three-letter ISO currency code, in lowercase. Must be a supported currency.
143              
144             =item I<source_types> hash
145              
146             Breakdown of balance by source types.
147              
148             It contains the following sub properties:
149              
150             =over 8
151              
152             =item I<bank_account> integer
153              
154             Amount for bank account.
155              
156             =item I<card> integer
157              
158             Amount for card.
159              
160             =item I<fpx> integer
161              
162             Amount for FPX.
163              
164             =back
165              
166             =back
167              
168             =head2 issuing hash
169              
170             Funds that can be spent on your Issued Cards.
171              
172             It has the following properties:
173              
174             =over 4
175              
176             =item I<available> array
177              
178             Funds that are available for use.
179              
180             When expanded, this is a L<Net::API::Stripe::Balance::Pending> object.
181              
182             It has the following properties:
183              
184             =over 8
185              
186             =item I<amount> integer
187              
188             Balance amount.
189              
190             =item I<currency> number
191              
192             Three-letter ISO currency code, in lowercase. Must be a supported currency.
193              
194             =item I<source_types> hash
195              
196             Breakdown of balance by source types.
197              
198             It contains the following sub properties:
199              
200             =over 12
201              
202             =item I<bank_account> integer
203              
204             Amount for bank account.
205              
206             =item I<card> integer
207              
208             Amount for card.
209              
210             =item I<fpx> integer
211              
212             Amount for FPX.
213              
214             =back
215              
216             =back
217              
218             =back
219              
220             =head2 livemode boolean
221              
222             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
223              
224             =head2 pending array of L<Net::API::Stripe::Balance::Pending> objects.
225              
226             Funds that are not yet available in the balance, due to the 7-day rolling pay cycle. The pending balance for each currency, and for each payment type, can be found in the source_types property.
227              
228             =over 4
229              
230             =item I<amount> integer
231              
232             Balance amount.
233              
234             =item I<currency> currency
235              
236             Three-letter ISO currency code, in lowercase. Must be a supported currency.
237              
238             =item I<source_types> hash
239              
240             Breakdown of balance by source types.
241              
242             =back
243              
244             =head1 API SAMPLE
245              
246             {
247             "object": "balance",
248             "available": [
249             {
250             "amount": 0,
251             "currency": "jpy",
252             "source_types": {
253             "card": 0
254             }
255             }
256             ],
257             "connect_reserved": [
258             {
259             "amount": 0,
260             "currency": "jpy"
261             }
262             ],
263             "livemode": false,
264             "pending": [
265             {
266             "amount": 7712,
267             "currency": "jpy",
268             "source_types": {
269             "card": 7712
270             }
271             }
272             ]
273             }
274              
275             =head1 HISTORY
276              
277             =head2 v0.100.0
278              
279             Initial version
280              
281             =head1 AUTHOR
282              
283             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
284              
285             =head1 SEE ALSO
286              
287             L<https://stripe.com/docs/api/balance>, L<https://stripe.com/docs/connect/account-balances>
288              
289             =head1 COPYRIGHT & LICENSE
290              
291             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
292              
293             You can use, copy, modify and redistribute this package and associated
294             files under the same terms as Perl itself.
295              
296             =cut