Class: Stripe::TransferService

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

Defined Under Namespace

Classes: CreateParams, ListParams, RetrieveParams, UpdateParams

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from StripeService

#request, #request_stream

Constructor Details

#initialize(requestor) ⇒ TransferService

Returns a new instance of TransferService.



8
9
10
11
# File 'lib/stripe/services/transfer_service.rb', line 8

def initialize(requestor)
  super(requestor)
  @reversals = Stripe::TransferReversalService.new(@requestor)
end

Instance Attribute Details

#reversalsObject (readonly)

Returns the value of attribute reversals.



6
7
8
# File 'lib/stripe/services/transfer_service.rb', line 6

def reversals
  @reversals
end

Instance 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](stripe.com/docs/api#balance) must be able to cover the transfer amount, or you’ll receive an “Insufficient Funds” error.



152
153
154
# File 'lib/stripe/services/transfer_service.rb', line 152

def create(params = {}, opts = {})
  request(method: :post, path: "/v1/transfers", params: params, opts: opts, base_address: :api)
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.



157
158
159
# File 'lib/stripe/services/transfer_service.rb', line 157

def list(params = {}, opts = {})
  request(method: :get, path: "/v1/transfers", params: params, opts: opts, base_address: :api)
end

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

Retrieves the details of an existing transfer. Supply the unique transfer ID from either a transfer creation request or the transfer list, and Stripe will return the corresponding transfer information.



162
163
164
165
166
167
168
169
170
# File 'lib/stripe/services/transfer_service.rb', line 162

def retrieve(transfer, params = {}, opts = {})
  request(
    method: :get,
    path: format("/v1/transfers/%<transfer>s", { transfer: CGI.escape(transfer) }),
    params: params,
    opts: opts,
    base_address: :api
  )
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.



175
176
177
178
179
180
181
182
183
# File 'lib/stripe/services/transfer_service.rb', line 175

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