#Ammar-token-error

1 messages ยท Page 1 of 1 (latest)

calm cradle
#

Hi there ๐Ÿ‘‹ do you happen to have the request ID (req_XX) from a request where you saw this error?

supple terrace
#

sure 1 sec

#

req_bb1G0uSj0dCpEi

#

Did you find it?

calm cradle
#

Hm, no I couldn't. That request ID isn't matching anything on my side, let me check a different way.

#

No luck, all I'm seeing in our logs is my searches for that request. Can you tell me a bit more about what you're doing when you hit that error?

supple terrace
#

sure, so i have a legacy app that generates a token. the token is returned from stripe after entering the card details on the frontend. The request is then forwarded to a new api which handles creating a setup intent with the token. I used a test card and I am using stripes test keys for my app.

#

req_bb1G0uSj0dCpEi

#

Copy pasted it this time^

#

req_nBtpBhQSISUXNx

#

Another one ^

calm cradle
#

Hm, I'm still not able to find those requests.

Based on the error it sounds like there is a problem with the ID of the token that is being passed in. Have you made sure that the ID is formatted correctly, is correct and maps to an existing token, and isn't null?

supple terrace
#

Yes, so i can see the request in the chrome dev tools shows the token from stripe. And the exact same token is being sent to to stripe to generate a setup intent

#

The code works locally too.

calm cradle
#

Can you provide your account ID? Maybe I can find the logs that way.

supple terrace
#

where do i find that

calm cradle
supple terrace
#

acct_16sYSzJk2S5ksjC9

calm cradle
#

Thanks, found them.

#

When you're creating the tokens you're providing a stripeAccount parameter so the tokens are being created on your connected account. Then when you try creating a payment method from the token you're doing so on your platform account. Your platform account cannot use objects that are sitting on your connected account. So you'll either need to not pass the stripeAccount parameter when creating the token so it's created on your platform, or pass the stripeAccount parameter when creating the payment method so it's created on the connected account.

supple terrace
#

I see, I had this issue before with connected account stuff. I have no idea what a connected account even does. But thanks will look into that.

calm cradle
#

Connected accounts are primarily used for scenarios where you're working with third party vendors. For example if you have a marketplace, then you might use a connected account for each of your vendors.

supple terrace
#

Could you tell me the acct id I should be using for to generate the tokens?

#

Is it the same one I just sent you?

calm cradle
#

If you're not trying to work with connected accounts, then you can omit the stripeAccount parameter completely. Doing so will cause all transactions and associated objects to exist directly on your account.

supple terrace
#

Well we do have other vendors and I was not the one who setup the legacy code. However, as this is just for testing purposes. I can just alter the acct_id in our databse for all vendors to be the same. I am assuming that will fix things.

calm cradle
#

Gotcha, well that's a bit tricky because if you want to use a connected account then you provide that account's ID through the stripeAccount parameter, but if you want to work directly on your account (identified by the API key that you use) then you don't use the stripeAccount parameter at all. This is going to make it a bit challenging to just override all the account IDs you're currently using as I'm not sure what happens if you pass your own account ID in the stripeAccount field.
https://stripe.com/docs/api/connected_accounts

supple terrace
#

Ok, so either. When generating the token on the frontend with stripe.js dont send the stripeAccount. Or on the backend send the same account_id as the stripeaccount param when creating the payment method.