Class: Stripe::Account
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::Account
- Extended by:
- Stripe::APIOperations::Create, Stripe::APIOperations::List, Stripe::APIOperations::NestedResource
- Defined in:
- lib/stripe/resources/account.rb
Overview
This is an object representing a Stripe account. You can retrieve it to see properties on the account like its current requirements or if the account is enabled to make live charges or receive payouts.
For accounts where [controller.requirement_collection](docs.stripe.com/api/accounts/object#account_object-controller-requirement_collection) is ‘application`, which includes Custom accounts, the properties below are always returned.
For accounts where [controller.requirement_collection](docs.stripe.com/api/accounts/object#account_object-controller-requirement_collection) is ‘stripe`, which includes Standard and Express accounts, some properties are only returned until you create an [Account Link](docs.stripe.com/api/account_links) or [Account Session](docs.stripe.com/api/account_sessions) to start Connect Onboarding. Learn about the [differences between accounts](docs.stripe.com/connect/accounts).
Defined Under Namespace
Classes: BusinessProfile, Capabilities, Company, Controller, CreateParams, DeleteParams, FutureRequirements, Groups, ListParams, PersonsParams, RejectParams, Requirements, RiskControls, Settings, TosAcceptance, UpdateParams
Constant Summary collapse
- OBJECT_NAME =
"account"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#business_profile ⇒ Object
readonly
Business information about the account.
-
#business_type ⇒ Object
readonly
The business type.
-
#capabilities ⇒ Object
readonly
Attribute for field capabilities.
-
#charges_enabled ⇒ Object
readonly
Whether the account can process charges.
-
#company ⇒ Object
readonly
Attribute for field company.
-
#controller ⇒ Object
readonly
Attribute for field controller.
-
#country ⇒ Object
readonly
The account’s country.
-
#created ⇒ Object
readonly
Time at which the account was connected.
-
#default_currency ⇒ Object
readonly
Three-letter ISO currency code representing the default currency for the account.
-
#deleted ⇒ Object
readonly
Always true for a deleted object.
-
#details_submitted ⇒ Object
readonly
Whether account details have been submitted.
-
#email ⇒ Object
readonly
An email address associated with the account.
-
#external_accounts ⇒ Object
readonly
External accounts (bank accounts and debit cards) currently attached to this account.
-
#future_requirements ⇒ Object
readonly
Attribute for field future_requirements.
-
#groups ⇒ Object
readonly
The groups associated with the account.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#individual ⇒ Object
readonly
This is an object representing a person associated with a Stripe account.
-
#metadata ⇒ Object
readonly
Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object.
-
#object ⇒ Object
readonly
String representing the object’s type.
-
#payouts_enabled ⇒ Object
readonly
Whether the funds in this account can be paid out.
-
#requirements ⇒ Object
readonly
Attribute for field requirements.
-
#risk_controls ⇒ Object
readonly
Attribute for field risk_controls.
-
#settings ⇒ Object
readonly
Options for customizing how the account functions within Stripe.
-
#tos_acceptance ⇒ Object
readonly
Attribute for field tos_acceptance.
-
#type ⇒ Object
readonly
The Stripe account type.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.create(params = {}, opts = {}) ⇒ Object
With [Connect](docs.stripe.com/docs/connect), you can create Stripe accounts for your users.
-
.delete(account, params = {}, opts = {}) ⇒ Object
With [Connect](docs.stripe.com/connect), you can delete accounts you manage.
- .field_remappings ⇒ Object
- .inner_class_types ⇒ Object
-
.list(params = {}, opts = {}) ⇒ Object
Returns a list of accounts connected to your platform via [Connect](docs.stripe.com/docs/connect).
- .object_name ⇒ Object
-
.persons(account, params = {}, opts = {}) ⇒ Object
Returns a list of people associated with the account’s legal entity.
- .protected_fields ⇒ Object
-
.reject(account, params = {}, opts = {}) ⇒ Object
With [Connect](docs.stripe.com/connect), you can reject accounts that you have flagged as suspicious.
- .retrieve(id = nil, opts = {}) ⇒ Object
-
.update(account, params = {}, opts = {}) ⇒ Object
Updates a [connected account](docs.stripe.com/connect/accounts) by setting the values of the parameters passed.
Instance Method Summary collapse
- #deauthorize(client_id = nil, opts = {}) ⇒ Object
-
#delete(params = {}, opts = {}) ⇒ Object
With [Connect](docs.stripe.com/connect), you can delete accounts you manage.
- #legal_entity ⇒ Object
- #legal_entity=(_legal_entity) ⇒ Object
-
#persons(params = {}, opts = {}) ⇒ Object
Returns a list of people associated with the account’s legal entity.
-
#reject(params = {}, opts = {}) ⇒ Object
With [Connect](docs.stripe.com/connect), you can reject accounts that you have flagged as suspicious.
- #resource_url ⇒ Object
-
#serialize_params(options = {}) ⇒ Object
Somewhat unfortunately, we attempt to do a special encoding trick when serializing ‘additional_owners` under an account: when updating a value, we actually send the update parameters up as an integer-indexed hash rather than an array.
- #serialize_params_account(_obj, update_hash, options = {}) ⇒ Object
Methods included from Stripe::APIOperations::Create
Methods included from Stripe::APIOperations::List
Methods included from Stripe::APIOperations::NestedResource
Methods included from Stripe::APIOperations::Save
Methods included from Stripe::APIOperations::Delete
Methods inherited from APIResource
class_name, custom_method, #refresh, #request_stripe_object, resource_url, save_nested_resource
Methods included from Stripe::APIOperations::Request
Methods inherited from StripeObject
#==, #[], #[]=, #_get_inner_class_type, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, #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
Instance Attribute Details
#business_profile ⇒ Object (readonly)
Business information about the account.
5863 5864 5865 |
# File 'lib/stripe/resources/account.rb', line 5863 def business_profile @business_profile end |
#business_type ⇒ Object (readonly)
The business type.
5865 5866 5867 |
# File 'lib/stripe/resources/account.rb', line 5865 def business_type @business_type end |
#capabilities ⇒ Object (readonly)
Attribute for field capabilities
5867 5868 5869 |
# File 'lib/stripe/resources/account.rb', line 5867 def capabilities @capabilities end |
#charges_enabled ⇒ Object (readonly)
Whether the account can process charges.
5869 5870 5871 |
# File 'lib/stripe/resources/account.rb', line 5869 def charges_enabled @charges_enabled end |
#company ⇒ Object (readonly)
Attribute for field company
5871 5872 5873 |
# File 'lib/stripe/resources/account.rb', line 5871 def company @company end |
#controller ⇒ Object (readonly)
Attribute for field controller
5873 5874 5875 |
# File 'lib/stripe/resources/account.rb', line 5873 def controller @controller end |
#country ⇒ Object (readonly)
The account’s country.
5875 5876 5877 |
# File 'lib/stripe/resources/account.rb', line 5875 def country @country end |
#created ⇒ Object (readonly)
Time at which the account was connected. Measured in seconds since the Unix epoch.
5877 5878 5879 |
# File 'lib/stripe/resources/account.rb', line 5877 def created @created end |
#default_currency ⇒ Object (readonly)
Three-letter ISO currency code representing the default currency for the account. This must be a currency that [Stripe supports in the account’s country](stripe.com/docs/payouts).
5879 5880 5881 |
# File 'lib/stripe/resources/account.rb', line 5879 def default_currency @default_currency end |
#deleted ⇒ Object (readonly)
Always true for a deleted object
5915 5916 5917 |
# File 'lib/stripe/resources/account.rb', line 5915 def deleted @deleted end |
#details_submitted ⇒ Object (readonly)
Whether account details have been submitted. Accounts with Stripe Dashboard access, which includes Standard accounts, cannot receive payouts before this is true. Accounts where this is false should be directed to [an onboarding flow](/connect/onboarding) to finish submitting account details.
5881 5882 5883 |
# File 'lib/stripe/resources/account.rb', line 5881 def details_submitted @details_submitted end |
#email ⇒ Object (readonly)
An email address associated with the account. It’s not used for authentication and Stripe doesn’t market to this field without explicit approval from the platform.
5883 5884 5885 |
# File 'lib/stripe/resources/account.rb', line 5883 def email @email end |
#external_accounts ⇒ Object (readonly)
External accounts (bank accounts and debit cards) currently attached to this account. External accounts are only returned for requests where ‘controller` is true.
5885 5886 5887 |
# File 'lib/stripe/resources/account.rb', line 5885 def external_accounts @external_accounts end |
#future_requirements ⇒ Object (readonly)
Attribute for field future_requirements
5887 5888 5889 |
# File 'lib/stripe/resources/account.rb', line 5887 def future_requirements @future_requirements end |
#groups ⇒ Object (readonly)
The groups associated with the account.
5889 5890 5891 |
# File 'lib/stripe/resources/account.rb', line 5889 def groups @groups end |
#id ⇒ Object (readonly)
Unique identifier for the object.
5891 5892 5893 |
# File 'lib/stripe/resources/account.rb', line 5891 def id @id end |
#individual ⇒ Object (readonly)
This is an object representing a person associated with a Stripe account.
A platform can only access a subset of data in a person for an account where [account.controller.requirement_collection](/api/accounts/object#account_object-controller-requirement_collection) is ‘stripe`, which includes Standard and Express accounts, after creating an Account Link or Account Session to start Connect onboarding.
See the [Standard onboarding](/connect/standard-accounts) or [Express onboarding](/connect/express-accounts) documentation for information about prefilling information and account onboarding steps. Learn more about [handling identity verification with the API](/connect/handling-api-verification#person-information).
5897 5898 5899 |
# File 'lib/stripe/resources/account.rb', line 5897 def individual @individual end |
#metadata ⇒ Object (readonly)
Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
5899 5900 5901 |
# File 'lib/stripe/resources/account.rb', line 5899 def @metadata end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
5901 5902 5903 |
# File 'lib/stripe/resources/account.rb', line 5901 def object @object end |
#payouts_enabled ⇒ Object (readonly)
Whether the funds in this account can be paid out.
5903 5904 5905 |
# File 'lib/stripe/resources/account.rb', line 5903 def payouts_enabled @payouts_enabled end |
#requirements ⇒ Object (readonly)
Attribute for field requirements
5905 5906 5907 |
# File 'lib/stripe/resources/account.rb', line 5905 def requirements @requirements end |
#risk_controls ⇒ Object (readonly)
Attribute for field risk_controls
5907 5908 5909 |
# File 'lib/stripe/resources/account.rb', line 5907 def risk_controls @risk_controls end |
#settings ⇒ Object (readonly)
Options for customizing how the account functions within Stripe.
5909 5910 5911 |
# File 'lib/stripe/resources/account.rb', line 5909 def settings @settings end |
#tos_acceptance ⇒ Object (readonly)
Attribute for field tos_acceptance
5911 5912 5913 |
# File 'lib/stripe/resources/account.rb', line 5911 def tos_acceptance @tos_acceptance end |
#type ⇒ Object (readonly)
The Stripe account type. Can be ‘standard`, `express`, `custom`, or `none`.
5913 5914 5915 |
# File 'lib/stripe/resources/account.rb', line 5913 def type @type end |
Class Method Details
.create(params = {}, opts = {}) ⇒ Object
With [Connect](docs.stripe.com/docs/connect), you can create Stripe accounts for your users. To do this, you’ll first need to [register your platform](dashboard.stripe.com/account/applications/settings).
If you’ve already collected information for your connected accounts, you [can prefill that information](docs.stripe.com/docs/connect/best-practices#onboarding) when creating the account. Connect Onboarding won’t ask for the prefilled information during account onboarding. You can prefill any information on the account.
5923 5924 5925 |
# File 'lib/stripe/resources/account.rb', line 5923 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/accounts", params: params, opts: opts) end |
.delete(account, params = {}, opts = {}) ⇒ Object
With [Connect](docs.stripe.com/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](docs.stripe.com/api/balance/balance_object) are zero.
If you want to delete your own account, use the [account information tab in your account settings](dashboard.stripe.com/settings/account) instead.
5934 5935 5936 5937 5938 5939 5940 5941 |
# File 'lib/stripe/resources/account.rb', line 5934 def self.delete(account, params = {}, opts = {}) request_stripe_object( method: :delete, path: format("/v1/accounts/%<account>s", { account: CGI.escape(account) }), params: params, opts: opts ) end |
.field_remappings ⇒ Object
6169 6170 6171 |
# File 'lib/stripe/resources/account.rb', line 6169 def self.field_remappings @field_remappings = {} end |
.inner_class_types ⇒ Object
6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 |
# File 'lib/stripe/resources/account.rb', line 6154 def self.inner_class_types @inner_class_types = { business_profile: BusinessProfile, capabilities: Capabilities, company: Company, controller: Controller, future_requirements: FutureRequirements, groups: Groups, requirements: Requirements, risk_controls: RiskControls, settings: Settings, tos_acceptance: TosAcceptance, } end |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of accounts connected to your platform via [Connect](docs.stripe.com/docs/connect). If you’re not a platform, the list is empty.
5960 5961 5962 |
# File 'lib/stripe/resources/account.rb', line 5960 def self.list(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/accounts", params: params, opts: opts) end |
.object_name ⇒ Object
25 26 27 |
# File 'lib/stripe/resources/account.rb', line 25 def self.object_name "account" end |
.persons(account, params = {}, opts = {}) ⇒ Object
Returns a list of people associated with the account’s legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
5975 5976 5977 5978 5979 5980 5981 5982 |
# File 'lib/stripe/resources/account.rb', line 5975 def self.persons(account, params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/accounts/%<account>s/persons", { account: CGI.escape(account) }), params: params, opts: opts ) end |
.protected_fields ⇒ Object
6099 6100 6101 |
# File 'lib/stripe/resources/account.rb', line 6099 def self.protected_fields [:legal_entity] end |
.reject(account, params = {}, opts = {}) ⇒ Object
With [Connect](docs.stripe.com/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. Test-mode accounts can be rejected at any time. Live-mode accounts can only be rejected after all balances are zero.
5999 6000 6001 6002 6003 6004 6005 6006 |
# File 'lib/stripe/resources/account.rb', line 5999 def self.reject(account, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/accounts/%<account>s/reject", { account: CGI.escape(account) }), params: params, opts: opts ) end |
.retrieve(id = nil, opts = {}) ⇒ Object
6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 |
# File 'lib/stripe/resources/account.rb', line 6041 def self.retrieve(id = nil, opts = {}) Util.check_string_argument!(id) if id # Account used to be a singleton, where this method's signature was # `(opts={})`. For the sake of not breaking folks who pass in an OAuth # key in opts, let's lurkily string match for it. if opts == {} && id.is_a?(String) && id.start_with?("sk_") # `super` properly assumes a String opts is the apiKey and normalizes # as expected. opts = id id = nil end super end |
.update(account, params = {}, opts = {}) ⇒ Object
Updates a [connected account](docs.stripe.com/connect/accounts) by setting the values of the parameters passed. Any parameters not provided are left unchanged.
For accounts where [controller.requirement_collection](docs.stripe.com/api/accounts/object#account_object-controller-requirement_collection) is application, which includes Custom accounts, you can update any information on the account.
For accounts where [controller.requirement_collection](docs.stripe.com/api/accounts/object#account_object-controller-requirement_collection) is stripe, which includes Standard and Express accounts, you can update all information until you create an [Account Link or <a href=“/api/account_sessions”>Account Session](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](dashboard.stripe.com/settings/account). Refer to our [Connect](docs.stripe.com/docs/connect/updating-accounts) documentation to learn more about updating accounts.
6021 6022 6023 6024 6025 6026 6027 6028 |
# File 'lib/stripe/resources/account.rb', line 6021 def self.update(account, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/accounts/%<account>s", { account: CGI.escape(account) }), params: params, opts: opts ) end |
Instance Method Details
#deauthorize(client_id = nil, opts = {}) ⇒ Object
6114 6115 6116 6117 6118 6119 6120 6121 |
# File 'lib/stripe/resources/account.rb', line 6114 def (client_id = nil, opts = {}) params = { client_id: client_id, stripe_user_id: id, } opts = @opts.merge(Util.normalize_opts(opts)) OAuth.(params, opts) end |
#delete(params = {}, opts = {}) ⇒ Object
With [Connect](docs.stripe.com/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](docs.stripe.com/api/balance/balance_object) are zero.
If you want to delete your own account, use the [account information tab in your account settings](dashboard.stripe.com/settings/account) instead.
5950 5951 5952 5953 5954 5955 5956 5957 |
# File 'lib/stripe/resources/account.rb', line 5950 def delete(params = {}, opts = {}) request_stripe_object( method: :delete, path: format("/v1/accounts/%<account>s", { account: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#legal_entity ⇒ Object
6103 6104 6105 |
# File 'lib/stripe/resources/account.rb', line 6103 def legal_entity self["legal_entity"] end |
#legal_entity=(_legal_entity) ⇒ Object
6107 6108 6109 6110 6111 6112 |
# File 'lib/stripe/resources/account.rb', line 6107 def legal_entity=(_legal_entity) raise NoMethodError, "Overriding legal_entity can cause serious issues. Instead, set " \ "the individual fields of legal_entity like " \ "`account.legal_entity.first_name = 'Blah'`" end |
#persons(params = {}, opts = {}) ⇒ Object
Returns a list of people associated with the account’s legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
5965 5966 5967 5968 5969 5970 5971 5972 |
# File 'lib/stripe/resources/account.rb', line 5965 def persons(params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/accounts/%<account>s/persons", { account: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#reject(params = {}, opts = {}) ⇒ Object
With [Connect](docs.stripe.com/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. Test-mode accounts can be rejected at any time. Live-mode accounts can only be rejected after all balances are zero.
5987 5988 5989 5990 5991 5992 5993 5994 |
# File 'lib/stripe/resources/account.rb', line 5987 def reject(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/accounts/%<account>s/reject", { account: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#resource_url ⇒ Object
6032 6033 6034 6035 6036 6037 6038 |
# File 'lib/stripe/resources/account.rb', line 6032 def resource_url if self["id"] super else "/v1/account" end end |
#serialize_params(options = {}) ⇒ Object
Somewhat unfortunately, we attempt to do a special encoding trick when serializing ‘additional_owners` under an account: when updating a value, we actually send the update parameters up as an integer-indexed hash rather than an array. So instead of this:
field[]=item1&field[]=item2&field[]=item3
We send this:
field[0]=item1&field[1]=item2&field[2]=item3
There are two major problems with this technique:
* Entities are addressed by array index, which is not stable and can
easily result in unexpected results between two different requests.
* A replacement of the array's contents is ambiguous with setting a
subset of the array. Because of this, the only way to shorten an
array is to unset it completely by making sure it goes into the
server as an empty string, then setting its contents again.
We’re trying to get this overturned on the server side, but for now, patch in a special allowance.
6083 6084 6085 |
# File 'lib/stripe/resources/account.rb', line 6083 def serialize_params( = {}) serialize_params_account(self, super, ) end |
#serialize_params_account(_obj, update_hash, options = {}) ⇒ Object
6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 |
# File 'lib/stripe/resources/account.rb', line 6087 def serialize_params_account(_obj, update_hash, = {}) if (entity = @values[:legal_entity]) && (owners = entity[:additional_owners]) entity_update = update_hash[:legal_entity] ||= {} entity_update[:additional_owners] = serialize_additional_owners(entity, owners) end if (individual = @values[:individual]) && individual.is_a?(Person) && !update_hash.key?(:individual) update_hash[:individual] = individual.serialize_params() end update_hash end |