#manuel_terminal-connectiontoken
1 messages ¡ Page 1 of 1 (latest)
đ 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/1433488714935566398
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- manuel_best-practices, 6 days ago, 13 messages
Hi there
We don't give a specific time frame for token expiration but it is quite quick and they should be used immediately. Overall you are responsible for handling disconnects and fetching new Connection Tokens, we discuss this here: https://docs.stripe.com/terminal/payments/connect-reader?terminal-sdk-platform=android&reader-type=internet#handling-disconnects
Regarding getting the token from backend, If we have some latency, how we can manage correctly the TokenProvider fetching method?
I'm not sure what you mean by that exactly? You mean if the latency to fetch causes the token to expire?
Here I request the token from backend. What happen if the response from this method have latency? I have to call again Terminal.getInstance().discoverReaders ?
What does "have latency" mean. If you hit an error then yes you would discover readers again or create a new connection token.
But I'm not sure if that is what you are asking?
time for the response of the token request (30, 40, 70 seconds)
how manage the SDK the callback for fetchConnectionToken
ok, so you're wondering how to handle cases where the actual request to get the token encounters extreme latency?
have you encountered extreme latency like that, or are you just futureproofing?
actually i think i understand your question, let me dig for a bit
in general the SDK should manage connection tokens for you, and if for some reason there is extreme latency or a token expires, then the operation you are running should fail
so retrying discovery on the application side would make sense
we document this in some detail here:
https://docs.stripe.com/terminal/payments/setup-integration?terminal-sdk-platform=android#connection-token-client-side
here we have an exception about that
does that answer your question or do you still need more support?
The connectionTokenProviderError related to timeouts is thrown during the discoverReaders and connectReader methods. In this case, we have to retry the flow multiple times.
From what I understand, the Stripe SDK requires the backend token to be provided within a specific time window (around 60 seconds). If the backend latency persists beyond that, we would basically remain in a waiting loop (possibly with continuous retries) until the backend normalizes, correct?
yeah, that sounds about right. is there a reason your backend is taking that long to return the token? the stripe API itself should return pretty quickly