Class: Stripe::PayoutService

Inherits:
StripeService show all
Defined in:
lib/stripe/services/payout_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

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



7
8
9
10
11
12
13
14
15
# File 'lib/stripe/services/payout_service.rb', line 7

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.



22
23
24
# File 'lib/stripe/services/payout_service.rb', line 22

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.



27
28
29
# File 'lib/stripe/services/payout_service.rb', line 27

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.



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

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.



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

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.



56
57
58
59
60
61
62
63
64
# File 'lib/stripe/services/payout_service.rb', line 56

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