#sevak36
1 messages · Page 1 of 1 (latest)
Hi there, are you using a react native integration?
yes
Can you tell me the problem that you want to sovle? The connection token is managed by the SDK and it's not something that you need to manage yourself.
react native terminal sdk
when I open app I need to know when should I enable discover readers button? If I keep it enabled on app start and user starts clicking it imdiately after opening the app then I get the error message that "First initialize the Stripe Terimal SDK before peforming any action"
https://stripe.com/docs/terminal/payments/setup-integration?terminal-sdk-platform=react-native#initialize did you call the initialize funciton ?
yes
useEffect(() => {
const initAndClear = async () => {
const { error, reader } = await initStripe();
if (error) {
Alert.alert('StripeTerminal init failed', error.message);
return;
}
if (reader) {
console.log(
'StripeTerminal has been initialized properly and connected to the reader',
reader
);
return;
}
console.log('StripeTerminal has been initialized properly');
};
if (hasPerms) {
initAndClear();
}
}, [initStripe, hasPerms]);```
Can you set a logLevel: 'verbose', and see any warnings or errors?
where do I set this?
It's in the example code
useEffect(() => {
initialize({
logLevel: 'verbose',
});
}, [initialize]);```
logs seems same as before
Which line of your code triggers this error?
only place I am initializing in app is this const { error, reader } = await initStripe(); as shown in earlier code
So you are saying calling initStripe() (aka initialize()) would throw this error?
not sure. but it seems so
It looks strange to me, can you put more logs and just to confirm?