#asim_86993
1 messages · Page 1 of 1 (latest)
Did you have any error from the code here?
useEffect(() => {
const { error } = await discoverReaders({
discoveryMethod: 'localMobile',
});
}, [discoverReaders]);
No Error come here,,
but this value come from the discoveredReaders state of useStripeTerminal hook
Did you have any readers here?
onUpdateDiscoveredReaders: (readers) => {
// The `readers` variable will contain an array of all the discovered readers.
},
here in reader this value come
[{"availableUpdate": null, "baseUrl": null, "batteryLevel": null, "bootloaderVersion": null, "configVersion": null, "deviceSoftwareVersion": "unknown", "deviceType": "cotsDevice", "emvKeyProfileId": null, "firmwareVersion": null, "hardwareVersion": "unknown", "id": null, "ipAddress": null, "label": null, "location": null, "locationId": null, "locationStatus": "unknown", "macKeyProfileId": null, "pinKeyProfileId": null, "pinKeysetId": null, "serialNumber": "fa3b71f4-0555-4b75-b7d6-538b4626c3a0", "settingsVersion": null, "simulated": true, "status": "unknown", "trackKeyProfileId": null}]
Hmm not sure why. Have you tried with different device?
i tried it with Google Pixel 4 ...
1+ 7 pro but the same output..
Here also no error and reader come
useEffect(() => {
const initAndClear = async () => {
const { error, reader } = await initStripe();
console.log('Reader Data', reader + ' ' + error);
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]);
Hi @vocal roost can you tell us what's your expectation of the readers that you receive in onUpdateDiscoveredReaders ?
Also are you using the latest release? https://github.com/stripe/stripe-terminal-react-native/releases
React Native SDK for Stripe Terminal. Contribute to stripe/stripe-terminal-react-native development by creating an account on GitHub.
Yes i used this one
"@stripe/stripe-terminal-react-native": "^0.0.1-beta.13",
Did you specify a location when you connect https://stripe.com/docs/terminal/payments/connect-reader?terminal-sdk-platform=react-native&reader-type=tap-to-pay#connect-reader ?
I also noticed simulated:true in the response, which means that you are using a simulated reader.
First to discover reader we get this response from sdk, where the valuse is null, so how we go to next...my issue is here when we discover the value is null why?
[{"availableUpdate": null, "baseUrl": null, "batteryLevel": null, "bootloaderVersion": null, "configVersion": null, "deviceSoftwareVersion": "unknown", "deviceType": "cotsDevice", "emvKeyProfileId": null, "firmwareVersion": null, "hardwareVersion": "unknown", "id": null, "ipAddress": null, "label": null, "location": null, "locationId": null, "locationStatus": "unknown", "macKeyProfileId": null, "pinKeyProfileId": null, "pinKeysetId": null, "serialNumber": "fa3b71f4-0555-4b75-b7d6-538b4626c3a0", "settingsVersion": null, "simulated": true, "status": "unknown", "trackKeyProfileId": null}]
That's because you are using a simulated reader.
Did you follow the guide step-by-step? https://stripe.com/docs/terminal/payments/connect-reader?reader-type=tap-to-pay For example, create a location first?
Actually we use React Native, so i follow this doc
So when we remove the simulated:true we got this error
[Stripe terminal]: didFinishDiscoveringReaders {"error": {"code": "INTEGRATION_ERROR.LOCAL_MOBILE_DEBUG_NOT_SUPPORTED", "message": "Debuggable applications are not supported in the production version of the localmobile reader. Please use a simulated version of the reader by setting DiscoveryConfiguration.isSimulated to true."}}
You still need to specify a location ID anyway, so I'd suggest you to follow the link that I shared earlier to create a location, and pass in the location ID when calling connectLocalMobileReader
You need to pass in simulated:true unless you are building for prod
I confused, can we use static locationId from the link you give, OR we used it from discoveredReaders state of useStripeTerminal hooks
What do you mean by "static locationId from the link"?
I mean when we create locationId here how we get it in the code.
You'll get a locaiton ID after creating a location, a location ID starts with tml_
This is the API reference https://stripe.com/docs/api/terminal/locations/create#create_terminal_location, you can also use the code in the integration guide to create a location
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.