Class: Stripe::BankAccount

Inherits:
APIResource show all
Extended by:
APIOperations::List
Includes:
APIOperations::Delete, APIOperations::Save
Defined in:
lib/stripe/resources/bank_account.rb

Overview

These bank accounts are payment methods on ‘Customer` objects.

On the other hand [External Accounts](stripe.com/api#external_accounts) are transfer destinations on ‘Account` objects for connected accounts. They can be bank accounts or debit cards as well, and are documented in the links above.

Related guide: [Bank debits and transfers](stripe.com/payments/bank-debits-transfers)

Defined Under Namespace

Classes: FutureRequirements, Requirements

Constant Summary collapse

OBJECT_NAME =
"bank_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 APIOperations::List

list

Methods included from APIOperations::Save

included, #save

Methods included from APIOperations::Delete

included

Methods inherited from APIResource

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

Methods included from 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, protected_fields, #serialize_params, #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

#accountObject (readonly)

The account this bank account belongs to. Only applicable on Accounts (not customers or recipients) This property is only available when returned as an [External Account](/api/external_account_bank_accounts/object) where [controller.is_controller](/api/accounts/object#account_object-controller-is_controller) is ‘true`.



60
61
62
# File 'lib/stripe/resources/bank_account.rb', line 60

def 
  @account
end

#account_holder_nameObject (readonly)

The name of the person or business that owns the bank account.



62
63
64
# File 'lib/stripe/resources/bank_account.rb', line 62

def 
  @account_holder_name
end

#account_holder_typeObject (readonly)

The type of entity that holds the account. This can be either ‘individual` or `company`.



64
65
66
# File 'lib/stripe/resources/bank_account.rb', line 64

def 
  @account_holder_type
end

#account_typeObject (readonly)

The bank account type. This can only be ‘checking` or `savings` in most countries. In Japan, this can only be `futsu` or `toza`.



66
67
68
# File 'lib/stripe/resources/bank_account.rb', line 66

def 
  @account_type
end

#available_payout_methodsObject (readonly)

A set of available payout methods for this bank account. Only values from this set should be passed as the ‘method` when creating a payout.



68
69
70
# File 'lib/stripe/resources/bank_account.rb', line 68

def available_payout_methods
  @available_payout_methods
end

#bank_nameObject (readonly)

Name of the bank associated with the routing number (e.g., ‘WELLS FARGO`).



70
71
72
# File 'lib/stripe/resources/bank_account.rb', line 70

def bank_name
  @bank_name
end

#countryObject (readonly)

Two-letter ISO code representing the country the bank account is located in.



72
73
74
# File 'lib/stripe/resources/bank_account.rb', line 72

def country
  @country
end

#currencyObject (readonly)

Three-letter [ISO code for the currency](stripe.com/docs/payouts) paid out to the bank account.



74
75
76
# File 'lib/stripe/resources/bank_account.rb', line 74

def currency
  @currency
end

#customerObject (readonly)

The ID of the customer that the bank account is associated with.



76
77
78
# File 'lib/stripe/resources/bank_account.rb', line 76

def customer
  @customer
end

#default_for_currencyObject (readonly)

Whether this bank account is the default external account for its currency.



78
79
80
# File 'lib/stripe/resources/bank_account.rb', line 78

def default_for_currency
  @default_for_currency
end

#deletedObject (readonly)

Always true for a deleted object



100
101
102
# File 'lib/stripe/resources/bank_account.rb', line 100

def deleted
  @deleted
end

#fingerprintObject (readonly)

Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.



80
81
82
# File 'lib/stripe/resources/bank_account.rb', line 80

def fingerprint
  @fingerprint
end

#future_requirementsObject (readonly)

Information about the [upcoming new requirements for the bank account](stripe.com/docs/connect/custom-accounts/future-requirements), including what information needs to be collected, and by when.



82
83
84
# File 'lib/stripe/resources/bank_account.rb', line 82

def future_requirements
  @future_requirements
end

#idObject (readonly)

Unique identifier for the object.



84
85
86
# File 'lib/stripe/resources/bank_account.rb', line 84

def id
  @id
end

#last4Object (readonly)

The last four digits of the bank account number.



86
87
88
# File 'lib/stripe/resources/bank_account.rb', line 86

def last4
  @last4
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.



88
89
90
# File 'lib/stripe/resources/bank_account.rb', line 88

def 
  @metadata
end

#objectObject (readonly)

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



90
91
92
# File 'lib/stripe/resources/bank_account.rb', line 90

def object
  @object
end

#requirementsObject (readonly)

Information about the requirements for the bank account, including what information needs to be collected.



92
93
94
# File 'lib/stripe/resources/bank_account.rb', line 92

def requirements
  @requirements
end

#routing_numberObject (readonly)

