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

#==, #[], #[]=, #_get_inner_class_type, 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.



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

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.



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

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.



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

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.



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

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



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

def automatic
  @automatic
end

#balance_transactionObject (readonly)

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



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

def balance_transaction
  @balance_transaction
end

#createdObject (readonly)

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



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

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



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

def currency
  @currency
end

#descriptionObject (readonly)

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



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

def description
  @description
end

#destinationObject (readonly)

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



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

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.



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

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



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

def failure_code
  @failure_code
end

#failure_messageObject (readonly)

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



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

def failure_message
  @failure_message
end

#idObject (readonly)

Unique identifier for the object.



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

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.



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

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.



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

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



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

def method
  @method
end

#objectObject (readonly)

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



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

def object
  @object
end

#original_payoutObject (readonly)

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



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

def original_payout
  @original_payout
end

#payout_methodObject (readonly)

ID of the v2 FinancialAccount the funds are sent to.



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

def payout_method
  @payout_method
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.



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

def reconciliation_status
  @reconciliation_status
end

#reversed_byObject (readonly)

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



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

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



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

def source_type
  @source_type
end

#statement_descriptorObject (readonly)

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



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

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



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

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.



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

def trace_id
  @trace_id
end

#typeObject (readonly)

Can be ‘bank_account` or `card`.



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

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.



257
258
259
260
261
262
263
264
# File 'lib/stripe/resources/payout.rb', line 257

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](docs.stripe.com/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](docs.stripe.com/api#balance_object) details available and pending amounts by source type.



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

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

.field_remappingsObject



318
319
320
# File 'lib/stripe/resources/payout.rb', line 318

def self.field_remappings
  @field_remappings = {}
end

.inner_class_typesObject



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

def self.inner_class_types
  @inner_class_types = { trace_id: TraceId }
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.



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

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.



295
296
297
298
299
300
301
302
# File 'lib/stripe/resources/payout.rb', line 295

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.



305
306
307
308
309
310
311
312
# File 'lib/stripe/resources/payout.rb', line 305

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.



247
248
249
250
251
252
253
254
# File 'lib/stripe/resources/payout.rb', line 247

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.



283
284
285
286
287
288
289
290
# File 'lib/stripe/resources/payout.rb', line 283

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