Class: Stripe::Transfer
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::Transfer
- 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)
Constant Summary collapse
- OBJECT_NAME =
"transfer"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Amount in cents (or local equivalent) to be transferred.
-
#amount_reversed ⇒ Object
readonly
Amount in cents (or local equivalent) reversed (can be less than the amount attribute on the transfer if a partial reversal was issued).
-
#balance_transaction ⇒ Object
readonly
Balance transaction that describes the impact of this transfer on your account balance.
-
#created ⇒ Object
readonly
Time that this record of the transfer was first created.
-
#currency ⇒ Object
readonly
Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase.
-
#description ⇒ Object
readonly
An arbitrary string attached to the object.
-
#destination ⇒ Object
readonly
ID of the Stripe account the transfer was sent to.
-
#destination_payment ⇒ Object
readonly
If the destination is a Stripe account, this will be the ID of the payment that the destination account received for the transfer.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#livemode ⇒ Object
readonly
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
-
#metadata ⇒ Object
readonly
Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object.
-
#object ⇒ Object
readonly
String representing the object’s type.
-
#reversals ⇒ Object
readonly
A list of reversals that have been applied to the transfer.
-
#reversed ⇒ Object
readonly
Whether the transfer has been fully reversed.
-
#source_transaction ⇒ Object
readonly
ID of the charge that was used to fund the transfer.
-
#source_type ⇒ Object
readonly
The source balance this transfer came from.
-
#transfer_group ⇒ Object
readonly
A string that identifies this transaction as part of a group.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.create(params = {}, opts = {}) ⇒ Object
To send funds from your Stripe account to a connected account, you create a new transfer object.
- .field_remappings ⇒ Object
- .inner_class_types ⇒ Object
-
.list(params = {}, opts = {}) ⇒ Object
Returns a list of existing transfers sent to connected accounts.
- .object_name ⇒ Object
-
.update(transfer, params = {}, opts = {}) ⇒ Object
Updates the specified transfer by setting the values of the parameters passed.
Methods included from APIOperations::Create
Methods included from APIOperations::List
Methods included from APIOperations::NestedResource
Methods included from APIOperations::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
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
#amount ⇒ Object (readonly)
Amount in cents (or local equivalent) to be transferred.
29 30 31 |
# File 'lib/stripe/resources/transfer.rb', line 29 def amount @amount end |
#amount_reversed ⇒ Object (readonly)
Amount in cents (or local equivalent) reversed (can be less than the amount attribute on the transfer if a partial reversal was issued).
31 32 33 |
# File 'lib/stripe/resources/transfer.rb', line 31 def amount_reversed @amount_reversed end |
#balance_transaction ⇒ Object (readonly)
Balance transaction that describes the impact of this transfer on your account balance.
33 34 35 |
# File 'lib/stripe/resources/transfer.rb', line 33 def balance_transaction @balance_transaction end |
#created ⇒ Object (readonly)
Time that this record of the transfer was first created.
35 36 37 |
# File 'lib/stripe/resources/transfer.rb', line 35 def created @created end |
#currency ⇒ Object (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).
37 38 39 |
# File 'lib/stripe/resources/transfer.rb', line 37 def currency @currency end |
#description ⇒ Object (readonly)
An arbitrary string attached to the object. Often useful for displaying to users.
39 40 41 |
# File 'lib/stripe/resources/transfer.rb', line 39 def description @description end |
#destination ⇒ Object (readonly)
ID of the Stripe account the transfer was sent to.
41 42 43 |
# File 'lib/stripe/resources/transfer.rb', line 41 def destination @destination end |
#destination_payment ⇒ Object (readonly)
If the destination is a Stripe account, this will be the ID of the payment that the destination account received for the transfer.
43 44 45 |
# File 'lib/stripe/resources/transfer.rb', line 43 def destination_payment @destination_payment end |
#id ⇒ Object (readonly)
Unique identifier for the object.
45 46 47 |
# File 'lib/stripe/resources/transfer.rb', line 45 def id @id end |
#livemode ⇒ Object (readonly)
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
47 48 49 |
# File 'lib/stripe/resources/transfer.rb', line 47 def livemode @livemode end |
#metadata ⇒ Object (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.
49 50 51 |
# File 'lib/stripe/resources/transfer.rb', line 49 def end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
51 52 53 |
# File 'lib/stripe/resources/transfer.rb', line 51 def object @object end |
#reversals ⇒ Object (readonly)
A list of reversals that have been applied to the transfer.
53 54 55 |
# File 'lib/stripe/resources/transfer.rb', line 53 def reversals @reversals end |
#reversed ⇒ Object (readonly)
Whether the transfer has been fully reversed. If the transfer is only partially reversed, this attribute will still be false.
55 56 57 |
# File 'lib/stripe/resources/transfer.rb', line 55 def reversed @reversed end |
#source_transaction ⇒ Object (readonly)
ID of the charge that was used to fund the transfer. If null, the transfer was funded from the available balance.
57 58 59 |
# File 'lib/stripe/resources/transfer.rb', line 57 def source_transaction @source_transaction end |
#source_type ⇒ Object (readonly)
The source balance this transfer came from. One of ‘card`, `fpx`, or `bank_account`.
59 60 61 |
# File 'lib/stripe/resources/transfer.rb', line 59 def source_type @source_type end |
#transfer_group ⇒ Object (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.
61 62 63 |
# File 'lib/stripe/resources/transfer.rb', line 61 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](docs.stripe.com/api#balance) must be able to cover the transfer amount, or you’ll receive an “Insufficient Funds” error.
64 65 66 |
# File 'lib/stripe/resources/transfer.rb', line 64 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/transfers", params: params, opts: opts) end |
.field_remappings ⇒ Object
89 90 91 |
# File 'lib/stripe/resources/transfer.rb', line 89 def self.field_remappings @field_remappings = {} end |
.inner_class_types ⇒ Object
85 86 87 |
# File 'lib/stripe/resources/transfer.rb', line 85 def self.inner_class_types @inner_class_types = {} 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.
69 70 71 |
# File 'lib/stripe/resources/transfer.rb', line 69 def self.list(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/transfers", params: params, opts: opts) end |
.object_name ⇒ Object
22 23 24 |
# File 'lib/stripe/resources/transfer.rb', line 22 def self.object_name "transfer" end |
.update(transfer, 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.
76 77 78 79 80 81 82 83 |
# File 'lib/stripe/resources/transfer.rb', line 76 def self.update(transfer, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/transfers/%<transfer>s", { transfer: CGI.escape(transfer) }), params: params, opts: opts ) end |