#udaytechnosouls_76536

1 messages · Page 1 of 1 (latest)

upper waspBOT
dim surge
#

HI @silk perch

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

dim surge
#

first time it is connect sucessfully

#

but second time it give me eror

#

fetchConnectionToken is call autometicaly

#

right?

#

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"

silk perch
#

So it is trying to reactivating the connectionToken

#

I believe 1 token can only be activated once

dim surge
#

Yes token generate every time, while i disconnectReader and after Terminal.getInstance().connectBluetoothReader

#

But at time of connectBluetoothReader it is give me error

silk perch
#

What do you mean token generate everytime?

dim surge
#

Yes it is fetchConnectionToken in that
callback.onSuccess(token) is call

#

i think it is automaticaly

silk perch
#

Sorry I don't follow. Could you elaborate? Are you calling fetchConnectionToken twice?

dim surge
#

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

silk perch
#

Let's take a step back. Could you clarify which Doc you are following? And which terminal device is that?

dim surge
#

Learn how to set up the Stripe Reader M2.

Set up a Stripe Terminal SDK or server-driven integration to accept in-person payments.

Connect your application to a Stripe Terminal reader.

#

Issue is we have multiple m2 devices and they may be connect one by one, like disconnect/connect.

silk perch
#

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)
dim surge
#

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

silk perch
#

Are you backend returns the same ConnectionToken to multiple devices?

#

Can you check if that's the case?

dim surge
#

NO, because in IOS it is working fine.we have use same backend

silk perch
#

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?

dim surge
#

I am use Terminal.getInstance().connectBluetoothReader()
method i do not call API it done by SDK

silk perch
#

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

dim surge
#

How can print token in fetchConnectionToken?