#udaytechnosouls_76536
1 messages · Page 1 of 1 (latest)
HI @silk perch
Stripe Terminal ConnectionToken has already been redeemed. Please generate a new one using
v1/terminal/connection_tokens
I think the error message here is the most important part
You probably have multiple code trying to use a same connection token
first time it is connect sucessfully
but second time it give me eror
fetchConnectionToken is call autometicaly
right?
I got this error in url=https://api.stripe.com/v1/terminal/connection_tokens/activate
here is log " class=RestClient message="url=https://api.stripe.com/v1/terminal/connection_tokens/activate status=BAD_REQUEST
headers={access-control-allow-credentials=true, access-control-allow-methods=GET,HEAD,PUT,PATCH,POST,DELETE, access-control-allow-origin=*, access-control-expose-headers=Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required, access-control-max-age=300, cache-control=no-cache, no-store, content-length=320, content-security-policy=report-uri
https://q.stripe.com/csp-report?p=v1%2Fterminal%2Fconnection_tokens%2Factivate; block-all-mixed-content; default-src
'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; script-src
'self' 'report-sample'; style-src 'self', content-type=application/json, date=Wed, 07 Feb 2024 06:53:25
GMT, idempotency-key=1707288805258STRM26146007039SXJuDeTm, original-request=req_1VH2RI0SKytyCJ, request-id=req_1VH2RI0SKytyCJ, server=nginx, strict-transport-security=max-age=63072000; includeSubDomains; preload, stripe-account=acct_1KsYtK4DfIvvXFPZ, stripe-should-retry=false, stripe-version=2019-02-19, vary=Origin, x-stripe-non-api-overhead-duration-ms=46.00000000000001, x-stripe-routing-context-priority-tier=api-testmode} response={"error":{"message":"The
Stripe Terminal ConnectionToken has already been redeemed. Please generate a new one using
v1/terminal/connection_tokens.","type":"invalid_request_error"}}"
12:23:25.611 StripeTerminal D class=BbposBluetoothAdapter message=disconnectReader"
So it is trying to reactivating the connectionToken
I believe 1 token can only be activated once
Yes token generate every time, while i disconnectReader and after Terminal.getInstance().connectBluetoothReader
But at time of connectBluetoothReader it is give me error
What do you mean token generate everytime?
Yes it is fetchConnectionToken in that
callback.onSuccess(token) is call
i think it is automaticaly
Sorry I don't follow. Could you elaborate? Are you calling fetchConnectionToken twice?
I just set at init terminal
Terminal.initTerminal(
context = it,
logLevel = logLevel,
tokenProvider = TokenProvider(STRIPE_TOKEN),
like this
I set token provider calls as per docs
What is use of https://api.stripe.com/v1/terminal/connection_tokens/activate API?
Let's take a step back. Could you clarify which Doc you are following? And which terminal device is that?
Yes sure,
I have M2 device : https://stripe.com/docs/terminal/payments/setup-reader/stripe-m2
I have followed step:
1)https://stripe.com/docs/terminal/payments/setup-integration?terminal-sdk-platform=android
2)https://stripe.com/docs/terminal/payments/connect-reader?reader-type=bluetooth
Issue is we have multiple m2 devices and they may be connect one by one, like disconnect/connect.
Thanks! I see the example code is a bit different. They uses this TokenProvider
TokenProvider tokenProvider = new TokenProvider();
while you are initializing directly
tokenProvider = TokenProvider(STRIPE_TOKEN)
I did it before but the result is the same
but let me try one more time as you have suggested
Got same error message "com.stripe.stripeterminal.external.models.TerminalException: The Stripe Terminal
ConnectionToken has already been redeemed. Please generate a new one using v1/terminal/connection_tokens
Are you backend returns the same ConnectionToken to multiple devices?
Can you check if that's the case?
NO, because in IOS it is working fine.we have use same backend
But do you returns the same Connection Token?
Ie. if you log the ConnectionToken you are getting error with, did you see it before on other devices?
I am use Terminal.getInstance().connectBluetoothReader()
method i do not call API it done by SDK
Right but you can log the secret on fetchConnectionToken
When it run previously
So you know which value the SDK is using on that Android device
And do it with multiple connected devices, and compare to see if there is same value somewhere else
How can print token in fetchConnectionToken?