Class: Stripe::Reversal
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::Reversal
- Includes:
- APIOperations::Save
- Defined in:
- lib/stripe/resources/reversal.rb
Overview
[Stripe Connect](stripe.com/docs/connect) platforms can reverse transfers made to a connected account, either entirely or partially, and can also specify whether to refund any related application fees. Transfer reversals add to the platform’s balance and subtract from the destination account’s balance.
Reversing a transfer that was made for a [destination charge](stripe.com/docs/connect/destination-charges) is allowed only up to the amount of the charge. It is possible to reverse a [transfer_group](stripe.com/docs/connect/separate-charges-and-transfers#transfer-options) transfer only if the destination account has enough balance to cover the reversal.
Related guide: [Reverse transfers](stripe.com/docs/connect/separate-charges-and-transfers#reverse-transfers)
Constant Summary collapse
- OBJECT_NAME =
"transfer_reversal"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Amount, in cents (or local equivalent).
-
#balance_transaction ⇒ Object
readonly
Balance transaction that describes the impact on your account balance.
-
#created ⇒ Object
readonly
Time at which the object was created.
-
#currency ⇒ Object
readonly
Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase.
-
#destination_payment_refund ⇒ Object
readonly
Linked payment refund for the transfer reversal.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#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.
-
#source_refund ⇒ Object
readonly
ID of the refund responsible for the transfer reversal.
-
#transfer ⇒ Object
readonly
ID of the transfer that was reversed.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
- .object_name ⇒ Object
- .retrieve(_id, _opts = {}) ⇒ Object
- .update(_id, _params = nil, _opts = nil) ⇒ Object
Instance Method Summary collapse
Methods included from APIOperations::Save
Methods inherited from APIResource
class_name, custom_method, #refresh, #request_stripe_object, resource_url, save_nested_resource
Methods included from APIOperations::Request
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
#amount ⇒ Object (readonly)
Amount, in cents (or local equivalent).
27 28 29 |
# File 'lib/stripe/resources/reversal.rb', line 27 def amount @amount end |
#balance_transaction ⇒ Object (readonly)
Balance transaction that describes the impact on your account balance.
29 30 31 |
# File 'lib/stripe/resources/reversal.rb', line 29 def balance_transaction @balance_transaction end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
31 32 33 |
# File 'lib/stripe/resources/reversal.rb', line 31 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).
33 34 35 |
# File 'lib/stripe/resources/reversal.rb', line 33 def currency @currency end |
#destination_payment_refund ⇒ Object (readonly)
Linked payment refund for the transfer reversal.
35 36 37 |
# File 'lib/stripe/resources/reversal.rb', line 35 def destination_payment_refund @destination_payment_refund end |
#id ⇒ Object (readonly)
Unique identifier for the object.
37 38 39 |
# File 'lib/stripe/resources/reversal.rb', line 37 def id @id 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.
39 40 41 |
# File 'lib/stripe/resources/reversal.rb', line 39 def @metadata end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
41 42 43 |
# File 'lib/stripe/resources/reversal.rb', line 41 def object @object end |
#source_refund ⇒ Object (readonly)
ID of the refund responsible for the transfer reversal.
43 44 45 |
# File 'lib/stripe/resources/reversal.rb', line 43 def source_refund @source_refund end |
#transfer ⇒ Object (readonly)
ID of the transfer that was reversed.
45 46 47 |
# File 'lib/stripe/resources/reversal.rb', line 45 def transfer @transfer end |
Class Method Details
.object_name ⇒ Object
22 23 24 |
# File 'lib/stripe/resources/reversal.rb', line 22 def self.object_name "transfer_reversal" end |
.retrieve(_id, _opts = {}) ⇒ Object
59 60 61 62 63 64 |
# File 'lib/stripe/resources/reversal.rb', line 59 def self.retrieve(_id, _opts = {}) raise NotImplementedError, "Reversals cannot be retrieved without a transfer ID. Retrieve " \ "a reversal using `Transfer.retrieve_reversal('transfer_id', " \ "'reversal_id'`" end |
.update(_id, _params = nil, _opts = nil) ⇒ Object
52 53 54 55 56 57 |
# File 'lib/stripe/resources/reversal.rb', line 52 def self.update(_id, _params = nil, _opts = nil) raise NotImplementedError, "Reversals cannot be updated without a transfer ID. Update a " \ "reversal using `r = Transfer.update_reversal('transfer_id', " \ "'reversal_id', update_params)`" end |
Instance Method Details
#resource_url ⇒ Object
47 48 49 50 |
# File 'lib/stripe/resources/reversal.rb', line 47 def resource_url "#{Transfer.resource_url}/#{CGI.escape(transfer)}/reversals" \ "/#{CGI.escape(id)}" end |