Class: Stripe::AccountService

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from StripeService

#request, #request_stream

Constructor Details

#initialize(requestor) ⇒ AccountService

Returns a new instance of AccountService.



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

def initialize(requestor)
  super
  @capabilities = Stripe::AccountCapabilityService.new(@requestor)
  @external_accounts = Stripe::AccountExternalAccountService.new(@requestor)
  @login_links = Stripe::AccountLoginLinkService.new(@requestor)
  @persons = Stripe::AccountPersonService.new(@requestor)
  @signals = Stripe::AccountSignalsService.new(@requestor)
end

Instance Attribute Details

#capabilitiesObject (readonly)

Returns the value of attribute capabilities.



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

def capabilities
  @capabilities
end

#external_accountsObject (readonly)

Returns the value of attribute external_accounts.



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

def external_accounts
  @external_accounts
end

Returns the value of attribute login_links.



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

def 
  @login_links
end

#personsObject (readonly)

Returns the value of attribute persons.



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

def persons
  @persons
end

#signalsObject (readonly)

Returns the value of attribute signals.



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

def signals
  @signals
end

Instance Method Details

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

With Connect, you can create Stripe accounts for your users. To do this, you'll first need to register your platform.

If you've already collected information for your connected accounts, you can prefill that information when creating the account. Connect Onboarding won't ask for the prefilled information during account onboarding. You can prefill any information on the account.



23
24
25
# File 'lib/stripe/services/account_service.rb', line 23

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

#delete(account, params = {}, opts = {}) ⇒ Object

With Connect, you can delete accounts you manage.

Test-mode accounts can be deleted at any time.

Live-mode accounts that have access to the standard dashboard and Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. All other Live-mode accounts, can be deleted when all balances are zero.

If you want to delete your own account, use the account information tab in your account settings instead.



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

def delete(, params = {}, opts = {})
  request(
    method: :delete,
    path: format("/v1/accounts/%<account>s", { account: CGI.escape() }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

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

Returns a list of accounts connected to your platform via Connect. If you're not a platform, the list is empty.



45
46
47
# File 'lib/stripe/services/account_service.rb', line 45

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

#reject(account, params = {}, opts = {}) ⇒ Object

With Connect, you can reject accounts that you have flagged as suspicious.

Only accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be rejected.



52
53
54
55
56
57
58
59
60
# File 'lib/stripe/services/account_service.rb', line 52

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

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

Retrieves the details of an account.



63
64
65
66
67
68
69
70
71
# File 'lib/stripe/services/account_service.rb', line 63

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

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

Retrieves the details of an account.



74
75
76
# File 'lib/stripe/services/account_service.rb', line 74

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

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

Serializes an Account create request into a batch job JSONL line.



79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/stripe/services/account_service.rb', line 79

def serialize_batch_create(params = {}, opts = {})
  request_id = SecureRandom.uuid
  stripe_version = opts[:stripe_version] || Stripe.api_version

  request_body = {
    id: request_id,
    params: params,
    stripe_version: stripe_version,
  }
  request_body[:context] = opts[:stripe_context] if opts[:stripe_context]
  JSON.generate(request_body)
end

#serialize_batch_delete(account, params = {}, opts = {}) ⇒ Object

Serializes an Account delete request into a batch job JSONL line.



93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/stripe/services/account_service.rb', line 93

def serialize_batch_delete(, params = {}, opts = {})
  request_id = SecureRandom.uuid
  stripe_version = opts[:stripe_version] || Stripe.api_version

  request_body = {
    id: request_id,
    params: params,
    stripe_version: stripe_version,
  }
  request_body[:path_params] = { account:  }
  request_body[:context] = opts[:stripe_context] if opts[:stripe_context]
  JSON.generate(request_body)
end

#serialize_batch_update(account, params = {}, opts = {}) ⇒ Object

Serializes an Account update request into a batch job JSONL line.



108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/stripe/services/account_service.rb', line 108

def serialize_batch_update(, params = {}, opts = {})
  request_id = SecureRandom.uuid
  stripe_version = opts[:stripe_version] || Stripe.api_version

  request_body = {
    id: request_id,
    params: params,
    stripe_version: stripe_version,
  }
  request_body[:path_params] = { account:  }
  request_body[:context] = opts[:stripe_context] if opts[:stripe_context]
  JSON.generate(request_body)
end

#unreject(account, params = {}, opts = {}) ⇒ Object

With Connect, you can unreject accounts that you have previously rejected.

Only accounts that were rejected by your platform can be unrejected. This API cannot be used to unreject accounts that were rejected by Stripe.

Unreject will only enable charges and/or payouts if there are no other restrictions other than those placed by a previous rejection. If you have separately paused charges and/or payouts outside of rejection, those pauses will remain in place after unrejection.



127
128
129
130
131
132
133
134
135
# File 'lib/stripe/services/account_service.rb', line 127

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

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

Updates a connected account by setting the values of the parameters passed. Any parameters not provided are left unchanged.

For accounts where controller.requirement_collection is application, which includes Custom accounts, you can update any information on the account.

For accounts where controller.requirement_collection is stripe, which includes Standard and Express accounts, you can update all information until you create an [Account Link or Account Session](https://docs.stripe.com/api/account_links) to start Connect onboarding, after which some properties can no longer be updated.

To update your own account, use the Dashboard. Refer to our Connect documentation to learn more about updating accounts.



150
151
152
153
154
155
156
157
158
# File 'lib/stripe/services/account_service.rb', line 150

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