Class: Stripe::PayoutService

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

Defined Under Namespace

Classes: CancelParams, CreateParams, ListParams, RetrieveParams, ReverseParams, UpdateParams

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

#cancel(payout, params = {}, opts = {}) ⇒ Object

You can cancel a previously created payout if its status is pending. Stripe refunds the funds to your available balance. You can’t cancel automatic Stripe payouts.



189
190
191
192
193
194
195
196
197
# File 'lib/stripe/services/payout_service.rb', line 189

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

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

To send funds to your own bank account, create a new payout object. Your [Stripe balance](stripe.com/docs/api#balance) must cover the payout amount. If it doesn’t, you receive an “Insufficient Funds” error.

If your API key is in test mode, money won’t actually be sent, though every other action occurs as if you’re in live mode.

If you create a manual payout on a Stripe account that uses multiple payment source types, you need to specify the source type balance that the payout draws from. The [balance object](stripe.com/docs/api#balance_object) details available and pending amounts by source type.



204
205
206
# File 'lib/stripe/services/payout_service.rb', line 204

def create(params = {}, opts = {})
  request(method: :post, path: "/v1/payouts", params: params, opts: opts, base_address: :api)
end

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

Returns a list of existing payouts sent to third-party bank accounts or payouts that Stripe sent to you. The payouts return in sorted order, with the most recently created payouts appearing first.



209
210
211
# File 'lib/stripe/services/payout_service.rb', line 209

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

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

Retrieves the details of an existing payout. Supply the unique payout ID from either a payout creation request or the payout list. Stripe returns the corresponding payout information.



214
215
216
217
218
219
220
221
222
# File 'lib/stripe/services/payout_service.rb', line 214

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

#reverse(payout, params = {}, opts = {}) ⇒ Object

Reverses a payout by debiting the destination bank account. At this time, you can only reverse payouts for connected accounts to US bank accounts. If the payout is manual and in the pending status, use /v1/payouts/:id/cancel instead.

By requesting a reversal through /v1/payouts/:id/reverse, you confirm that the authorized signatory of the selected bank account authorizes the debit on the bank account and that no other authorization is required.



227
228
229
230
231
232
233
234
235
# File 'lib/stripe/services/payout_service.rb', line 227

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

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

Updates the specified payout by setting the values of the parameters you pass. We don’t change parameters that you don’t provide. This request only accepts the metadata as arguments.



238
239
240
241
242
243
244
245
246
# File 'lib/stripe/services/payout_service.rb', line 238

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