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/docs/api#external_accounts) are transfer destinations on ‘Account` objects for [Custom accounts](stripe.com/docs/connect/custom-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/docs/payments/bank-debits-transfers)

Constant Summary collapse

OBJECT_NAME =
"bank_account"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary

Attributes inherited from APIResource

#save_with_parent

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

Class Method Details

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



53
54
55
56
57
58
59
60
# File 'lib/stripe/resources/bank_account.rb', line 53

def self.delete(id, params = {}, opts = {})
  request_stripe_object(
    method: :delete,
    path: "#{resource_url}/#{id}",
    params: params,
    opts: opts
  )
end

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



71
72
73
74
75
76
77
78
# File 'lib/stripe/resources/bank_account.rb', line 71

def self.list(filters = {}, opts = {})
  request_stripe_object(
    method: :delete,
    path: resource_url.to_s,
    params: filters,
    opts: opts
  )
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)


44
45
46
47
48
49
50
51
# File 'lib/stripe/resources/bank_account.rb', line 44

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)


35
36
37
38
39
40
41
42
# File 'lib/stripe/resources/bank_account.rb', line 35

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

Instance Method Details

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



62
63
64
65
66
67
68
69
# File 'lib/stripe/resources/bank_account.rb', line 62

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

#resource_urlObject



27
28
29
30
31
32
33
# File 'lib/stripe/resources/bank_account.rb', line 27

def resource_url
  if respond_to?(:customer)
    "#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
  elsif respond_to?(:account)
    "#{Account.resource_url}/#{CGI.escape()}/external_accounts/#{CGI.escape(id)}"
  end
end

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



22
23
24
25
# File 'lib/stripe/resources/bank_account.rb', line 22

def verify(params = {}, opts = {})
  resp, opts = execute_resource_request(:post, resource_url + "/verify", params, opts)
  initialize_from(resp.data, opts)
end