#kylekhus-terminal

1 messages ยท Page 1 of 1 (latest)

gaunt oasis
#

Hi there, can you share with me the request ID of the payment?

pale sequoia
#

How can I obtain the request ID? Purchase happened on Jan 9th and we usually have a large volume come through our Stripe account so may take some digging to find any info relating to the incomplete purchase. Our device logs do show that only the payment intent object creation succeeded.

gaunt oasis
#

Or give me your merchant ID so I can dig the logs

pale sequoia
#

Apologies as I'm still familiarizing myself with the Stripe dashboard, but how would I be able to obtain the merchant ID as well?

gaunt oasis
#

You can find it from the Stripe Dashboard -> Settings ->Account Details

pale sequoia
#

I may have limited perms under my team's Stripe account as this is what I see when I click settings

#

hmmm when I click profile and scroll down

#

I do see Accounts

#

and an ID listed there

#

acct_xxxxxx

#

would that be it?

gaunt oasis
#

Yup, that's the one

pale sequoia
#

Okay! Umm is this sensitive info that I should send privately?

gaunt oasis
#

It's not a sensitive info.

#

We won't ask for sensitive info in Discord.

pale sequoia
#

gotcha, thank you. here ya go! acct_160KAIBbnoyrJKL1

#

I can also send you screenshots of the logs we got when the session expired

#

for more context

gaunt oasis
#

that'll be great!

pale sequoia
#

here's a portion of that user session!

gaunt oasis
#

Thanks, and can you tell me the date and timezone?

pale sequoia
#

I think the time you see on those logs is UTC, but the purchase happened on Jan 9, PST

gaunt oasis
#

so these are logs in UTC Jan 9, am I right?

pale sequoia
#

Correct!

gaunt oasis
#

I'm still digging the logs. Did you do anything to fix the api_key_expiered error?

#

And how do you write this logs?

pale sequoia
#

Mmm so I actually went to go visit our partner and debug their device, and I remember resolving it by resetting the reader (turning it off and then back on) and then going through reader discovery and pairing on their device again.

#

but manual intervention is not ideal, so I guess my point is if there's a way to programmatically resolve when this issue occurs such as being able to check if our connection token or api key has expired instead of waiting until we run into it?

#

and if we are able to retrieve that info, be able to fetch a new token (which I think we have an endpoint for actually) or refresh the API key so it's not expired

#

so that the reader is back to a connected state and the customer can resume their purchase

#

tldr; programmatically reconnect the reader after it was disconnected due to a SESSION_EXPIRED/api_key_expired error

gaunt oasis
#

