Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expired API Key provided: pss_live_YW*********************************************************************_******OvgX #547

Open
pvenrod opened this issue Jan 15, 2025 · 3 comments

Comments

@pvenrod
Copy link

pvenrod commented Jan 15, 2025

Summary

SDK returning this TerminalException:
Expired API Key provided: pss_live_YW*********************************************************************_******OvgX

when calling Terminal.getInstance().retrievePaymentIntent(String, PaymentIntentCallback).

Code to reproduce

Connection token provider:

override fun fetchConnectionToken(callback: ConnectionTokenCallback) {
    GlobalScope.launch(Dispatchers.IO) {
        runCatching {
            cardReaderApi.requestStripeToken()
        }.onSuccess {
            it.response.data?.secret?.let { safeSecret ->
                callback.onSuccess(safeSecret)
            }
        }.onFailure { e ->
            callback.onFailure(
                ConnectionTokenException("Failed to fetch Stripe connection token", e),
            )
        }
        cancel()
    }
}

Code that returns the error:

Terminal.getInstance().retrievePaymentIntent(
    paymentIntentSecretToken.clientSecret // Fresh secret returned from the backend,
    object : PaymentIntentCallback {
           override fun onSuccess(paymentIntent: PaymentIntent) {
                  collectPaymentMethod(donationData, paymentIntent, readerPaymentApi)
           }

           override fun onFailure(e: TerminalException) {
                  // Here, the sdk returns the "Expired API Key provided" error.
                  sendGenericError(donationData, e)
                  readerPaymentApi.onPaymentFailed(e)
           }
    },
)

Android version

Android 13

Impacted devices (Android devices or readers)

I'm having the problem with the Stripe BBPOS WisePad 3, but I'm not sure if it's a card reader-related thing.

SDK version

com.stripe:stripeterminal:3.10.0

Other information

I'm not sure how to replicate this issue. It has happened in production to many users, and the only way to get rid of it is restarting the app (we connect the reader when the app starts and use the same reader connection over the entire app lifecycle)

@dmatthews-stripe
Copy link
Collaborator

@pvenrod are you able to provide a payment intent ID and let us know how frequently this issue is occurring?

@pvenrod
Copy link
Author

pvenrod commented Jan 27, 2025

I don't have the payment intent ID because the SDK fails exactly while retrieving it.

The issue is happening between 2-10 times per day, to different users. But this information is not realiable because it depends on how many payments tries the user to do, since when the issue starts to happen, it happens until the app is restarted, so if the user is having this error and tries to do 100 payments in a row (for example) without restarting the app, those 100 payments will fail with the same error explanation.

Is there anything else I can contribute/help?

Thank you!

@ugochukwu-stripe
Copy link
Contributor

Hi @pvenrod, I could not reproduce this error you're seeing; the SDK should attempt to auto-recover from session token expiry from retrievePaymentIntents, if you could please provide us with an example PaymentIntent or reader serial, we can troubleshoot further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants