#sevak36

1 messages · Page 1 of 1 (latest)

earnest quiverBOT
mortal oyster
#

Hi there, are you using a react native integration?

sudden canopy
#

yes

mortal oyster
#

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.

sudden canopy
#

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"

mortal oyster
sudden canopy
#

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]);```
mortal oyster
#

Can you set a logLevel: 'verbose', and see any warnings or errors?

sudden canopy
#

where do I set this?

mortal oyster
#

It's in the example code


  useEffect(() => {
    initialize({
      logLevel: 'verbose',
    });
  }, [initialize]);```
sudden canopy
mortal oyster
#

Which line of your code triggers this error?

sudden canopy
mortal oyster
#

So you are saying calling initStripe() (aka initialize()) would throw this error?

sudden canopy
#

not sure. but it seems so

mortal oyster
#

It looks strange to me, can you put more logs and just to confirm?