Undefined method `verify' for Stripe::BankAccount:Class
addielmoldes opened this issue · 3 comments
Describe the bug
{
"error": "undefined method `verify' for Stripe::BankAccount:Class
source = Stripe::BankAccount.verify('cus_9s6XGDTHzA66Po', 'ba_1NAiwl2eZvKYlo2CRdCLZSxO', { amounts: [32, 45] })
}
To Reproduce
Stripe::BankAccount.verify('cus_9s6XGDTHzA66Po', 'ba_1NAiwl2eZvKYlo2CRdCLZSxO', { amounts: [32, 45] })
Expected behavior
Bank account verification
Code snippets
No response
OS
Manjaro Linux
Language version
Ruby 3.1.3
Library version
stripe-ruby v11.5
API version
2024-04-10
Additional context
No response
Hi @addielmoldes , thanks for writing in! The verify
method is an instance method on BankAccount
, not a class method.
To call the method, you'll need to retrieve the bank account first using Stripe::Customer.retrieve_payment_method
. The final example would look something like
ba = Stripe::Customer.retrieve_payment_method('cus_9s6XGDTHzA66Po', 'ba_1NAiwl2eZvKYlo2CRdCLZSxO')
ba.verify( { amounts: [32, 45] })
I see that the Ruby example on https://docs.stripe.com/api/customer_bank_accounts/verify is incorrect - I'm assuming this is what you were referring to with your example since the values look the same. We'll look into getting that fixed in the docs.
I'm going to close this issue since this is a docs bug that we're tracking internally and not so much a bug in the SDK itself. Again, thank you for flagging this!
Update:
We have since found that this was not a docs bug and we should have had the static method for verify on BankAccount. As of version 12.0.0 of the stripe-ruby package, this has now been implemented - Stripe::BankAccount.verify()