#kylekhus-terminal
1 messages ยท Page 1 of 1 (latest)
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.
Or give me your merchant ID so I can dig the logs
Apologies as I'm still familiarizing myself with the Stripe dashboard, but how would I be able to obtain the merchant ID as well?
You can find it from the Stripe Dashboard -> Settings ->Account Details
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?
Yup, that's the one
Okay! Umm is this sensitive info that I should send privately?
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
that'll be great!
here's a portion of that user session!
Thanks, and can you tell me the date and timezone?
I think the time you see on those logs is UTC, but the purchase happened on Jan 9, PST
so these are logs in UTC Jan 9, am I right?
Correct!
I'm still digging the logs. Did you do anything to fix the api_key_expiered error?
And how do you write this logs?
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
Do you record the logs in your Android app?
Terminal.getInstance().setTerminalListener(this);
// TerminalListener
@Override
public void onUnexpectedReaderDisconnect(@Nonnull Reader reader) {
// Log here?
}
}```
Oh yea pretty much, we log to Embrace
Is it possible to show me the relevant logging code? so that I know where to trace the problem?
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
No problem, you can come back anytime and there'll be Stripe engineers on duty to support you
Okay sounds good, I'll refer back to this thread when that happens
You can always ask us to reopen the thread ๐
Okay! I'll do that, thanks again Jack!
Have a good rest!
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
Okie, I did a quick search might have found smth
ooooo
Could you verify which Terminal SDK version you are using?
definitely
(Android Terminal SDK) ?
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
Ohhh... One of our report says the error is fixed from 2.0.0... Okie let me digging around a bit more
Thank you! let me know if there's anything I can do to help in the mean time
Do you have a request id? eg the request to create PaymentIntent and failed?
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
Do you have an ideal time frame so I can try to narrow down?
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)
Okie let me see
I see couple of requests to create PI around that time, all succeeded
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
But then we should have a failed request id around that time. The one returns with "Expired key" in your screenshot
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
If you try to narrow down by the time from here, can you find it? https://dashboard.stripe.com/logs
let me see!
Are you using connect? does your partner have another account id?
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?
I think you can start by filtering the "Status" to "failed"
getting closer, at Jan 11 rn haha
still searching almost there
web page is slowing down lol\
Take ur time, I will be back later ๐
@fallen wadi I'm not finding anything in these logs corresponding to our payment intent creation error ๐ฆ
Hi @pale sequoia welcome back ๐
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
Oh hmmm let me think
Are you using SDK version 2.0 and above?
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?
There is a listener for connection, just one sec, let me dig out the doc
hmm I think we might already be doing that, because we have logs that say "reader connection status changed to NOT_CONNECTED" etc
applicationContext, LogLevel.VERBOSE, TokenProvider(),
TerminalEventListener()
)```
you can register a TerminalEventListener to get notifed when the onConnectionStatusChange happens
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
When the status becomes disconnected, you can either prompt the user to refresh the connection manually, or do it programmatically via Terminal.getInstance().connectBluetoothReader
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?