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

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

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)


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

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)


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

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



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

def resource_url
  "#{Transfer.resource_url}/#{CGI.escape(transfer)}/reversals" \
    "/#{CGI.escape(id)}"
end