The routing transit number for the bank account.



94
95
96
# File 'lib/stripe/resources/bank_account.rb', line 94

def routing_number
  @routing_number
end

#statusObject (readonly)

For bank accounts, possible values are ‘new`, `validated`, `verified`, `verification_failed`, or `errored`. A bank account that hasn’t had any activity or validation performed is ‘new`. If Stripe can determine that the bank account exists, its status will be `validated`. Note that there often isn’t enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be `verified`. If the verification failed for any reason, such as microdeposit failure, the status will be `verification_failed`. If a payout sent to this bank account fails, we’ll set the status to ‘errored` and will not continue to send [scheduled payouts](stripe.com/docs/payouts#payout-schedule) until the bank details are updated.

For external accounts, possible values are ‘new`, `errored` and `verification_failed`. If a payout fails, the status is set to `errored` and scheduled payouts are stopped until account details are updated. In the US and India, if we can’t [verify the owner of the bank account](support.stripe.com/questions/bank-account-ownership-verification), we’ll set the status to ‘verification_failed`. Other validations aren’t run against external accounts because they’re only used for payouts. This means the other statuses don’t apply.



98
99
100
# File 'lib/stripe/resources/bank_account.rb', line 98

def status
  @status
end

Class Method Details

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

Raises:

  • (NotImplementedError)


148
149
150
151
152
153
154
155
# File 'lib/stripe/resources/bank_account.rb', line 148

def self.delete(id, params = {}, opts = {})
  raise NotImplementedError,
        "Bank accounts cannot be deleted without a customer ID or an " \
        "account ID. Delete a bank account using " \
        "`Customer.delete_source('customer_id', 'bank_account_id')` " \
        "or `Account.delete_external_account('account_id', " \
        "'bank_account_id')`"
end

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

Raises:

  • (NotImplementedError)


166
167
168
169
170
171
172
# File 'lib/stripe/resources/bank_account.rb', line 166

def self.list(params = {}, opts = {})
  raise NotImplementedError,
        "Bank accounts cannot be listed without a customer ID or an " \
        "account ID. List bank accounts using " \
        "`Customer.list_sources('customer_id')` " \
        "or `Account.list_external_accounts('account_id')`"
end

.object_nameObject



18
19
20
# File 'lib/stripe/resources/bank_account.rb', line 18

def self.object_name
  "bank_account"
end

.retrieve(_id, _opts = nil) ⇒ Object

Raises:

  • (NotImplementedError)


139
140
141
142
143
144
145
146
# File 'lib/stripe/resources/bank_account.rb', line 139

def self.retrieve(_id, _opts = nil)
  raise NotImplementedError,
        "Bank accounts cannot be retrieve without a customer ID or an " \
        "account ID. Retrieve a bank account using " \
        "`Customer.retrieve_source('customer_id', 'bank_account_id')` " \
        "or `Account.retrieve_external_account('account_id', " \
        "'bank_account_id')`"
end

.update(_id, _params = nil, _opts = nil) ⇒ Object

Raises:

  • (NotImplementedError)


130
131
132
133
134
135
136
137
# File 'lib/stripe/resources/bank_account.rb', line 130

def self.update(_id, _params = nil, _opts = nil)
  raise NotImplementedError,
        "Bank accounts cannot be updated without a customer ID or an  " \
        "account ID. Update a bank account using " \
        "`Customer.update_source('customer_id', 'bank_account_id', " \
        "update_params)` or `Account.update_external_account(" \
        "'account_id', 'bank_account_id', update_params)`"
end

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



111
112
113
114
115
116
117
118
# File 'lib/stripe/resources/bank_account.rb', line 111

def self.verify(customer, id, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: "#{Customer.resource_url}/#{customer}/sources/#{id}/verify",
    params: params,
    opts: opts
  )
end

Instance Method Details

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



157
158
159
160
161
162
163
164
# File 'lib/stripe/resources/bank_account.rb', line 157

def delete(params = {}, opts = {})
  request_stripe_object(
    method: :delete,
    path: resource_url.to_s,
    params: params,
    opts: opts
  )
end

#resource_urlObject



120
121
122
123
124
125
126
127
128
# File 'lib/stripe/resources/bank_account.rb', line 120

def resource_url
  if !customer.nil?
    "#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
  elsif !.nil?
    "#{Account.resource_url}/#{CGI.escape()}/external_accounts/#{CGI.escape(id)}"
  else
    raise InvalidRequestError, "Could not determine which URL to request: [account, customer] fields are all null"
  end
end

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



102
103
104
105
106
107
108
109
# File 'lib/stripe/resources/bank_account.rb', line 102

def verify(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: "#{Customer.resource_url}/#{customer}/sources/#{id}/verify",
    params: params,
    opts: opts
  )
end