Class: Stripe::Account

Overview

For new integrations, we recommend using the Accounts v2 API, in place of /v1/accounts and /v1/customers to represent a user.

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 is application, which includes Custom accounts, the properties below are always returned.

For accounts where controller.requirement_collection is stripe, which includes Standard and Express accounts, some properties are only returned until you create an Account Link or Account Session to start Connect Onboarding. Learn about the differences between accounts.

Defined Under Namespace

Classes: BusinessProfile, Capabilities, Company, Controller, FutureRequirements, Groups, Requirements, Settings, TosAcceptance

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

#==, #[], #[]=, #_get_inner_class_type, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, field_encodings, #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.



1040
1041
1042
# File 'lib/stripe/resources/account.rb', line 1040

def business_profile
  @business_profile
end

#business_typeObject (readonly)

The business type.



1042
1043
1044
# File 'lib/stripe/resources/account.rb', line 1042

def business_type
  @business_type
end

#capabilitiesObject (readonly)

Attribute for field capabilities



1044
1045
1046
# File 'lib/stripe/resources/account.rb', line 1044

def capabilities
  @capabilities
end

#charges_enabledObject (readonly)

Whether the account can process charges.



1046
1047
1048
# File 'lib/stripe/resources/account.rb', line 1046

def charges_enabled
  @charges_enabled
end

#companyObject (readonly)

Attribute for field company



1048
1049
1050
# File 'lib/stripe/resources/account.rb', line 1048

def company
  @company
end

#controllerObject (readonly)

Attribute for field controller



1050
1051
1052
# File 'lib/stripe/resources/account.rb', line 1050

def controller
  @controller
end

#countryObject (readonly)

The account's country.



1052
1053
1054
# File 'lib/stripe/resources/account.rb', line 1052

def country
  @country
end

#createdObject (readonly)

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



1054
1055
1056
# File 'lib/stripe/resources/account.rb', line 1054

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.



1056
1057
1058
# File 'lib/stripe/resources/account.rb', line 1056

def default_currency
  @default_currency
end

#deletedObject (readonly)

Always true for a deleted object



1058
1059
1060
# File 'lib/stripe/resources/account.rb', line 1058

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 to finish submitting account details.



1060
1061
1062
# File 'lib/stripe/resources/account.rb', line 1060

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.



1062
1063
1064
# File 'lib/stripe/resources/account.rb', line 1062

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_controller] is true.



1064
1065
1066
# File 'lib/stripe/resources/account.rb', line 1064

def external_accounts
  @external_accounts
end

#future_requirementsObject (readonly)

Attribute for field future_requirements



1066
1067
1068
# File 'lib/stripe/resources/account.rb', line 1066

def future_requirements
  @future_requirements
end

#groupsObject (readonly)

The groups associated with the account.



1068
1069
1070
# File 'lib/stripe/resources/account.rb', line 1068

def groups
  @groups
end

#idObject (readonly)

Unique identifier for the object.



1070
1071
1072
# File 'lib/stripe/resources/account.rb', line 1070

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 is stripe, which includes Standard and Express accounts, after creating an Account Link or Account Session to start Connect onboarding.

See the Standard onboarding or Express onboarding documentation for information about prefilling information and account onboarding steps. Learn more about handling identity verification with the API.



1076
1077
1078
# File 'lib/stripe/resources/account.rb', line 1076

def individual
  @individual
end

#metadataObject (readonly)

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.



1078
1079
1080
# File 'lib/stripe/resources/account.rb', line 1078

def 
  @metadata
end

#objectObject (readonly)

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



1080
1081
1082
# File 'lib/stripe/resources/account.rb', line 1080

def object
  @object
end

#payouts_enabledObject (readonly)

Whether the funds in this account can be paid out.



1082
1083
1084
# File 'lib/stripe/resources/account.rb', line 1082

def payouts_enabled
  @payouts_enabled
end

#requirementsObject (readonly)

Attribute for field requirements



1084
1085
1086
# File 'lib/stripe/resources/account.rb', line 1084

def requirements
  @requirements
end

#settingsObject (readonly)

Options for customizing how the account functions within Stripe.



1086
1087
1088
# File 'lib/stripe/resources/account.rb', line 1086

def settings
  @settings
end

#tos_acceptanceObject (readonly)

Attribute for field tos_acceptance



1088
1089
1090
# File 'lib/stripe/resources/account.rb', line 1088

def tos_acceptance
  @tos_acceptance
end

#typeObject (readonly)

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



1090
1091
1092
# File 'lib/stripe/resources/account.rb', line 1090

def type
  @type
end

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



1098
1099
1100
# File 'lib/stripe/resources/account.rb', line 1098

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



1109
1110
1111
1112
1113
1114
1115
1116
# File 'lib/stripe/resources/account.rb', line 1109

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

.field_remappingsObject



1371
1372
1373
# File 'lib/stripe/resources/account.rb', line 1371

def self.field_remappings
  @field_remappings = {}
end

.inner_class_typesObject



1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
# File 'lib/stripe/resources/account.rb', line 1357

def self.inner_class_types
  @inner_class_types = {
    business_profile: BusinessProfile,
    capabilities: Capabilities,
    company: Company,
    controller: Controller,
    future_requirements: FutureRequirements,
    groups: Groups,
    requirements: Requirements,
    settings: Settings,
    tos_acceptance: TosAcceptance,
  }
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.



1135
1136
1137
# File 'lib/stripe/resources/account.rb', line 1135

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

.object_nameObject



27
28
29
# File 'lib/stripe/resources/account.rb', line 27

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.



1150
1151
1152
1153
1154
1155
1156
1157
# File 'lib/stripe/resources/account.rb', line 1150

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



1302
1303
1304
# File 'lib/stripe/resources/account.rb', line 1302

def self.protected_fields
  [:legal_entity]
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.



1174
1175
1176
1177
1178
1179
1180
1181
# File 'lib/stripe/resources/account.rb', line 1174

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



1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
# File 'lib/stripe/resources/account.rb', line 1244

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

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



1202
1203
1204
1205
1206
1207
1208
1209
# File 'lib/stripe/resources/account.rb', line 1202

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



1224
1225
1226
1227
1228
1229
1230
1231
# File 'lib/stripe/resources/account.rb', line 1224

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



1317
1318
1319
1320
1321
1322
1323
1324
# File 'lib/stripe/resources/account.rb', line 1317

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



1125
1126
1127
1128
1129
1130
1131
1132
# File 'lib/stripe/resources/account.rb', line 1125

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


1306
1307
1308
# File 'lib/stripe/resources/account.rb', line 1306

def legal_entity
  self["legal_entity"]
end

Raises:

  • (NoMethodError)


1310
1311
1312
1313
1314
1315
# File 'lib/stripe/resources/account.rb', line 1310

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.



1140
1141
1142
1143
1144
1145
1146
1147
# File 'lib/stripe/resources/account.rb', line 1140

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



1162
1163
1164
1165
1166
1167
1168
1169
# File 'lib/stripe/resources/account.rb', line 1162

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



1235
1236
1237
1238
1239
1240
1241
# File 'lib/stripe/resources/account.rb', line 1235

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.



1286
1287
1288
# File 'lib/stripe/resources/account.rb', line 1286

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

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



1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
# File 'lib/stripe/resources/account.rb', line 1290

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

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



1188
1189
1190
1191
1192
1193
1194
1195
# File 'lib/stripe/resources/account.rb', line 1188

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