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



4705
4706
4707
# File 'lib/stripe/resources/account.rb', line 4705

def business_profile
  @business_profile
end

#business_typeObject (readonly)

The business type.



4707
4708
4709
# File 'lib/stripe/resources/account.rb', line 4707

def business_type
  @business_type
end

#capabilitiesObject (readonly)

Attribute for field capabilities



4709
4710
4711
# File 'lib/stripe/resources/account.rb', line 4709

def capabilities
  @capabilities
end

#charges_enabledObject (readonly)

Whether the account can process charges.



4711
4712
4713
# File 'lib/stripe/resources/account.rb', line 4711

def charges_enabled
  @charges_enabled
end

#companyObject (readonly)

Attribute for field company



4713
4714
4715
# File 'lib/stripe/resources/account.rb', line 4713

def company
  @company
end

#controllerObject (readonly)

Attribute for field controller



4715
4716
4717
# File 'lib/stripe/resources/account.rb', line 4715

def controller
  @controller
end

#countryObject (readonly)

The account’s country.



4717
4718
4719
# File 'lib/stripe/resources/account.rb', line 4717

def country
  @country
end

#createdObject (readonly)

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



4719
4720
4721
# File 'lib/stripe/resources/account.rb', line 4719

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



4721
4722
4723
# File 'lib/stripe/resources/account.rb', line 4721

def default_currency
  @default_currency
end

#deletedObject (readonly)

Always true for a deleted object



4755
4756
4757
# File 'lib/stripe/resources/account.rb', line 4755

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.



4723
4724
4725
# File 'lib/stripe/resources/account.rb', line 4723

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.



4725
4726
4727
# File 'lib/stripe/resources/account.rb', line 4725

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.



4727
4728
4729
# File 'lib/stripe/resources/account.rb', line 4727

def external_accounts
  @external_accounts
end

#future_requirementsObject (readonly)

Attribute for field future_requirements



4729
4730
4731
# File 'lib/stripe/resources/account.rb', line 4729

def future_requirements
  @future_requirements
end

#groupsObject (readonly)

The groups associated with the account.



4731
4732
4733
# File 'lib/stripe/resources/account.rb', line 4731

def groups
  @groups
end

#idObject (readonly)

Unique identifier for the object.



4733
4734
4735
# File 'lib/stripe/resources/account.rb', line 4733

def id
  @id
end

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



4739
4740
4741
# File 'lib/stripe/resources/account.rb', line 4739

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.



4741
4742
4743
# File 'lib/stripe/resources/account.rb', line 4741

def 
  @metadata
end

#objectObject (readonly)

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



4743
4744
4745
# File 'lib/stripe/resources/account.rb', line 4743

def object
  @object
end

#payouts_enabledObject (readonly)

Whether the funds in this account can be paid out.



4745
4746
4747
# File 'lib/stripe/resources/account.rb', line 4745

def payouts_enabled
  @payouts_enabled
end

#requirementsObject (readonly)

Attribute for field requirements



4747
4748
4749
# File 'lib/stripe/resources/account.rb', line 4747

def requirements
  @requirements
end

#settingsObject (readonly)

Options for customizing how the account functions within Stripe.



4749
4750
4751
# File 'lib/stripe/resources/account.rb', line 4749

def settings
  @settings
end

#tos_acceptanceObject (readonly)

Attribute for field tos_acceptance



4751
4752
4753
# File 'lib/stripe/resources/account.rb', line 4751

def tos_acceptance
  @tos_acceptance
end

#typeObject (readonly)

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



4753
4754
4755
# File 'lib/stripe/resources/account.rb', line 4753

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.



4763
4764
4765
# File 'lib/stripe/resources/account.rb', line 4763

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



4774
4775
4776
4777
4778
4779
4780
4781
# File 'lib/stripe/resources/account.rb', line 4774

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



4800
4801
4802
# File 'lib/stripe/resources/account.rb', line 4800

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.



4815
4816
4817
4818
4819
4820
4821
4822
# File 'lib/stripe/resources/account.rb', line 4815

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



4939
4940
4941
# File 'lib/stripe/resources/account.rb', line 4939

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.



4839
4840
4841
4842
4843
4844
4845
4846
# File 'lib/stripe/resources/account.rb', line 4839

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



4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
# File 'lib/stripe/resources/account.rb', line 4881

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.



4861
4862
4863
4864
4865
4866
4867
4868
# File 'lib/stripe/resources/account.rb', line 4861

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

Instance Method Details

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



4954
4955
4956
4957
4958
4959
4960
4961
# File 'lib/stripe/resources/account.rb', line 4954

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



4790
4791
4792
4793
4794
4795
4796
4797
# File 'lib/stripe/resources/account.rb', line 4790

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


4943
4944
4945
# File 'lib/stripe/resources/account.rb', line 4943

def legal_entity
  self["legal_entity"]
end

Raises:

  • (NoMethodError)


4947
4948
4949
4950
4951
4952
# File 'lib/stripe/resources/account.rb', line 4947

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.



4805
4806
4807
4808
4809
4810
4811
4812
# File 'lib/stripe/resources/account.rb', line 4805

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.



4827
4828
4829
4830
4831
4832
4833
4834
# File 'lib/stripe/resources/account.rb', line 4827

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



4872
4873
4874
4875
4876
4877
4878
# File 'lib/stripe/resources/account.rb', line 4872

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.



4923
4924
4925
# File 'lib/stripe/resources/account.rb', line 4923

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

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



4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
# File 'lib/stripe/resources/account.rb', line 4927

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