#niccol-bertozzi-129_connection-token-reuse
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/1358834440209567985
๐ 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.
- niccol-bertozzi-129_best-practices, 55 minutes ago, 13 messages
- niccol-bertozzi-129_error, 6 days ago, 18 messages
@Singleton
class StripeTokenProviderImpl @Inject constructor(
private val stripePaymentService: StripePaymentService
) : StripeTokenProvider {
override suspend fun fetchToken(locationId: String): ConnectionTokenProvider {
val response = stripePaymentService.getConnectionToken(locationId)
if (response.responseStatus == 1) {
return object : ConnectionTokenProvider {
override fun fetchConnectionToken(callback: ConnectionTokenCallback) {
callback.onSuccess(response.response.secret)
}
}
} else {
throw ConnectionTokenException(response.errorMessage)
}
}
}
class StripePaymentService @Inject constructor(
private val stripeApi: StripeApi
) : StripePaymentServiceContract {
override suspend fun getConnectionToken(locationId: String): StripeConnectionTokenResponse {
return try {
stripeApi.getConnectionToken(locationId)
} catch (e: Exception) {
StripeConnectionTokenResponse(
errorMessage = e.message ?: "Errore sconosciuto",
errorCode = "500",
responseStatus = 500,
response = Response("", "", locationId)
)
}
}
}
My server-side do the connection token request, and send me de secret. It's flow correct?
Hi ๐
That error indicates that your application is attempting to re-use a connection token value
You need to generate a new token every time you attempt to connect
So i need to call my server-side which do API call every time i try to connect
and get secret by fetchConnectionToken.onSucces
stripe is the best scam ever
@lunar nacelle looks like you're in the wrong place, this thread is for someone else's question.
- If you have your own thread please chat there.
- If you have a question or a followup to a closed thread use one of the buttons in https://discord.com/channels/841573134531821608/842637025524842496 to get help (we don't reopen closed threads).
Note that posting inappropriate messages in other people's threads is against the rules. No worries if this was just an honest mistake, but anyone who violates the rules multiple times will be removed from this server.
@novel stratus correct
perfect thk u
Happy to help ๐