Class: Stripe::Account

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](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](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](stripe.com/api/account_links) or [Account Session](stripe.com/api/account_sessions) to start Connect Onboarding. Learn about the [differences between accounts](stripe.com/connect/accounts).

Defined Under Namespace

Classes: BusinessProfile, Capabilities, Company, Controller, CreateParams, DeleteParams, FutureRequirements, Groups, ListParams, PersonsParams, RejectParams, Requirements, RetrieveParams, RiskControls, Settings, TosAcceptance, UpdateParams

Constant Summary collapse

OBJECT_NAME =
"account"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary collapse

Attributes inherited from APIResource

#save_with_parent

Attributes inherited from StripeObject

#last_response

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Stripe::APIOperations::Create

create

Methods included from Stripe::APIOperations::List

list

Methods included from Stripe::APIOperations::NestedResource

nested_resource_class_methods

Methods included from Stripe::APIOperations::Save

included, #save

Methods included from Stripe::APIOperations::Delete

included

Methods inherited from APIResource

class_name, custom_method, #refresh, #request_stripe_object, resource_url, save_nested_resource

Methods included from Stripe::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, #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_profileObject (readonly)

Business information about the account.



5752
5753
5754
# File 'lib/stripe/resources/account.rb', line 5752

def business_profile
  @business_profile
end

#business_typeObject (readonly)

