Class: Stripe::Reversal

Inherits:
APIResource show all
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

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

included, #save

Methods inherited from APIResource

class_name, custom_method, #refresh, #request_stripe_object, resource_url, 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).



27
28
29
# File 'lib/stripe/resources/reversal.rb', line 27

def amount
  @amount
end

#balance_transactionObject (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

#createdObject (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

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



33
34
35
# File 'lib/stripe/resources/reversal.rb', line 33

def currency
  @currency
end

#destination_payment_refundObject (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

#idObject (readonly)

Unique identifier for the object.



37
38
39
# File 'lib/stripe/resources/reversal.rb', line 37

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



39
40
41
# File 'lib/stripe/resources/reversal.rb', line 39

def 
  @metadata
end

#objectObject (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_refundObject (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

#transferObject (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_nameObject



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

def self.object_name
  "transfer_reversal"
end

.retrieve(_id, _opts = {}) ⇒ Object

Raises:

  • (NotImplementedError)


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

Raises:

  • (NotImplementedError)


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_urlObject



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