#josh-c_code

1 messages ยท Page 1 of 1 (latest)

tawny mothBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1298827009304039457

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

waxen lagoon
#

What's the location ID that you use in this code?

viral temple
#

Oh wait, hold on, I think I see the issue.

#

Nope, that wasn't it. Location ID is tml_FTs7Lw8JMfYEch

waxen lagoon
#

Can you put some logs and confirm tml_FTs7Lw8JMfYEch is the location ID that your app uses?

viral temple
#

yeah, hold on

waxen lagoon
#

Also, tml_FTs7Lw8JMfYEch is created in live mode, is your application also running in live mode?

viral temple
#

I was running this in live mode, I will switch to test.

#

This is a React Native app built with Expo/EAS, I was going with a TestFlight build. I've queued a new one but can switch to USB.

#

Building now, stand by

#

Build complete, signing into app to test

#

Ope, that's it, location ID is blank

#

Ok, still getting an error

#

The test location ID is tml_FxUvewa9VlhBoz

#

Oh wait, no that's a connection token error.

#

I think that is related to the wrong userId

#

Maybe not? UserID acct_1MLtmlR8EvBMqb53

#

or stripe account ID

#

stripeConnectionToken pst_test_YWNjdF8xSVNWcXRKVW0yTTVSanJvLDZsMW5Xa2RVMDhXdnJORHpVUTVobUdlQ1lhRWxCZHQ_008XXu8w0M

#

Interesting that I didn't have that issue in prod, is this a configuration error with the test account?

waxen lagoon
#

What's the new error now?

viral temple
#

ConnectionTokeProvider- CompletedWithError

#

Connecting to the reader failed because the app completed fetchConnectionToken with an error

#

Connected account ID and connection token posted above

waxen lagoon
#

Ok, the connection token was created on the platform, not the connected account (i.e., acct_1MLtmlR8EvBMqb53).

You should specify a stripe_account in the request when creating the connection token. By specifying a stripe_account, you are telling Stripe that you want to make an API call on behalf of a connected account. You can refer to this doc to learn more about making API request for connected account (https://stripe.com/docs/connect/authentication)

Learn how to add the right information to your API calls so you can make calls for your connected accounts.

viral temple
#

here's the code I am using:
const connectionToken = await stripe.terminal.connectionTokens.create({stripeAccount: user.stripeAccount});

#

the stripe account is the connected account Id for the user in question

#

In this case, acct_1MLtmlR8EvBMqb53

#

That code is run server side and the token is returned to the client per the docs

waxen lagoon
viral temple
#

Ah, I think it is an aysnc/await issue. Hold on, I am going to push a fix.

#

Urgh, I fixed that and still see the error

waxen lagoon
viral temple
#

req_L3KRo4ZtgM5nQ4

#

do I also need the location ID on the request?

waxen lagoon
#

That's optional, a connection token without location ID is usable to all readers.

viral temple
#

I thought so, I had pulled it because I was providing it when I connect to the reader

#

I verified that the account ID is present, what is going on?

waxen lagoon
#

What's the location ID that you use in the iOS app now?

viral temple
#

tml_FxUvewa9VlhBoz

waxen lagoon
#

This location was created on platform, not connected account.

#

You should also use a location that's created on the connected account.

viral temple
#

How do I do that?

#

I don't see an option for that either in Dashboard under terminal locations or under the connected account

waxen lagoon
#

Yes you can create a location in your connected account's Dashboard, or create one programmatically through API

tawny mothBOT
viral temple
#

As in I would need to log into the connected account as them or in my Dashboard I can go to their connected account and create it somehow?

vernal tapir
#

๐Ÿ‘‹ Taking over this thread, catching up now

#

We recommend creating the terminal location programmatically through API instead of using Dashboard

viral temple
#

Awesome, thank you for that. I'm gonna dig into this in the morning. I'll create an API terminal location creator and go from there. Thank you both for your support. I appreciate it.