File Coverage

lib/Net/API/Stripe/Payout.pm
Criterion Covered Total %
statement 19 41 46.3
branch n/a
condition n/a
subroutine 7 29 24.1
pod 22 22 100.0
total 48 92 52.1


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Payout.pm
3             ## Version v0.100.0
4             ## Copyright(c) 2020 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/payouts
11             package Net::API::Stripe::Payout;
12             BEGIN
13             {
14 2     2   21297543 use strict;
  2         14  
  2         64  
15 2     2   12 use warnings;
  2         4  
  2         61  
16 2     2   12 use parent qw( Net::API::Stripe::Generic );
  2         8  
  2         15  
17 2     2   141 use vars qw( $VERSION );
  2         6  
  2         114  
18 2     2   52 our( $VERSION ) = 'v0.100.0';
19             };
20              
21 2     2   12 use strict;
  2         7  
  2         41  
22 2     2   10 use warnings;
  2         6  
  2         1369  
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 amount { return( shift->_set_get_number( 'amount', @_ ) ); }
29              
30 0     0 1   sub arrival_date { return( shift->_set_get_datetime( 'arrival_date', @_ ) ); }
31              
32 0     0 1   sub automatic { return( shift->_set_get_boolean( 'automatic', @_ ) ); }
33              
34 0     0 1   sub balance_transaction { return( shift->_set_get_scalar_or_object( 'balance_transaction', 'Net::API::Stripe::Balance::Transaction', @_ ) ); }
35              
36 0     0 1   sub created { return( shift->_set_get_datetime( 'created', @_ ) ); }
37              
38 0     0 1   sub currency { return( shift->_set_get_scalar( 'currency', @_ ) ); }
39              
40 0     0 1   sub description { return( shift->_set_get_scalar( 'description', @_ ) ); }
41              
42 0     0 1   sub destination { return( shift->_set_get_scalar_or_object( 'destination', 'Net::API::Stripe::Connect::Account', @_ ) ); }
43              
44 0     0 1   sub failure_balance_transaction { return( shift->_set_get_scalar_or_object( 'failure_balance_transaction', 'Net::API::Stripe::Balance::Transaction', @_ ) ); }
45              
46 0     0 1   sub failure_code { return( shift->_set_get_scalar( 'failure_code', @_ ) ); }
47              
48 0     0 1   sub failure_message { return( shift->_set_get_scalar( 'failure_message', @_ ) ); }
49              
50 0     0 1   sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); }
51              
52 0     0 1   sub metadata { return( shift->_set_get_hash( 'metadata', @_ ) ); }
53              
54 0     0 1   sub method { return( shift->_set_get_scalar( 'method', @_ ) ); }
55              
56 0     0 1   sub original_payout { return( shift->_set_get_scalar_or_object( 'original_payout', 'Net::API::Stripe::Payout', @_ ) ); }
57              
58 0     0 1   sub reversed_by { return( shift->_set_get_scalar_or_object( 'reversed_by', 'Net::API::Stripe::Payout', @_ ) ); }
59              
60 0     0 1   sub source_type { return( shift->_set_get_scalar( 'source_type', @_ ) ); }
61              
62 0     0 1   sub statement_descriptor { return( shift->_set_get_scalar( 'statement_descriptor', @_ ) ); }
63              
64 0     0 1   sub status { return( shift->_set_get_scalar( 'status', @_ ) ); }
65              
66 0     0 1   sub type { return( shift->_set_get_scalar( 'type', @_ ) ); }
67              
68             1;
69              
70             __END__
71              
72             =encoding utf8
73              
74             =head1 NAME
75              
76             Net::API::Stripe::Payout - A Stripe Payout Object
77              
78             =head1 SYNOPSIS
79              
80             my $payout = $stripe->payout({
81             amount => 2000,
82             arrival_date => '2020-04-12',
83             automatic => $stripe->true,
84             currency => 'jpy',
85             description => 'Customer payout',
86             destination => $connect_account_object,
87             livemode => $stripe->false,
88             metadata => { transaction_id => 123, customer_id => 456 },
89             method => 'standard',
90             statement_descriptor => 'Fund raised payout',
91             status => 'pending',
92             type => 'bank_account',
93             });
94              
95             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
96              
97             =head1 VERSION
98              
99             v0.100.0
100              
101             =head1 DESCRIPTION
102              
103             A Payout object is created when you receive funds from Stripe, or when you initiate a payout to either a bank account or debit card of a connected Stripe account (L<https://stripe.com/docs/connect/payouts>). You can retrieve individual payouts, as well as list all payouts. Payouts are made on varying schedules, depending on your country and industry.
104              
105             =head1 CONSTRUCTOR
106              
107             =head2 new( %ARG )
108              
109             Creates a new L<Net::API::Stripe::Payout> object.
110             It may also take an hash like arguments, that also are method of the same name.
111              
112             =head1 METHODS
113              
114             =head2 id string
115              
116             Unique identifier for the object.
117              
118             =head2 object string, value is "payout"
119              
120             String representing the object’s type. Objects of the same type share the same value.
121              
122             =head2 amount integer
123              
124             Amount (in JPY) to be transferred to your bank account or debit card.
125              
126             =head2 arrival_date timestamp
127              
128             Date the payout is expected to arrive in the bank. This factors in delays like weekends or bank holidays.
129              
130             =head2 automatic boolean
131              
132             Returns true if the payout was created by an automated payout schedule (L<https://stripe.com/docs/payouts#payout-schedule>), and false if it was requested manually (L<https://stripe.com/docs/payouts#manual-payouts>).
133              
134             =head2 balance_transaction string (expandable)
135              
136             ID of the balance transaction that describes the impact of this payout on your account balance. This is a string or a L<Net::API::Stripe::Balance::Transaction> object.
137              
138             =head2 created timestamp
139              
140             Time at which the object was created. Measured in seconds since the Unix epoch.
141              
142             =head2 currency currency
143              
144             Three-letter ISO currency code (L<https://www.iso.org/iso-4217-currency-codes.html>), in lowercase. Must be a supported currency (L<https://stripe.com/docs/currencies>).
145              
146             =head2 description string
147              
148             An arbitrary string attached to the object. Often useful for displaying to users.
149              
150             =head2 destination string expandable card or bank account
151              
152             ID of the bank account or card the payout was sent to. This is a string or a L<Net::API::Stripe::Connect::Account> object.
153              
154             =head2 failure_balance_transaction string (expandable)
155              
156             If the payout failed or was canceled, this will be the ID of the balance transaction that reversed the initial balance transaction, and puts the funds from the failed payout back in your balance. Alternatively it can also be the L<Net::API::Stripe::Balance::Transaction> object if it was expanded.
157              
158             =head2 failure_code string
159              
160             Error code explaining reason for payout failure if available. See Types of payout failures (L<https://stripe.com/docs/api#payout_failures>) for a list of failure codes.
161              
162             =head2 failure_message string
163              
164             Message to user further explaining reason for payout failure if available.
165              
166             =head2 livemode boolean
167              
168             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
169              
170             =head2 metadata hash
171              
172             Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
173              
174             =head2 method string
175              
176             The method used to send this payout, which can be standard or instant. instant is only supported for payouts to debit cards. (See Instant payouts for marketplaces for more information: L<https://stripe.com/blog/instant-payouts-for-marketplaces>)
177              
178             =head2 original_payout expandable
179              
180             If the payout reverses another, this is the ID of the original payout.
181              
182             When expanded this is an L<Net::API::Stripe::Payout> object.
183              
184             =head2 reversed_by expandable
185              
186             If the payout was reversed, this is the ID of the payout that reverses this payout.
187              
188             When expanded this is an L<Net::API::Stripe::Payout> object.
189              
190             =head2 source_type string
191              
192             The source balance this payout came from. One of card or bank_account.
193              
194             =head2 statement_descriptor string
195              
196             Extra information about a payout to be displayed on the user’s bank statement.
197              
198             =head2 status string
199              
200             Current status of the payout (paid, pending, in_transit, canceled or failed). A payout will be pending until it is submitted to the bank, at which point it becomes in_transit. It will then change to paid if the transaction goes through. If it does not go through successfully, its status will change to failed or canceled.
201              
202             =head2 type string
203              
204             Can be bank_account or card.
205              
206             =head1 API SAMPLE
207              
208             {
209             "id": "po_fake123456789",
210             "object": "payout",
211             "amount": 7712,
212             "arrival_date": 1568851200,
213             "automatic": true,
214             "balance_transaction": "txn_fake123456789",
215             "created": 1568682616,
216             "currency": "jpy",
217             "description": "STRIPE PAYOUT",
218             "destination": "ba_fake123456789",
219             "failure_balance_transaction": null,
220             "failure_code": null,
221             "failure_message": null,
222             "livemode": false,
223             "metadata": {},
224             "method": "standard",
225             "source_type": "card",
226             "statement_descriptor": null,
227             "status": "paid",
228             "type": "bank_account"
229             }
230              
231             =head1 HISTORY
232              
233             =head2 v0.100.0
234              
235             Initial version
236              
237             =head1 STRIPE HISTORY
238              
239             =head2 2017-04-06
240              
241             Splits the Transfer object into Payout and Transfer. The Payout object represents money moving from a Stripe account to an external account (bank or debit card). The Transfer object now only represents money moving between Stripe accounts on a Connect platform. For more details, see L<https://stripe.com/docs/transfer-payout-split>.
242              
243             =head1 AUTHOR
244              
245             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
246              
247             =head1 SEE ALSO
248              
249             Stripe API documentation:
250              
251             L<https://stripe.com/docs/api/payouts>,
252             L<https://stripe.com/docs/payouts>
253              
254             =head1 COPYRIGHT & LICENSE
255              
256             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
257              
258             You can use, copy, modify and redistribute this package and associated
259             files under the same terms as Perl itself.
260              
261             =cut