#dom_code
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/1336546065284857908
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi! The code above is for creating a connection. When are you getting this error?
Yeah sorry. I wanted to put more code snippets in as well.
I had a few questions for you that maybe you could answer which will help us debug this:
- Is this a common error you hear about?
- Could it be to do with the phone going idle?
- Are there any places you think we could log in our code which would help determine the issue of this?
Can you log the prefix of the secret you're passing?
What do you mean by that? Log the first few characters of the clientSecret?
- Is there any are of the Stripe dashboard logs we should be looking?
What do you mean by that? Log the first few characters of the clientSecret?
So different client secrets have different prefixs. When you log it, you can see if you are passing the correct secret to the correct request.
By log, I'm referring to console logging the secret.
const _retrievePaymentIntent = async (clientSecret: string) => {
const { paymentIntent, error } = await retrievePaymentIntent(clientSecret);
Sentry.getIsolationScope().setTag('BoostDonate', '_retrievePaymentIntent');
recordError(error, 'Stripe Error');
console.log({ paymentIntent });
if (error) {
setAlertTitle(getLocale('something_wrong'));
// ***** THIS IS WHERE THE ERROR IS GETTING FIRED ****
Sentry.withScope(scope => {
scope.setTag('BoostDonate', error.message);
Sentry.breadcrumbsIntegration(
'useStripeToPay:::clientSecret',
clientSecret,
);
Sentry.captureException(error);
});
if (error.code === 'NotConnectedToReader') {
onDeviceReconnectCallback();
recordError(error, 'useStripeToPay:::_retrievePaymentIntent');
extraInfo.current = error;
if (setConfirmationText) {
setConfirmationText('Okay');
}
setShowAlert(true);
} else {
if (setConfirmationText) {
setConfirmationText('Okay');
}
extraInfo.current = error;
setShowAlert(true);
}
console.log(
`terminal.retrievePaymentIntent :: Failed :: code :: ${error.code} :: ${error.message}`,
);
} else if (paymentIntent) {
console.log(
`terminal.retrievePaymentIntent :: Collected :: paymentIntent.id :: ${paymentIntent.id}`,
);
await _collectPaymentMethod(paymentIntent);
}
};
We can see in sentry that after we try and retrievePaymentIntent we get an error. Previously we did not log the clientSecret but I was going to push that extra Sentry log so that we can see it in a TestFlight enviroment
@silent marten , what are the different prefixes of the client secret?
Is there a pattern to them?
Once I have logged it how do I know what the clientSecret should have been?
The connection token secret starts with pst: https://docs.stripe.com/api/terminal/connection_tokens/object while the PaymentIntent secret starts with pi_xyz_secret_xyz https://docs.stripe.com/api/payment_intents/object#payment_intent_object-client_secret
Once you log it, you can see if you are passing the correct secret to the correct request.