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: TraceId

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.



38
39
40
# File 'lib/stripe/resources/payout.rb', line 38

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.



40
41
42
# File 'lib/stripe/resources/payout.rb', line 40

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.



42
43
44
# File 'lib/stripe/resources/payout.rb', line 42

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.



44
45
46
# File 'lib/stripe/resources/payout.rb', line 44

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



46
47
48
# File 'lib/stripe/resources/payout.rb', line 46

def automatic
  @automatic
end

#balance_transactionObject (readonly)

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



48
49
50
# File 'lib/stripe/resources/payout.rb', line 48

def balance_transaction
  @balance_transaction
end

#createdObject (readonly)

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



50
51
52
# File 'lib/stripe/resources/payout.rb', line 50

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



52
53
54
# File 'lib/stripe/resources/payout.rb', line 52

def currency
  @currency
end

#descriptionObject (readonly)

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



54
55
56
# File 'lib/stripe/resources/payout.rb', line 54

def description
  @description
end

#destinationObject (readonly)

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



56
57
58
# File 'lib/stripe/resources/payout.rb', line 56

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.



58
59
60
# File 'lib/stripe/resources/payout.rb', line 58

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



60
61
62
# File 'lib/stripe/resources/payout.rb', line 60

def failure_code
  @failure_code
end

#failure_messageObject (readonly)

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



62
63
64
# File 'lib/stripe/resources/payout.rb', line 62

def failure_message
  @failure_message
end

#idObject (readonly)

Unique identifier for the object.



64
65
66
# File 'lib/stripe/resources/payout.rb', line 64

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.



66
67
68
# File 'lib/stripe/resources/payout.rb', line 66

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.



68
69
70
# File 'lib/stripe/resources/payout.rb', line 68

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



70
71
72
# File 'lib/stripe/resources/payout.rb', line 70

def method
  @method
end

#objectObject (readonly)

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



72
73
74
# File 'lib/stripe/resources/payout.rb', line 72

def object
  @object
end

#original_payoutObject (readonly)

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



74
75
76
# File 'lib/stripe/resources/payout.rb', line 74

def original_payout
  @original_payout
end

#payout_methodObject (readonly)

ID of the v2 FinancialAccount the funds are sent to.



76
77
78
# File 'lib/stripe/resources/payout.rb', line 76

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.



78
79
80
# File 'lib/stripe/resources/payout.rb', line 78

def reconciliation_status
  @reconciliation_status
end

#reversed_byObject (readonly)

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



80
81
82
# File 'lib/stripe/resources/payout.rb', line 80

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



82
83
84
# File 'lib/stripe/resources/payout.rb', line 82

def source_type
  @source_type
end

#statement_descriptorObject (readonly)

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



84
85
86
# File 'lib/stripe/resources/payout.rb', line 84

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



86
87
88
# File 'lib/stripe/resources/payout.rb', line 86

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.



88
89
90
# File 'lib/stripe/resources/payout.rb', line 88

def trace_id
  @trace_id
end

#typeObject (readonly)

Can be ‘bank_account` or `card`.



90
91
92
# File 'lib/stripe/resources/payout.rb', line 90

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.



103
104
105
106
107
108
109
110
# File 'lib/stripe/resources/payout.rb', line 103

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.



117
118
119
# File 'lib/stripe/resources/payout.rb', line 117

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

.field_remappingsObject



164
165
166
# File 'lib/stripe/resources/payout.rb', line 164

def self.field_remappings
  @field_remappings = {}
end

.inner_class_typesObject



160
161
162
# File 'lib/stripe/resources/payout.rb', line 160

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.



122
123
124
# File 'lib/stripe/resources/payout.rb', line 122

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 and Canadian 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.



141
142
143
144
145
146
147
148
# File 'lib/stripe/resources/payout.rb', line 141

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.



151
152
153
154
155
156
157
158
# File 'lib/stripe/resources/payout.rb', line 151

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.



93
94
95
96
97
98
99
100
# File 'lib/stripe/resources/payout.rb', line 93

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 and Canadian 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.



129
130
131
132
133
134
135
136
# File 'lib/stripe/resources/payout.rb', line 129

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