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 ID of the account that the bank account is associated with.



36
37
38
# File 'lib/stripe/resources/bank_account.rb', line 36

def 
  @account
end

#account_holder_nameObject (readonly)

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



38
39
40
# File 'lib/stripe/resources/bank_account.rb', line 38

def 
  @account_holder_name
end

#account_holder_typeObject (readonly)

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



40
41
42
# File 'lib/stripe/resources/bank_account.rb', line 40

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



42
43
44
# File 'lib/stripe/resources/bank_account.rb', line 42

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.



44
45
46
# File 'lib/stripe/resources/bank_account.rb', line 44

def available_payout_methods
  @available_payout_methods
end

#bank_nameObject (readonly)

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



46
47
48
# File 'lib/stripe/resources/bank_account.rb', line 46

def bank_name
  @bank_name
end

#countryObject (readonly)

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



48
49
50
# File 'lib/stripe/resources/bank_account.rb', line 48

def country
  @country
end

#currencyObject (readonly)

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



50
51
52
# File 'lib/stripe/resources/bank_account.rb', line 50

def currency
  @currency
end

#customerObject (readonly)

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



52
53
54
# File 'lib/stripe/resources/bank_account.rb', line 52

def customer
  @customer
end

#default_for_currencyObject (readonly)

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



54
55
56
# File 'lib/stripe/resources/bank_account.rb', line 54

def default_for_currency
  @default_for_currency
end

#deletedObject (readonly)

Always true for a deleted object



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

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.



56
57
58
# File 'lib/stripe/resources/bank_account.rb', line 56

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.



58
59
60
# File 'lib/stripe/resources/bank_account.rb', line 58

def future_requirements
  @future_requirements
end

#idObject (readonly)

Unique identifier for the object.



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

def id
  @id
end

#last4Object (readonly)

The last four digits of the bank account number.



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

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.



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

def 
  @metadata
end

#objectObject (readonly)

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



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

def object
  @object
end

#requirementsObject (readonly)

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



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

def requirements
  @requirements
end

#routing_numberObject (readonly)

The routing transit number for the bank account.



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

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.



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

def status
  @status
end

Class Method Details

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

Raises:

  • (NotImplementedError)


124
125
126
127
128
129
130
131
# File 'lib/stripe/resources/bank_account.rb', line 124

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(filters = {}, opts = {}) ⇒ Object

Raises:

  • (NotImplementedError)


142
143
144
145
146
147
148
# File 'lib/stripe/resources/bank_account.rb', line 142

def self.list(filters = {}, 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)


115
116
117
118
119
120
121
122
# File 'lib/stripe/resources/bank_account.rb', line 115

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)


106
107
108
109
110
111
112
113
# File 'lib/stripe/resources/bank_account.rb', line 106

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



87
88
89
90
91
92
93
94
# File 'lib/stripe/resources/bank_account.rb', line 87

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



133
134
135
136
137
138
139
140
# File 'lib/stripe/resources/bank_account.rb', line 133

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

#resource_urlObject



96
97
98
99
100
101
102
103
104
# File 'lib/stripe/resources/bank_account.rb', line 96

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



78
79
80
81
82
83
84
85
# File 'lib/stripe/resources/bank_account.rb', line 78

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