Open abhijitCN opened 5 months ago
@abhijitCN are you still running into this issue? initialize
method returns a Promise and you'll need to wait for its completion before calling other methods.
Hi ; I also have the same issue I am trying to implement card reader sdk ReactNative
"First initialize the Stripe Terminal SDK before performing any action"
SDK version "@stripe/stripe-terminal-react-native": "^0.0.1-beta.19",
I have the same issue, I initialize the SDK and after I call the discoverReaders and I have the error, this is my code:
const { error, reader } = await initialize();
...
const { error: discoverReadersError } = await discoverReaders({ discoveryMethod: 'bluetoothScan', simulated: true, });
when the promise of initialize is finished the SDK shouldn't it be ready?
I have the same issue, I initialize the SDK and after I call the discoverReaders and I have the error, this is my code:
const { error, reader } = await initialize();
...const { error: discoverReadersError } = await discoverReaders({ discoveryMethod: 'bluetoothScan', simulated: true, });
when the promise of initialize is finished the SDK shouldn't it be ready?
@GabrielDuarteJr hello, have you got any solution for it!!
hi, I'm also having this issue!
My root is wrapped in a stripe terminal provider (splash screen) then the home page initialises and the payment page scans for readers, but I am getting that error when my useEffect to scan for readers kicks in. Any coms / help would be appreciated, thanks
### In my Root(index.js) I initialized and API call for token and in App.js useEffect call the const { initialize } = useStripeTerminal() as per the documentation but still I get ERROR First initialize the Stripe Terminal SDK before performing any action PLEASE HELP.
import { StripeTerminalProvider } from '@stripe/stripe-terminal-react-native'; import { AppRegistry } from 'react-native'; import { name as appName } from './app.json'; import App from './src/App';
const ReduxAppWrapper = () => { const fetchTokenProvider = async () => { try { const response = await fetch(
FetchTokenApi/stripe/tokens
, { method: 'GET', headers: { 'Content-Type': 'application/json', }, }, ); const {secret} = await response.json(); console.log('fetch Token Provider secret KEY >> ', secret); return secret; } catch (error) { console.log('fetch Token Provider eror >> ', error); } };return ( <StripeTerminalProvider logLevel="verbose" tokenProvider={fetchTokenProvider}>
); }; AppRegistry.registerComponent(appName, () => ReduxAppWrapper);
function App() { const { initialize } = useStripeTerminal();
useEffect(() => { console.log('USE EFFECT >>initialized stripe-terminal in ROOT > '); initialize({ logLevel: 'verbose', }); }, [initialize]);
return ( <>
); } export default App;
@kevinlam92 @mihaildu @TheRusskiy @SudoPlz & ANYONE face this issue