The business type. After you create an [Account Link](/api/account_links) or [Account Session](/api/account_sessions), this property is only returned for accounts where [controller.requirement_collection](/api/accounts/object#account_object-controller-requirement_collection) is ‘application`, which includes Custom accounts.



5755
5756
5757
# File 'lib/stripe/resources/account.rb', line 5755

def business_type
  @business_type
end

#capabilitiesObject (readonly)

Attribute for field capabilities



5758
5759
5760
# File 'lib/stripe/resources/account.rb', line 5758

def capabilities
  @capabilities
end

#charges_enabledObject (readonly)

Whether the account can process charges.



5761
5762
5763
# File 'lib/stripe/resources/account.rb', line 5761

def charges_enabled
  @charges_enabled
end

#companyObject (readonly)

Attribute for field company



5764
5765
5766
# File 'lib/stripe/resources/account.rb', line 5764

def company
  @company
end

#controllerObject (readonly)

Attribute for field controller



5767
5768
5769
# File 'lib/stripe/resources/account.rb', line 5767

def controller
  @controller
end

#countryObject (readonly)

The account’s country.



5770
5771
5772
# File 'lib/stripe/resources/account.rb', line 5770

def country
  @country
end

#createdObject (readonly)

Time at which the account was connected. Measured in seconds since the Unix epoch.



5773
5774
5775
# File 'lib/stripe/resources/account.rb', line 5773

def created
  @created
end

#default_currencyObject (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).



5776
5777
5778
# File 'lib/stripe/resources/account.rb', line 5776

def default_currency
  @default_currency
end

#deletedObject (readonly)

Always true for a deleted object



5828
5829
5830
# File 'lib/stripe/resources/account.rb', line 5828

def deleted
  @deleted
end

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



5779
5780
5781
# File 'lib/stripe/resources/account.rb', line 5779

def 
  @details_submitted
end

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



5782
5783
5784
# File 'lib/stripe/resources/account.rb', line 5782

def email
  @email
end

#external_accountsObject (readonly)

External accounts (bank accounts and debit cards) currently attached to this account. External accounts are only returned for requests where ‘controller` is true.



5785
5786
5787
# File 'lib/stripe/resources/account.rb', line 5785

def external_accounts
  @external_accounts
end

#future_requirementsObject (readonly)

Attribute for field future_requirements



5788
5789
5790
# File 'lib/stripe/resources/account.rb', line 5788

def future_requirements
  @future_requirements
end

#groupsObject (readonly)

The groups associated with the account.



5791
5792
5793
# File 'lib/stripe/resources/account.rb', line 5791

def groups
  @groups
end

#idObject (readonly)

Unique identifier for the object.



5794
5795
5796
# File 'lib/stripe/resources/account.rb', line 5794

def id
  @id
end

#individualObject (readonly)

This is an object representing a person associated with a Stripe account.

A platform cannot access 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).



5801
5802
5803
# File 'lib/stripe/resources/account.rb', line 5801

def individual
  @individual
end

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



5804
5805
5806
# File 'lib/stripe/resources/account.rb', line 5804

def 
  @metadata
end

#objectObject (readonly)

String representing the object’s type. Objects of the same type share the same value.



5807
5808
5809
# File 'lib/stripe/resources/account.rb', line 5807

def object
  @object
end

#payouts_enabledObject (readonly)

Whether the funds in this account can be paid out.



5810
5811
5812
# File 'lib/stripe/resources/account.rb', line 5810

def payouts_enabled
  @payouts_enabled
end

#requirementsObject (readonly)

Attribute for field requirements



5813
5814
5815
# File 'lib/stripe/resources/account.rb', line 5813

def requirements
  @requirements
end

#risk_controlsObject (readonly)

Attribute for field risk_controls



5816
5817
5818
# File 'lib/stripe/resources/account.rb', line 5816

def risk_controls
  @risk_controls
end

#settingsObject (readonly)

Options for customizing how the account functions within Stripe.



5819
5820
5821
# File 'lib/stripe/resources/account.rb', line 5819

def settings
  @settings
end

#tos_acceptanceObject (readonly)

Attribute for field tos_acceptance



5822
5823
5824
# File 'lib/stripe/resources/account.rb', line 5822

def tos_acceptance
  @tos_acceptance
end

#typeObject (readonly)

The Stripe account type. Can be ‘standard`, `express`, `custom`, or `none`.



5825
5826
5827
# File 'lib/stripe/resources/account.rb', line 5825

def type
  @type
end

Class Method Details

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

With [Connect](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](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.



5836
5837
5838
# File 'lib/stripe/resources/account.rb', line 5836

def self.create(params = {}, opts = {})
  request_stripe_object(method: :post, path: "/v1/accounts", params: params, opts: opts)
end

.delete(id, params = {}, opts = {}) ⇒ Object

With [Connect](stripe.com/connect), you can delete accounts you manage.

Test-mode accounts can be deleted at any time.

Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](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.



5847
5848
5849
5850
5851
5852
5853
5854
# File 'lib/stripe/resources/account.rb', line 5847

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

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

Returns a list of accounts connected to your platform via [Connect](stripe.com/docs/connect). If you’re not a platform, the list is empty.



5873
5874
5875
# File 'lib/stripe/resources/account.rb', line 5873

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

.object_nameObject



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.



5888
5889
5890
5891
5892
5893
5894
5895
# File 'lib/stripe/resources/account.rb', line 5888

def self.persons(, params = {}, opts = {})
  request_stripe_object(
    method: :get,
    path: format("/v1/accounts/%<account>s/persons", { account: CGI.escape() }),
    params: params,
    opts: opts
  )
end

.protected_fieldsObject



6012
6013
6014
# File 'lib/stripe/resources/account.rb', line 6012

def self.protected_fields
  [:legal_entity]
end

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

With [Connect](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.



5912
5913
5914
5915
5916
5917
5918
5919
# File 'lib/stripe/resources/account.rb', line 5912

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

.retrieve(id = nil, opts = {}) ⇒ Object



5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
# File 'lib/stripe/resources/account.rb', line 5954

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(id, opts)
end

.update(id, params = {}, opts = {}) ⇒ Object

Updates a [connected account](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](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](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](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](stripe.com/docs/connect/updating-accounts) documentation to learn more about updating accounts.



5934
5935
5936
5937
5938
5939
5940
5941
# File 'lib/stripe/resources/account.rb', line 5934

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

Instance Method Details

#deauthorize(client_id = nil, opts = {}) ⇒ Object



6027
6028
6029
6030
6031
6032
6033
6034
# File 'lib/stripe/resources/account.rb', line 6027

def deauthorize(client_id = nil, opts = {})
  params = {
    client_id: client_id,
    stripe_user_id: id,
  }
  opts = @opts.merge(Util.normalize_opts(opts))
  OAuth.deauthorize(params, opts)
end

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

With [Connect](stripe.com/connect), you can delete accounts you manage.

Test-mode accounts can be deleted at any time.

Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](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.



5863
5864
5865
5866
5867
5868
5869
5870
# File 'lib/stripe/resources/account.rb', line 5863

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


6016
6017
6018
# File 'lib/stripe/resources/account.rb', line 6016

def legal_entity
  self["legal_entity"]
end

Raises:

  • (NoMethodError)


6020
6021
6022
6023
6024
6025
# File 'lib/stripe/resources/account.rb', line 6020

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.



5878
5879
5880
5881
5882
5883
5884
5885
# File 'lib/stripe/resources/account.rb', line 5878

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



5900
5901
5902
5903
5904
5905
5906
5907
# File 'lib/stripe/resources/account.rb', line 5900

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_urlObject



5945
5946
5947
5948
5949
5950
5951
# File 'lib/stripe/resources/account.rb', line 5945

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.



5996
5997
5998
# File 'lib/stripe/resources/account.rb', line 5996

def serialize_params(options = {})
  (self, super, options)
end

#serialize_params_account(_obj, update_hash, options = {}) ⇒ Object



6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
# File 'lib/stripe/resources/account.rb', line 6000

def (_obj, update_hash, options = {})
  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(options)
  end
  update_hash
end