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.



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

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.



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

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.



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

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.



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

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).



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

def automatic
  @automatic
end

#balance_transactionObject (readonly)

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



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

def balance_transaction
  @balance_transaction
end

#createdObject (readonly)

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



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

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).



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

def currency
  @currency
end

#descriptionObject (readonly)

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



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

def description
  @description
end

#destinationObject (readonly)

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



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

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.



243
244
245
# File 'lib/stripe/resources/payout.rb', line 243

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).



246
247
248
# File 'lib/stripe/resources/payout.rb', line 246

def failure_code
  @failure_code
end

#failure_messageObject (readonly)

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



249
250
251
# File 'lib/stripe/resources/payout.rb', line 249

def failure_message
  @failure_message
end

#idObject (readonly)

Unique identifier for the object.



252
253
254
# File 'lib/stripe/resources/payout.rb', line 252

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.



255
256
257
# File 'lib/stripe/resources/payout.rb', line 255

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.



258
259
260
# File 'lib/stripe/resources/payout.rb', line 258

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).



261
262
263
# File 'lib/stripe/resources/payout.rb', line 261

def method
  @method
end

#objectObject (readonly)

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



264
265
266
# File 'lib/stripe/resources/payout.rb', line 264

def object
  @object
end

#original_payoutObject (readonly)

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



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

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.



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

def reconciliation_status
  @reconciliation_status
end

#reversed_byObject (readonly)

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



273
274
275
# File 'lib/stripe/resources/payout.rb', line 273

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`.



276
277
278
# File 'lib/stripe/resources/payout.rb', line 276

def source_type
  @source_type
end

#statement_descriptorObject (readonly)

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



279
280
281
# File 'lib/stripe/resources/payout.rb', line 279

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`.



282
283
284
# File 'lib/stripe/resources/payout.rb', line 282

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.



285
286
287
# File 'lib/stripe/resources/payout.rb', line 285

def trace_id
  @trace_id
end

#typeObject (readonly)

Can be ‘bank_account` or `card`.



288
289
290
# File 'lib/stripe/resources/payout.rb', line 288

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.



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

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.



315
316
317
# File 'lib/stripe/resources/payout.rb', line 315

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.



320
321
322
# File 'lib/stripe/resources/payout.rb', line 320

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.



339
340
341
342
343
344
345
346
# File 'lib/stripe/resources/payout.rb', line 339

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(id, 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.



349
350
351
352
353
354
355
356
# File 'lib/stripe/resources/payout.rb', line 349

def self.update(id, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/payouts/%<id>s", { id: CGI.escape(id) }),
    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.



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

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.



327
328
329
330
331
332
333
334
# File 'lib/stripe/resources/payout.rb', line 327

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