File Coverage

lib/Net/API/Stripe/Refund.pm
Criterion Covered Total %
statement 19 38 50.0
branch n/a
condition n/a
subroutine 7 26 26.9
pod 19 19 100.0
total 45 83 54.2


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Refund.pm
3             ## Version v0.101.0
4             ## Copyright(c) 2019 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2022/10/29
8             ##
9             ##----------------------------------------------------------------------------
10             ## https://stripe.com/docs/api/refunds
11             BEGIN
12             {
13             use strict;
14 2     2   26163579 use warnings;
  2         13  
  2         103  
15 2     2   13 use parent qw( Net::API::Stripe::Generic );
  2         5  
  2         63  
16 2     2   10 use vars qw( $VERSION );
  2         4  
  2         11  
17 2     2   144 our( $VERSION ) = 'v0.101.0';
  2         6  
  2         111  
18 2     2   44 };
19              
20             use strict;
21 2     2   11 use warnings;
  2         5  
  2         53  
22 2     2   11  
  2         2  
  2         971  
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   display_details => {
37             definition => {
38 0     0 1   email_sent => {
39             definition => {
40 0     0 1   email_sent_at => { type => "datetime" },
41             email_sent_to => { type => "scalar" },
42 0     0 1   },
43             type => "class",
44 0     0 1   },
45             expires_at => { type => "datetime" },
46 0     0 1   },
47             type => "class",
48 0     0 1   },
49             type => { type => "scalar" },
50             }, @_ ) ); }
51              
52              
53              
54              
55              
56              
57              
58             1;
59              
60              
61             =encoding utf8
62              
63             =head1 NAME
64              
65             Net::API::Stripe::Refund - A Stripe Refund Object
66 0     0 1    
67             =head1 SYNOPSIS
68 0     0 1    
69             my $refund = $stripe->refund({
70 0     0 1   amount => 2000,
71             charge => $charge_object,
72 0     0 1   currency => 'jpy',
73             description => 'Cancelled service order',
74 0     0 1   metadata => { transaction_id => 123, customer_id => 456 },
75             reason => 'requested_by_customer',
76 0     0 1   });
77              
78             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
79              
80             =head1 VERSION
81              
82             v0.101.0
83              
84             =head1 DESCRIPTION
85              
86             Refund objects allow you to refund a charge that has previously been created but not yet refunded. Funds will be refunded to the credit or debit card that was originally charged.
87              
88             =head1 CONSTRUCTOR
89              
90             =head2 new( %ARG )
91              
92             Creates a new L<Net::API::Stripe::Refund> object.
93             It may also take an hash like arguments, that also are method of the same name.
94              
95             =head1 METHODS
96              
97             =head2 id string
98              
99             Unique identifier for the object.
100              
101             =head2 object string, value is "refund"
102              
103             String representing the object’s type. Objects of the same type share the same value.
104              
105             =head2 amount integer
106              
107             Amount, in JPY.
108              
109             =head2 balance_transaction string (expandable)
110              
111             Balance transaction that describes the impact on your account balance.
112              
113             When expanded, this is a L<Net::API::Stripe::Balance::Transaction> object.
114              
115             =head2 charge string (expandable)
116              
117             ID of the charge that was refunded. When expanded, this is a L<Net::API::Stripe::Charge> object.
118              
119             =head2 created timestamp
120              
121             Time at which the object was created. Measured in seconds since the Unix epoch. This is a C<DateTime> object.
122              
123             =head2 currency currency
124              
125             Three-letter ISO currency code, in lowercase. Must be a supported currency.
126              
127             =head2 description string
128              
129             An arbitrary string attached to the object. Often useful for displaying to users. (Available on non-card refunds only)
130              
131             =head2 failure_balance_transaction string (expandable)
132              
133             If the refund failed, this balance transaction describes the adjustment made on your account balance that reverses the initial balance transaction. This is a L<Net::API::Stripe::Balance::Transaction>
134              
135             =head2 failure_reason string
136              
137             If the refund failed, the reason for refund failure if known. Possible values are lost_or_stolen_card, expired_or_canceled_card, or unknown.
138              
139             =head2 instructions_email string
140              
141             Email to which refund instructions, if required, are sent to.
142              
143             =head2 metadata hash
144              
145             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.
146              
147             =head2 next_action hash
148              
149             If the refund has a status of C<requires_action>, this property will describe what the refund needs in order to continue processing.
150              
151             It has the following properties:
152              
153             =over 4
154              
155             =item C<display_details> hash
156              
157             Contains the refund details.
158              
159             =over 8
160              
161             =item C<email_sent> hash
162              
163             Contains information about the email sent to the customer.
164              
165             =over 12
166              
167             =item C<email_sent_at> timestamp
168              
169             The timestamp when the email was sent.
170              
171             =item C<email_sent_to> string
172              
173             The recipient's email address.
174              
175              
176             =back
177              
178             =item C<expires_at> timestamp
179              
180             The expiry timestamp.
181              
182              
183             =back
184              
185             =item C<type> string
186              
187             Type of the next action to perform.
188              
189             =back
190              
191             =head2 payment_intent expandable
192              
193             ID of the PaymentIntent that was refunded.
194              
195             When expanded this is an L<Net::API::Stripe::PaymentIntent> object.
196              
197             =head2 reason string
198              
199             Reason for the refund. If set, possible values are duplicate, fraudulent, and requested_by_customer.
200              
201             =head2 receipt_number string
202              
203             This is the transaction number that appears on email receipts sent for this refund.
204              
205             =head2 source_transfer_reversal string (expandable)
206              
207             The transfer reversal that is associated with the refund. Only present if the charge came from another Stripe account. See the Connect documentation for details. This is a L<Net::API::Stripe::Connect::Transfer::Reversal>
208              
209             =head2 status string
210              
211             Status of the refund. For credit card refunds, this can be pending, succeeded, or failed. For other types of refunds, it can be pending, succeeded, failed, or canceled. Refer to L<Stripe refunds documentation|https://stripe.com/docs/refunds#failed-refunds> for more details.
212              
213             =head2 transfer_reversal string (expandable)
214              
215             If the accompanying transfer was reversed, the transfer reversal object. Only applicable if the charge was created using the destination parameter. This is a L<Net::API::Stripe::Connect::Transfer::Reversal> object.
216              
217             =head1 API SAMPLE
218              
219             {
220             "id": "re_fake123456789",
221             "object": "refund",
222             "amount": 30200,
223             "balance_transaction": "txn_fake123456789",
224             "charge": "ch_fake123456789",
225             "created": 1540736617,
226             "currency": "jpy",
227             "metadata": {},
228             "reason": null,
229             "receipt_number": null,
230             "source_transfer_reversal": null,
231             "status": "succeeded",
232             "transfer_reversal": null
233             }
234              
235             =head1 HISTORY
236              
237             =head2 v0.1
238              
239             Initial version
240              
241             =head1 AUTHOR
242              
243             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
244              
245             =head1 SEE ALSO
246              
247             Stripe API documentation:
248              
249             L<https://stripe.com/docs/api/refunds>, L<https://stripe.com/docs/refunds>
250              
251             =head1 COPYRIGHT & LICENSE
252              
253             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
254              
255             You can use, copy, modify and redistribute this package and associated
256             files under the same terms as Perl itself.
257              
258             =cut