#TheUchi007 - invalid request

1 messages · Page 1 of 1 (latest)

halcyon salmon
#

Hi there. Can you share the request ID of the failed request?

hot wadi
#

You mean the btok token?

halcyon salmon
hot wadi
#

Give me a second

#

req_6y061tQihtjvRE

#

Just for reference, I am creating the token by using stripe.createToken

halcyon salmon
#

Hm I can't find that request id in our system. Where did you grab it from?

hot wadi
#

the logs

#

Let me get a screenshot

#

req_6yO61tQihtjvRE

halcyon salmon
#

Ah there we go. Originally you sent it with a zero instead of an "o"

#

One moment

#

btok_1LPWtGCwBIolfz2F1SuxPd6w exists on a different account

#

You created it on acct_1KO5YHCwBIolfz2F but the request above was made on acct_1LNMIfQ1COGLGhJT

hot wadi
#

Ah ok. So, if a bank account exists already on another account, it will give me the token error?

halcyon salmon
#

Yeah exactly. Because that API request is looking for the bank token on the account that the request is made on

#

And it doesn't find it so you get the above error

hot wadi
#

Hmmm

#

Is there a way for me to determine that? Or is the invalid token something I will always get?

#

Or rather, will using Financial Connection Session help with adding a bank account?

halcyon salmon
#

It's the way you're creating the token. You are either using a different api key or passing a connect account header

#

Can you share the request id for where you created the token?

hot wadi
#

to create the token I used stripe.createToken

#

Then I passed it to my BE, where I used:

const account = await stripe.accounts.createExternalAccount(stripeAcc, { external_account: token, }); return account;

#

Where stripeAcc is the ID of the user that I am adding the bank account to

halcyon salmon
#

Can you share the request id for where you created the token?

hot wadi
#

Hmm I am not sure where to get that. Would it be on the logs too?

#

Try these ones:
req_xImEgGkoLf7GzB
req_YqfKq18GwlJzSi

#

Those are the only 2 ones I see right before the one with the error

halcyon salmon
#

Yeah you get it from the request logs. Those are just get requests to retrieve an account

#

Can you share the code snippet for creating the token?

#

Want to see how you form the request

hot wadi
#

Sure thing

#

So, the method I using is this:

stripe.createToken("bank_account", bankData)

The data object looks like this:

const bankData = { country: "US", currency: "usd", routing_number: values.routing_number, account_number: values.account_number, account_holder_name: values.account_holder_name, account_holder_type: values.account_holder_type, };

Then, once I get a response, I either pass the token to the BE that uses:

stripe.accounts.createExternalAccount(stripeAcc, { external_account: token, });

And after that, I just get a response back to the frontend. This setup works well on local build, but on deployed build, I get the error I mentioned earlier

#

the bank data I am getting it from a form I created

halcyon salmon
#

You're using the wrong public key it looks like. You're using the public key for acct_1KO5YHCwBIolfz2F but then you try to add the external account to acct_1LNMIfQ1COGLGhJT

#

The request id wasn't showing in your request logs because it was made on a different account

hot wadi
#

Oooh

#

Ok, that would make sense then why it is not showing up on logs

#

So the API key might be the problem, you reckon?

white ibex
#

Hello! Taking over and catching up...

#

Yep, the API keys you're using appear to be mismatched. Sorting that out should resolve the issue.

hot wadi
#

Awesome, thank you so much!!

#

I will be sure to double check them!

white ibex
#

Let me know if you need any help with it!

hot wadi
#

Will do. For now, I will handle it later today. I really do appreciate helping me out with this!