Do you record the logs in your Android app?

  Terminal.getInstance().setTerminalListener(this);

  // TerminalListener
  @Override
  public void onUnexpectedReaderDisconnect(@Nonnull Reader reader) {
// Log here?
  }
}```
pale sequoia
#

Oh yea pretty much, we log to Embrace

gaunt oasis
#

Is it possible to show me the relevant logging code? so that I know where to trace the problem?

pale sequoia
#

Yea maybe I can sort of pseudo code it, but I'm still trying to get refamiliarized with this part of our codebase. Do you actually mind if I continue this tomorrow? It's getting pretty late where I am haha

#

not sure how you guys handle resuming threads but I'll try to reach out again when I have more context

gaunt oasis
#

No problem, you can come back anytime and there'll be Stripe engineers on duty to support you

pale sequoia
#

Okay sounds good, I'll refer back to this thread when that happens

gaunt oasis
#

You can always ask us to reopen the thread ๐Ÿ™‚

pale sequoia
#

Okay! I'll do that, thanks again Jack!

gaunt oasis
#

Have a good rest!

fallen wadi
#

Hello @pale sequoia

#

I think it's this one?

pale sequoia
#

Oh ah you beat me to it

#

Yea this is the one!

#

thank you for finding ๐Ÿ™‚

#

the other thread summarizes the situation better i think

#

this thread might make it more confusing but the other i think is more focused in terms of explaining the situation and the essence of the question, if that helps haha

fallen wadi
#

Okie, I did a quick search might have found smth

pale sequoia
#

ooooo

fallen wadi
#

Could you verify which Terminal SDK version you are using?

pale sequoia
#

definitely

fallen wadi
#

(Android Terminal SDK) ?

pale sequoia
#

I think it's 2.0.0 (though we are in the midst of trying to upgrade to 2.5.2 but running into an issue which is a whole nother can of worms haha)

#

ill send a screenshot

fallen wadi
#

Ohhh... One of our report says the error is fixed from 2.0.0... Okie let me digging around a bit more

pale sequoia
#

Thank you! let me know if there's anything I can do to help in the mean time

fallen wadi
#

Do you have a request id? eg the request to create PaymentIntent and failed?

pale sequoia
#

Oh hmm dont think I would be able to obtain that, our monitoring tool usually logs the PI but unfortunately did not this time ( we logged pi_unknown), so it would be challenging to sift through all of the payments that happened that day and try to match which one it could be ๐Ÿ˜ฆ

#

I did give Jack our merchant ID above

#

acct_160KAIBbnoyrJKL1

fallen wadi
#

Do you have an ideal time frame so I can try to narrow down?

pale sequoia
#

Oh yea let me see

#

so we're dealing with UTC time in Embrace (our monitoring tool) and it sayssss

#

Jan 9 - around 21:59 the payment intent object was created

#

so maybe check around that time? ^

#

(we're based in PST)

fallen wadi
#

Okie let me see

#

I see couple of requests to create PI around that time, all succeeded

pale sequoia
#

hmm if that's the case

#

Im starting to think that

#

we probably preemptively logged the payment intent creation event

#

before we knew if it would succeed or not

#

which is probably why we dont have PI to give you

#

ie it most likely errored on the payment intent creation call, so no PI which would explain why you only see successful purchases

fallen wadi
#

But then we should have a failed request id around that time. The one returns with "Expired key" in your screenshot

pale sequoia
#

ah yea that has to be it, attempting to call payment intent creation is what returned the terminal exception that had the api_key_expired error (cant create a payment intent if the reader isnt connected)

#

hmmm

fallen wadi
pale sequoia
#

let me see!

fallen wadi
#

Are you using connect? does your partner have another account id?

pale sequoia
#

ah no we're only using terminal for these purchases, not sure if we're using connect any where else

#

in the filter, what error type or error code or error param should I be filtering by?

fallen wadi
#

I think you can start by filtering the "Status" to "failed"

pale sequoia
#

getting closer, at Jan 11 rn haha

#

still searching almost there

#

web page is slowing down lol\

fallen wadi
#

Take ur time, I will be back later ๐Ÿ™‚

pale sequoia
#

cool cool thank you!

#

ill tag you when I reach the time frame

pale sequoia
#

@fallen wadi I'm not finding anything in these logs corresponding to our payment intent creation error ๐Ÿ˜ฆ

gaunt oasis
#

Hi @pale sequoia welcome back ๐Ÿ™‚

pale sequoia
#

Hey Jack! Welcome back haha

#

did you see the new thread I posted earlier?

gaunt oasis
#

I have asked relevant team on this matter and they told me the user shouldn't need to worry about the session management

#

The SDK and terminal should take care of it

pale sequoia
#

Oh hmmm let me think

gaunt oasis
#

Are you using SDK version 2.0 and above?

pale sequoia
#

Yup! 2.0.0

#

So with the question of "is there a way to re-establish new sessions when a SESSION_EXPIRED / api_key_expired error occurs? Another possibly related question we had: is there a way to check whether a connection token is expired or not?" are you implying it's not really possible for SDK users to do either?

gaunt oasis
#

There is a listener for connection, just one sec, let me dig out the doc

pale sequoia
#

hmm I think we might already be doing that, because we have logs that say "reader connection status changed to NOT_CONNECTED" etc

gaunt oasis
#
                applicationContext, LogLevel.VERBOSE, TokenProvider(),
                TerminalEventListener()
            )```
#

you can register a TerminalEventListener to get notifed when the onConnectionStatusChange happens

pale sequoia
#

one sec let me send you a couple of screenshots

#

of relevant code

#

Yea I think we're already doing that ๐Ÿ˜ฆ

#

I guess youre implying to just listen for the disconnect and then attempt reader reconnection when that happens?

#

we have the emitter and listener setup already

gaunt oasis
#

When the status becomes disconnected, you can either prompt the user to refresh the connection manually, or do it programmatically via Terminal.getInstance().connectBluetoothReader

pale sequoia
#

hmm okay, and yea I see we have a function called "connectReader" that checks for the condition Terminal.getInstance().getConnectedReader() == null so can probably just add the condition to check for NOT_CONNECTED either on the Java or React Native side if we were to go with your suggestion above

#

curious, what are some reasons that cause the SESSION_EXPIRED/api_key_expired error to occur? and just to confirm, we can't check for token expiry explicitly?

gaunt oasis
#

I don't have the details here, but one thing for sure is that the session expiration error is not meant for Stripe user to take care of

#

There is no public API for you to manage the session either.

pale sequoia
#

Hmm okay! I think I may have enough to go from there, but I'll let you or other devs know if I have further questions

#

Thanks again for your help on this lengthy process haha