Class: Stripe::Payout

Inherits:
APIResource show all
Extended by:
APIOperations::Create, APIOperations::List
Includes:
APIOperations::Save
Defined in:
lib/stripe/resources/payout.rb

Overview

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](stripe.com/docs/connect/bank-debit-card-payouts). You can retrieve individual payouts, and list all payouts. Payouts are made on [varying schedules](stripe.com/docs/connect/manage-payout-schedule), depending on your country and industry.

Related guide: [Receiving payouts](stripe.com/docs/payouts)

Defined Under Namespace

Classes: CancelParams, CreateParams, ListParams, RetrieveParams, ReverseParams, TraceId, UpdateParams

Constant Summary collapse

OBJECT_NAME =
"payout"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary collapse

Attributes inherited from APIResource

#save_with_parent

Attributes inherited from StripeObject

#last_response

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::Create

create

Methods included from APIOperations::List

list

Methods included from APIOperations::Save

included, #save

Methods inherited from APIResource

class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource

Methods included from APIOperations::Request

included

Methods inherited from StripeObject

#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values

Constructor Details

This class inherits a constructor from Stripe::StripeObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject

Instance Attribute Details

#amountObject (readonly)

The amount (in cents (or local equivalent)) that transfers to your bank account or debit card.



189
190
191
# File 'lib/stripe/resources/payout.rb', line 189

def amount
  @amount
end

#application_feeObject (readonly)

The application fee (if any) for the payout. [See the Connect documentation](stripe.com/docs/connect/instant-payouts#monetization-and-fees) for details.



191
192
193
# File 'lib/stripe/resources/payout.rb', line 191

def application_fee
  @application_fee
end

#application_fee_amountObject (readonly)

The amount of the application fee (if any) requested for the payout. [See the Connect documentation](stripe.com/docs/connect/instant-payouts#monetization-and-fees) for details.



193
194
195
# File 'lib/stripe/resources/payout.rb', line 193

def application_fee_amount
  @application_fee_amount
end

#arrival_dateObject (readonly)

Date that you can expect the payout to arrive in the bank. This factors in delays to account for weekends or bank holidays.



195
196
197
# File 'lib/stripe/resources/payout.rb', line 195

def arrival_date
  @arrival_date
end

#automaticObject (readonly)

Returns ‘true` if the payout is created by an [automated payout schedule](stripe.com/docs/payouts#payout-schedule) and `false` if it’s [requested manually](stripe.com/docs/payouts#manual-payouts).



197
198
199
# File 'lib/stripe/resources/payout.rb', line 197

def automatic
  @automatic
end

#balance_transactionObject (readonly)

ID of the balance transaction that describes the impact of this payout on your account balance.



199
200
201
# File 'lib/stripe/resources/payout.rb', line 199

def balance_transaction
  @balance_transaction
end

#createdObject (readonly)

Time at which the object was created. Measured in seconds since the Unix epoch.



201
202
203
# File 'lib/stripe/resources/payout.rb', line 201

def created
  @created
end

#currencyObject (readonly)

Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](stripe.com/docs/currencies).



203
204
205
# File 'lib/stripe/resources/payout.rb', line 203

def currency
  @currency
end

#descriptionObject (readonly)

An arbitrary string attached to the object. Often useful for displaying to users.



205
206
207
# File 'lib/stripe/resources/payout.rb', line 205

def description
  @description
end

#destinationObject (readonly)

ID of the bank account or card the payout is sent to.



207
208
209
# File 'lib/stripe/resources/payout.rb', line 207

def destination
  @destination
end

#failure_balance_transactionObject (readonly)

If the payout fails or cancels, this is the ID of the balance transaction that reverses the initial balance transaction and returns the funds from the failed payout back in your balance.



209
210
211
# File 'lib/stripe/resources/payout.rb', line 209

def failure_balance_transaction
  @failure_balance_transaction
end

#failure_codeObject (readonly)

Error code that provides a reason for a payout failure, if available. View our [list of failure codes](stripe.com/docs/api#payout_failures).



211
212
213
# File 'lib/stripe/resources/payout.rb', line 211

def failure_code
  @failure_code
end

#failure_messageObject (readonly)

Message that provides the reason for a payout failure, if available.



213
214
215
# File 'lib/stripe/resources/payout.rb', line 213

def failure_message
  @failure_message
end

#idObject (readonly)

Unique identifier for the object.



215
216
217
# File 'lib/stripe/resources/payout.rb', line 215

def id
  @id
end

#livemodeObject (readonly)

Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.



217
218
219
# File 'lib/stripe/resources/payout.rb', line 217

def livemode
  @livemode
end

#metadataObject (readonly)

Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.



219
220
221
# File 'lib/stripe/resources/payout.rb', line 219

def 
  @metadata
end

#methodObject (readonly)

The method used to send this payout, which can be ‘standard` or `instant`. `instant` is supported for payouts to debit cards and bank accounts in certain countries. Learn more about [bank support for Instant Payouts](stripe.com/docs/payouts/instant-payouts-banks).



221
222
223
# File 'lib/stripe/resources/payout.rb', line 221

def method
  @method
end

#objectObject (readonly)

String representing the object’s type. Objects of the same type share the same value.



223
224
225
# File 'lib/stripe/resources/payout.rb', line 223

def object
  @object
end

#original_payoutObject (readonly)

If the payout reverses another, this is the ID of the original payout.



225
226
227
# File 'lib/stripe/resources/payout.rb', line 225

def original_payout
  @original_payout
end

#reconciliation_statusObject (readonly)

If ‘completed`, you can use the [Balance Transactions API](stripe.com/docs/api/balance_transactions/list#balance_transaction_list-payout) to list all balance transactions that are paid out in this payout.



227
228
229
# File 'lib/stripe/resources/payout.rb', line 227

def reconciliation_status
  @reconciliation_status
end

#reversed_byObject (readonly)

If the payout reverses, this is the ID of the payout that reverses this payout.



229
230
231
# File 'lib/stripe/resources/payout.rb', line 229

def reversed_by
  @reversed_by
end

#source_typeObject (readonly)

The source balance this payout came from, which can be one of the following: ‘card`, `fpx`, or `bank_account`.



231
232
233
# File 'lib/stripe/resources/payout.rb', line 231

def source_type
  @source_type
end

#statement_descriptorObject (readonly)

Extra information about a payout that displays on the user’s bank statement.



233
234
235
# File 'lib/stripe/resources/payout.rb', line 233

def statement_descriptor
  @statement_descriptor
end

#statusObject (readonly)

Current status of the payout: ‘paid`, `pending`, `in_transit`, `canceled` or `failed`. A payout is `pending` until it’s submitted to the bank, when it becomes ‘in_transit`. The status changes to `paid` if the transaction succeeds, or to `failed` or `canceled` (within 5 business days). Some payouts that fail might initially show as `paid`, then change to `failed`.



235
236
237
# File 'lib/stripe/resources/payout.rb', line 235

def status
  @status
end

#trace_idObject (readonly)

A value that generates from the beneficiary’s bank that allows users to track payouts with their bank. Banks might call this a “reference number” or something similar.



237
238
239
# File 'lib/stripe/resources/payout.rb', line 237

def trace_id
  @trace_id
end

#typeObject (readonly)

Can be ‘bank_account` or `card`.



239
240
241
# File 'lib/stripe/resources/payout.rb', line 239

def type
  @type
end

Class Method Details

.cancel(payout, params = {}, opts = {}) ⇒ Object

You can cancel a previously created payout if its status is pending. Stripe refunds the funds to your available balance. You can’t cancel automatic Stripe payouts.



252
253
254
255
256
257
258
259
# File 'lib/stripe/resources/payout.rb', line 252

def self.cancel(payout, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/payouts/%<payout>s/cancel", { payout: CGI.escape(payout) }),
    params: params,
    opts: opts
  )
end

.create(params = {}, opts = {}) ⇒ Object

To send funds to your own bank account, create a new payout object. Your [Stripe balance](stripe.com/docs/api#balance) must cover the payout amount. If it doesn’t, you receive an “Insufficient Funds” error.

If your API key is in test mode, money won’t actually be sent, though every other action occurs as if you’re in live mode.

If you create a manual payout on a Stripe account that uses multiple payment source types, you need to specify the source type balance that the payout draws from. The [balance object](stripe.com/docs/api#balance_object) details available and pending amounts by source type.



266
267
268
# File 'lib/stripe/resources/payout.rb', line 266

def self.create(params = {}, opts = {})
  request_stripe_object(method: :post, path: "/v1/payouts", params: params, opts: opts)
end

.list(params = {}, opts = {}) ⇒ Object

Returns a list of existing payouts sent to third-party bank accounts or payouts that Stripe sent to you. The payouts return in sorted order, with the most recently created payouts appearing first.



271
272
273
# File 'lib/stripe/resources/payout.rb', line 271

def self.list(params = {}, opts = {})
  request_stripe_object(method: :get, path: "/v1/payouts", params: params, opts: opts)
end

.object_nameObject



19
20
21
# File 'lib/stripe/resources/payout.rb', line 19

def self.object_name
  "payout"
end

.reverse(payout, params = {}, opts = {}) ⇒ Object

Reverses a payout by debiting the destination bank account. At this time, you can only reverse payouts for connected accounts to US bank accounts. If the payout is manual and in the pending status, use /v1/payouts/:id/cancel instead.

By requesting a reversal through /v1/payouts/:id/reverse, you confirm that the authorized signatory of the selected bank account authorizes the debit on the bank account and that no other authorization is required.



290
291
292
293
294
295
296
297
# File 'lib/stripe/resources/payout.rb', line 290

def self.reverse(payout, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(payout) }),
    params: params,
    opts: opts
  )
end

.update(payout, params = {}, opts = {}) ⇒ Object

Updates the specified payout by setting the values of the parameters you pass. We don’t change parameters that you don’t provide. This request only accepts the metadata as arguments.



300
301
302
303
304
305
306
307
# File 'lib/stripe/resources/payout.rb', line 300

def self.update(payout, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/payouts/%<payout>s", { payout: CGI.escape(payout) }),
    params: params,
    opts: opts
  )
end

Instance Method Details

#cancel(params = {}, opts = {}) ⇒ Object

You can cancel a previously created payout if its status is pending. Stripe refunds the funds to your available balance. You can’t cancel automatic Stripe payouts.



242
243
244
245
246
247
248
249
# File 'lib/stripe/resources/payout.rb', line 242

def cancel(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/payouts/%<payout>s/cancel", { payout: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

#reverse(params = {}, opts = {}) ⇒ Object

Reverses a payout by debiting the destination bank account. At this time, you can only reverse payouts for connected accounts to US bank accounts. If the payout is manual and in the pending status, use /v1/payouts/:id/cancel instead.

By requesting a reversal through /v1/payouts/:id/reverse, you confirm that the authorized signatory of the selected bank account authorizes the debit on the bank account and that no other authorization is required.



278
279
280
281
282
283
284
285
# File 'lib/stripe/resources/payout.rb', line 278

def reverse(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end