Reputation: 685
I am trying to verify a bank account with Stripe. The closest language in the Stripe documentation is Node.js so my code is a little different but the problem that there's not "customers" object on the stripe object created from stripe.js.
Their code (https://stripe.com/docs/ach#manually-collecting-and-verifying-bank-accounts):
// Set your secret key: remember to change this to your live secret key in production
// See your keys here: https://dashboard.stripe.com/account/apikeys
var stripe = require("stripe")("my_secret_key");
var data = {amounts: [32,45]}
stripe.customers.verifySource(
'customer_id',
'bank_account_id',
{
amounts: [32, 45]
},
function(err, bankAccount) {
});
My code:
<script src="https://js.stripe.com/v3/"></script>
<script>
$('input').on('keydown', function (e) {
if (e.which == 13) {
$('#VerificationAmounts').submit();
}
});
$('#VerificationAmounts').submit(function (e) {
e.preventDefault();
var stripe = Stripe("@publishKey");
var data = { amounts: [$('#Amount1').val(), $('#Amount2').val()] }
debugger;
stripe.customers.verifySource(
'@customerId',
'@bankAccount.Id',
data,
function (err, bankAccount) {
});
});
</script>
Error:
Uncaught TypeError: Cannot read property 'verifySource' of undefined
Does anyone know of a way to make the "customers" object populate on the stripe object?
Upvotes: 2
Views: 1540
Reputation: 685
Per @Alex's comment, I was trying to use the stripe.js to verify the bank account but instead I should have been using the Stripe API. Since I'm using C# MVC
I needed to pass the micro-payment amounts the customer provided to my Controller and call the Verfiy
method of the Stripe.net
class BankAccountService
per documentation: https://github.com/stripe/stripe-dotnet.
Upvotes: 1