Class: Stripe::Payout

Inherits:
APIResource show all
Extended by:
APIOperations::Create, APIOperations::List
Includes:
APIOperations::Save
Defined in:
lib/stripe/resources/payout.rb

Overview

A ‘Payout` object is created when you receive funds from Stripe, or when you initiate a payout to either a bank account or debit card of a [connected Stripe account](stripe.com/docs/connect/bank-debit-card-payouts). You can retrieve individual payouts, and list all payouts. Payouts are made on [varying schedules](stripe.com/docs/connect/manage-payout-schedule), depending on your country and industry.

Related guide: [Receiving payouts](stripe.com/docs/payouts)

Constant Summary collapse

OBJECT_NAME =
"payout"

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::Create

create

Methods included from APIOperations::List

list

Methods included from APIOperations::Save

included, #save

Methods inherited from APIResource

class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, 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

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



34
35
36
37
38
39
40
41
# File 'lib/stripe/resources/payout.rb', line 34

def self.cancel(payout, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/payouts/%<payout>s/cancel", { payout: CGI.escape(payout) }),
    params: params,
    opts: opts
  )
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.



48
49
50
# File 'lib/stripe/resources/payout.rb', line 48

def self.create(params = {}, opts = {})
  request_stripe_object(method: :post, path: "/v1/payouts", params: params, opts: opts)
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.



53
54
55
# File 'lib/stripe/resources/payout.rb', line 53

def self.list(params = {}, opts = {})
  request_stripe_object(method: :get, path: "/v1/payouts", params: params, opts: opts)
end

.object_nameObject



19
20
21
# File 'lib/stripe/resources/payout.rb', line 19

def self.object_name
  "payout"
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.



72
73
74
75
76
77
78
79
# File 'lib/stripe/resources/payout.rb', line 72

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

.update(id, 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.



82
83
84
85
86
87
88
89
# File 'lib/stripe/resources/payout.rb', line 82

def self.update(id, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/payouts/%<id>s", { id: CGI.escape(id) }),
    params: params,
    opts: opts
  )
end

Instance Method Details

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



24
25
26
27
28
29
30
31
# File 'lib/stripe/resources/payout.rb', line 24

def cancel(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/payouts/%<payout>s/cancel", { payout: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

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



60
61
62
63
64
65
66
67
# File 'lib/stripe/resources/payout.rb', line 60

def reverse(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end