Class: Stripe::Transfer

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

Overview

A ‘Transfer` object is created when you move funds between Stripe accounts as part of Connect.

Before April 6, 2017, transfers also represented movement of funds from a Stripe account to a card or bank account. This behavior has since been split out into a [Payout](stripe.com/docs/api#payout_object) object, with corresponding payout endpoints. For more information, read about the [transfer/payout split](stripe.com/docs/transfer-payout-split).

Related guide: [Creating separate charges and transfers](stripe.com/docs/connect/separate-charges-and-transfers)

Defined Under Namespace

Classes: CreateParams, ListParams, RetrieveParams, UpdateParams

Constant Summary collapse

OBJECT_NAME =
"transfer"

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

Methods included from APIOperations::Create

create

Methods included from APIOperations::List

list

Methods included from APIOperations::NestedResource

nested_resource_class_methods

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)

Amount in cents (or local equivalent) to be transferred.



166
167
168
# File 'lib/stripe/resources/transfer.rb', line 166

def amount
  @amount
end

#amount_reversedObject (readonly)

Amount in cents (or local equivalent) reversed (can be less than the amount attribute on the transfer if a partial reversal was issued).



169
170
171
# File 'lib/stripe/resources/transfer.rb', line 169

def amount_reversed
  @amount_reversed
end

#balance_transactionObject (readonly)

Balance transaction that describes the impact of this transfer on your account balance.



172
173
174
# File 'lib/stripe/resources/transfer.rb', line 172

def balance_transaction
  @balance_transaction
end

#createdObject (readonly)

Time that this record of the transfer was first created.



175
176
177
# File 'lib/stripe/resources/transfer.rb', line 175

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



178
179
180
# File 'lib/stripe/resources/transfer.rb', line 178

def currency
  @currency
end

#descriptionObject (readonly)

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



181
182
183
# File 'lib/stripe/resources/transfer.rb', line 181

def description
  @description
end

#destinationObject (readonly)

ID of the Stripe account the transfer was sent to.



184
185
186
# File 'lib/stripe/resources/transfer.rb', line 184

def destination
  @destination
end

#destination_paymentObject (readonly)

If the destination is a Stripe account, this will be the ID of the payment that the destination account received for the transfer.



187
188
189
# File 'lib/stripe/resources/transfer.rb', line 187

def destination_payment
  @destination_payment
end

#idObject (readonly)

Unique identifier for the object.



190
191
192
# File 'lib/stripe/resources/transfer.rb', line 190

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.



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

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.



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

def 
  @metadata
end

#objectObject (readonly)

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



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

def object
  @object
end

#reversalsObject (readonly)

A list of reversals that have been applied to the transfer.



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

def reversals
  @reversals
end

#reversedObject (readonly)

Whether the transfer has been fully reversed. If the transfer is only partially reversed, this attribute will still be false.



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

def reversed
  @reversed
end

#source_transactionObject (readonly)

ID of the charge that was used to fund the transfer. If null, the transfer was funded from the available balance.



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

def source_transaction
  @source_transaction
end

#source_typeObject (readonly)

The source balance this transfer came from. One of ‘card`, `fpx`, or `bank_account`.



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

def source_type
  @source_type
end

#transfer_groupObject (readonly)

A string that identifies this transaction as part of a group. See the [Connect documentation](stripe.com/docs/connect/separate-charges-and-transfers#transfer-options) for details.



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

def transfer_group
  @transfer_group
end

Class Method Details

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

To send funds from your Stripe account to a connected account, you create a new transfer object. Your [Stripe balance](stripe.com/docs/api#balance) must be able to cover the transfer amount, or you’ll receive an “Insufficient Funds” error.



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

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

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

Returns a list of existing transfers sent to connected accounts. The transfers are returned in sorted order, with the most recently created transfers appearing first.



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

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

.object_nameObject



22
23
24
# File 'lib/stripe/resources/transfer.rb', line 22

def self.object_name
  "transfer"
end

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

Updates the specified transfer by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

This request accepts only metadata as an argument.



229
230
231
232
233
234
235
236
# File 'lib/stripe/resources/transfer.rb', line 229

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