Class: Stripe::TransferReversalService

Inherits:
StripeService show all
Defined in:
lib/stripe/services/transfer_reversal_service.rb

Instance Method Summary collapse

Methods inherited from StripeService

#initialize, #request, #request_stream

Constructor Details

This class inherits a constructor from Stripe::StripeService

Instance Method Details

#create(id, params = {}, opts = {}) ⇒ Object

When you create a new reversal, you must specify a transfer to create it on.

When reversing transfers, you can optionally reverse part of the transfer. You can do so as many times as you wish until the entire transfer has been reversed.

Once entirely reversed, a transfer can’t be reversed again. This method will return an error when called on an already-reversed transfer, or when trying to reverse more money than is left on a transfer.



11
12
13
14
15
16
17
18
19
# File 'lib/stripe/services/transfer_reversal_service.rb', line 11

def create(id, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/transfers/%<id>s/reversals", { id: CGI.escape(id) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#list(id, params = {}, opts = {}) ⇒ Object

You can see a list of the reversals belonging to a specific transfer. Note that the 10 most recent reversals are always available by default on the transfer object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional reversals.



22
23
24
25
26
27
28
29
30
# File 'lib/stripe/services/transfer_reversal_service.rb', line 22

def list(id, params = {}, opts = {})
  request(
    method: :get,
    path: format("/v1/transfers/%<id>s/reversals", { id: CGI.escape(id) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#retrieve(transfer, id, params = {}, opts = {}) ⇒ Object

By default, you can see the 10 most recent reversals stored directly on the transfer object, but you can also retrieve details about a specific reversal stored on the transfer.



33
34
35
36
37
38
39
40
41
# File 'lib/stripe/services/transfer_reversal_service.rb', line 33

def retrieve(transfer, id, params = {}, opts = {})
  request(
    method: :get,
    path: format("/v1/transfers/%<transfer>s/reversals/%<id>s", { transfer: CGI.escape(transfer), id: CGI.escape(id) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

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

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

This request only accepts metadata and description as arguments.



46
47
48
49
50
51
52
53
54
# File 'lib/stripe/services/transfer_reversal_service.rb', line 46

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