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             BEGIN
12             {
13             use strict;
14 2     2   23940101 use warnings;
  2         15  
  2         63  
15 2     2   10 use parent qw( Net::API::Stripe::Generic );
  2         4  
  2         57  
16 2     2   10 use vars qw( $VERSION );
  2         3  
  2         10  
17 2     2   141 our( $VERSION ) = 'v0.100.0';
  2         4  
  2         115  
18 2     2   76 };
19              
20             use strict;
21 2     2   12 use warnings;
  2         4  
  2         64  
22 2     2   12  
  2         4  
  2         1049  
23              
24 0     0 1    
25              
26 0     0 1    
27              
28 0     0 1    
29              
30 0     0 1    
31              
32 0     0 1    
33              
34 0     0 1    
35              
36 0     0 1    
37              
38 0     0 1    
39              
40 0     0 1    
41              
42 0     0 1    
43              
44 0     0 1    
45             1;
46 0     0 1    
47              
48 0     0 1   =encoding utf8
49              
50 0     0 1   =head1 NAME
51              
52 0     0 1   Net::API::Stripe::Payout - A Stripe Payout Object
53              
54 0     0 1   =head1 SYNOPSIS
55              
56 0     0 1   my $payout = $stripe->payout({
57             amount => 2000,
58 0     0 1   arrival_date => '2020-04-12',
59             automatic => $stripe->true,
60 0     0 1   currency => 'jpy',
61             description => 'Customer payout',
62 0     0 1   destination => $connect_account_object,
63             livemode => $stripe->false,
64 0     0 1   metadata => { transaction_id => 123, customer_id => 456 },
65             method => 'standard',
66 0     0 1   statement_descriptor => 'Fund raised payout',
67             status => 'pending',
68             type => 'bank_account',
69             });
70              
71             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
72              
73             =head1 VERSION
74              
75             v0.100.0
76              
77             =head1 DESCRIPTION
78              
79             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.
80              
81             =head1 CONSTRUCTOR
82              
83             =head2 new( %ARG )
84              
85             Creates a new L<Net::API::Stripe::Payout> object.
86             It may also take an hash like arguments, that also are method of the same name.
87              
88             =head1 METHODS
89              
90             =head2 id string
91              
92             Unique identifier for the object.
93              
94             =head2 object string, value is "payout"
95              
96             String representing the object’s type. Objects of the same type share the same value.
97              
98             =head2 amount integer
99              
100             Amount (in JPY) to be transferred to your bank account or debit card.
101              
102             =head2 arrival_date timestamp
103              
104             Date the payout is expected to arrive in the bank. This factors in delays like weekends or bank holidays.
105              
106             =head2 automatic boolean
107              
108             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>).
109              
110             =head2 balance_transaction string (expandable)
111              
112             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.
113              
114             =head2 created timestamp
115              
116             Time at which the object was created. Measured in seconds since the Unix epoch.
117              
118             =head2 currency currency
119              
120             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>).
121              
122             =head2 description string
123              
124             An arbitrary string attached to the object. Often useful for displaying to users.
125              
126             =head2 destination string expandable card or bank account
127              
128             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.
129              
130             =head2 failure_balance_transaction string (expandable)
131              
132             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.
133              
134             =head2 failure_code string
135              
136             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.
137              
138             =head2 failure_message string
139              
140             Message to user further explaining reason for payout failure if available.
141              
142             =head2 livemode boolean
143              
144             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
145              
146             =head2 metadata hash
147              
148             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.
149              
150             =head2 method string
151              
152             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>)
153              
154             =head2 original_payout expandable
155              
156             If the payout reverses another, this is the ID of the original payout.
157              
158             When expanded this is an L<Net::API::Stripe::Payout> object.
159              
160             =head2 reversed_by expandable
161              
162             If the payout was reversed, this is the ID of the payout that reverses this payout.
163              
164             When expanded this is an L<Net::API::Stripe::Payout> object.
165              
166             =head2 source_type string
167              
168             The source balance this payout came from. One of card or bank_account.
169              
170             =head2 statement_descriptor string
171              
172             Extra information about a payout to be displayed on the user’s bank statement.
173              
174             =head2 status string
175              
176             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.
177              
178             =head2 type string
179              
180             Can be bank_account or card.
181              
182             =head1 API SAMPLE
183              
184             {
185             "id": "po_fake123456789",
186             "object": "payout",
187             "amount": 7712,
188             "arrival_date": 1568851200,
189             "automatic": true,
190             "balance_transaction": "txn_fake123456789",
191             "created": 1568682616,
192             "currency": "jpy",
193             "description": "STRIPE PAYOUT",
194             "destination": "ba_fake123456789",
195             "failure_balance_transaction": null,
196             "failure_code": null,
197             "failure_message": null,
198             "livemode": false,
199             "metadata": {},
200             "method": "standard",
201             "source_type": "card",
202             "statement_descriptor": null,
203             "status": "paid",
204             "type": "bank_account"
205             }
206              
207             =head1 HISTORY
208              
209             =head2 v0.100.0
210              
211             Initial version
212              
213             =head1 STRIPE HISTORY
214              
215             =head2 2017-04-06
216              
217             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>.
218              
219             =head1 AUTHOR
220              
221             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
222              
223             =head1 SEE ALSO
224              
225             Stripe API documentation:
226              
227             L<https://stripe.com/docs/api/payouts>,
228             L<https://stripe.com/docs/payouts>
229              
230             =head1 COPYRIGHT & LICENSE
231              
232             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
233              
234             You can use, copy, modify and redistribute this package and associated
235             files under the same terms as Perl itself.
236              
237             =cut