#demodian_api

1 messages Β· Page 1 of 1 (latest)

buoyant hingeBOT
#

πŸ‘‹ 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/1395105646130761839

πŸ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

sour dew
#

Hi, I'm getting help from a teammate who has more expertise with Stripe Terminal + React Native

past relic
#

ok

past plume
#

Hi there

past relic
#

hi

past plume
#

Both actions should be quite quick assuming there isn't a networking issue.

past relic
#

it just seems to take forever though

past plume
#

Does it eventually connect?

#

Or it just hangs and timesout?

past relic
#

and once I start discoverReaders(), it sometimes repeats on its own without me triggering it

past plume
#

Can you share your relevant code?

#

Are you doing something within onDidReportUnexpectedReaderDisconnect?

past relic
#

that's a sample output of debug messages. it's a lot for one call to discoverReaders

past plume
#

Can I see your code please? And can you answer my previous questions?

past relic
#

moment as i'm trying to package stuff up

past plume
#

Sure, just include the relevant pieces though please.

past relic
#

there's really only 3 files that are relevant so far for using the Terminal SDK

#

the last one is kinda disorganized as I am still actively working on that screen trying to test

past plume
#

You are connecting via Bluetooth here?

#

Or USB?

past relic
#

yes, to the M2

#

the phone is tethered to my laptop for debugging, so I have to use bluetooth for now

#

as far as the connection, it doesn't connect, but it doesn't timeout either

past plume
#

What about discoverReaders() -- that seems like it runs per your logs

past relic
#

it sometimes doesn't register the reader and sits there, so i might have to try waking up the reader (i think), but if I do nothing, i keep getting discovery information even after the list is returned

past plume
#

Okay let's start by just commenting out your onDidDiscoverFinish(readers); within onUpdateDiscoveredReaders() and just calling:

 const { reader, error } = await connectReader(
    {
      reader: readers[0],
      locationId: '{{LOCATION_ID}}',
    },
    'bluetoothScan'
  );

  if (error) {
    console.log('connectReader error', error);
    return;
  }

  console.log('Reader connected successfully', reader);

There with your necessary location ID

#

Also let's comment out your onFinishDiscoveringReaders() code for now too

past relic
#

StripeTerminal has been initialized properly
LOG calling
LOG calling get_all_readers
LOG prior to call
LOG [Stripe terminal]: didUpdateDiscoveredReaders [{"availableUpdate": null, "baseUrl": null, "batteryLevel": null, "bootloaderVersion": null, "configVersion": null, "deviceSoftwareVersion": "unknown", "deviceType": "stripeM2", "emvKeyProfileId": null, "firmwareVersion": null, "hardwareVersion": "unknown", "id": null, "ipAddress": null, "label": null, "location": {"address": [Object], "displayName": "POS1", "id": "tml_E6lpbwVXIHvD0n", "livemode": false}, "locationId": "tml_E6lpbwVXIHvD0n", "locationStatus": "set", "macKeyProfileId": null, "pinKeyProfileId": null, "pinKeysetId": null, "serialNumber": "STRM26214062291", "settingsVersion": null, "simulated": false, "status": "unknown", "trackKeyProfileId": null}]
LOG Discover Readers update
LOG results [undefined, undefined]
LOG [Stripe terminal]: didFinishDiscoveringReaders {}
LOG Discover readers finished
LOG called callback []
LOG connectReader error {"code": "READER_ERROR.BLUETOOTH_DISCONNECTED", "message": "Bluetooth unexpectedly disconnected during operation."}

past plume
#

Okay cool so at least there is an error

#

Now why would that happen πŸ€”

past relic
#

you got me. the m2 is like 6 inches from the phone, and battery is showing like 3 lit LEDs

past plume
#

The answer was oddly that I needed to connect my M2 terminal to my device via bluetooth first, then the stripe terminal sdk will connect. This isn't what the docs say, but at least it works now.

#

Are you doing that?

past relic
#

pre-pairing the m2 with the phone?

past plume
#

Yeah, I assume you are but worth the check.

past relic
#

the documentation says not to... -_-

buoyant hingeBOT
past plume
#

Ah right πŸ˜“

#

Okay well try doing that and let's see if that fixes it...

past relic
#

moment. testing... and waiting...

#

LOG [Stripe terminal]: didChangeOfflineStatus {"reader": {}, "sdk": {"networkStatus": "unknown", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
LOG StripeTerminal has been initialized properly
LOG [Stripe terminal]: didChangeOfflineStatus {"reader": {}, "sdk": {"networkStatus": "online", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
LOG calling
LOG calling get_all_readers
LOG prior to call
LOG [Stripe terminal]: didChangeConnectionStatus discovering
LOG connection status discovering
LOG [Stripe terminal]: didUpdateDiscoveredReaders [{"availableUpdate": null, "baseUrl": null, "batteryLevel": null, "bootloaderVersion": null, "configVersion": null, "deviceSoftwareVersion": "unknown", "deviceType": "stripeM2", "emvKeyProfileId": null, "firmwareVersion": null, "hardwareVersion": "unknown", "id": null, "ipAddress": null, "label": null, "location": {"address": [Object], "displayName": "POS1", "id": "tml_E6lpbwVXIHvD0n", "livemode": false}, "locationId": "tml_E6lpbwVXIHvD0n", "locationStatus": "set", "macKeyProfileId": null, "pinKeyProfileId": null, "pinKeysetId": null, "serialNumber": "STRM26214062291", "settingsVersion": null, "simulated": false, "status": "unknown", "trackKeyProfileId": null}]
LOG Discover Readers update
LOG [Stripe terminal]: didChangeConnectionStatus notConnected
LOG connection status notConnected
LOG results [undefined, undefined]
LOG [Stripe terminal]: didFinishDiscoveringReaders {}
LOG Discover readers finished
LOG called callback []
LOG [Stripe terminal]: didChangeConnectionStatus connecting
LOG connection status connecting
LOG [Stripe terminal]: didChangeConnectionStatus notConnected
LOG connection status notConnected
LOG connectReader error {"code": "READER_ERROR.BLUETOOTH_DISCONNECTED", "message": "Bluetooth unexpectedly disconnected during operation."}

#

okay, i had to power off the reader and turn it back on before discovery would even work (was just sitting there)

#

and that was pre-paired with the phone

past plume
#

Hmm why is your results log undefined for the readers array....

past relic
#

which one?

past plume
#

In your code after you call discoverReaders():

    const { readers, error } = await discoverReaders({
                discoveryMethod: getAppdata('methodid'),
                simulated: false,
                //timeout: 15000,
            });
console.log('results', [ readers, error ]);
#

Ah because I don't think this returns Readers

past relic
#

you got me? i was just dumping what i got back

past plume
#

That promise only returns an error

past relic
#

okay.

#

that simplifies that function, but doesn't help with the rest of the flow

past plume
#

Yeah just looking for clues

past relic
#

(btw, please make sure the example application is in parity with the SDK itself, because in the DiscoverReadersScreen.tsx, it is trying to call various connect<method>Reader() functions that do not get exposed by useStripeTerminal()

#

there's a connectBluetoothReader() that doesn't exist

past plume
#

Happy to pass on that feedback.

past relic
#

same for Internet, Handoff, etc)

past plume
#

This SDK is still in beta so there are certainly still some rough edges

past relic
#

because technically the example app will not work. all that is available is connectReader()

#

i know the M2 has a sleep feature, so i make sure to press the side button before I try any discovery or manual connection attempts

past plume
#

Okay let's do one more test to ensure we get the same error... don't connect the Reader Bluetooth Settings on your mobile device and let's comment out the onFinishDiscoveringReaders() code to avoid some of the verbosity here.

past relic
#

so unpair first?

past plume
#

Yes

past relic
#

done and restarting everything. force quit the app, and restarted expo

past plume
#

Also when you get a moment, what version of the SDK are you using here?

past relic
#

[Stripe terminal]: didChangeOfflineStatus {"reader": {}, "sdk": {"networkStatus": "unknown", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
LOG StripeTerminal has been initialized properly
LOG [Stripe terminal]: didChangeOfflineStatus {"reader": {}, "sdk": {"networkStatus": "online", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
LOG calling
LOG calling get_all_readers
LOG prior to call
LOG [Stripe terminal]: didChangeConnectionStatus discovering
LOG connection status discovering
LOG [Stripe terminal]: didUpdateDiscoveredReaders [{"availableUpdate": null, "baseUrl": null, "batteryLevel": null, "bootloaderVersion": null, "configVersion": null, "deviceSoftwareVersion": "unknown", "deviceType": "stripeM2", "emvKeyProfileId": null, "firmwareVersion": null, "hardwareVersion": "unknown", "id": null, "ipAddress": null, "label": null, "location": {"address": [Object], "displayName": "POS1", "id": "tml_E6lpbwVXIHvD0n", "livemode": false}, "locationId": "tml_E6lpbwVXIHvD0n", "locationStatus": "set", "macKeyProfileId": null, "pinKeyProfileId": null, "pinKeysetId": null, "serialNumber": "STRM26214062291", "settingsVersion": null, "simulated": false, "status": "unknown", "trackKeyProfileId": null}]
LOG Discover Readers update
LOG [Stripe terminal]: didChangeConnectionStatus notConnected
LOG connection status notConnected
LOG results undefined
LOG [Stripe terminal]: didFinishDiscoveringReaders {}
LOG [Stripe terminal]: didChangeConnectionStatus connecting
LOG connection status connecting
LOG [Stripe terminal]: didChangeConnectionStatus notConnected
LOG connection status notConnected
LOG connectReader error {"code": "READER_ERROR.BLUETOOTH_DISCONNECTED", "message": "Bluetooth unexpectedly disconnected during operation."}

#

"version": "0.0.1-beta.25"?

#

is that latest?

past plume
#

Okay thanks for testing again. I need to step away for a bit so I'm grabbing a colleague who will continue to help debug here.

past relic
#

sure

sick delta
#

πŸ‘‹ Give me a few to take a look πŸ™‚

#

Hmm based on the SDK logs the reason for disconnection is unknown, huhh πŸ˜…
Let me see if there's a way to pull any other logs

past relic
#

sure. and I'm trying to get packaged the whole project source if need be

sick delta
#

Is this happening on Android/iOS or both

past relic
#

only testing android right now. don't have access to an iOS dev environment yet

sick delta
#

do you have another reader you could test with?

#

Just trying to narrow down on what could be causing this

past relic
#

a wisepos e

sick delta
#

Hmm that won't be super helpful but sure, try connecting to that and see if that works?

past relic
#

moment. have to connect it to wifi

sick delta
#

Is your Android Device on Android 14?

past relic
#

almost done updating...

#

yes

sick delta
#

It reports a similar issue

#

But it does say

Update: We were able to fix the issue by rebooting the M2 (long press the power button).

which isn't working for you

past relic
#

this is a HMD Vibe N159V

#

the power off is when it counts down 4, 3, 2, 1?

sick delta
#

Yup

#

If you have a paperclip, you could try factory resetting the device

#

There is a hole on the side that should let you reset it completely

past relic
#

there's one on the top edge by the usb-c connector. still trying to find a paperclip

#

apparently factory resetting the m2 allows the app to ask to pair with it

#

i sure would hate to tape a paperclip on the back of each m2...

sick delta
#

Yup that's not ideal.
Did that work though? Did the reader connect?

past relic
#

i think so, but i got an error on the phone screen, which is other code... moment

sick delta
#

I believe the Reader connected

#

I'm seeing logs of connection succeeding

past relic
#

ahh, it was because the attempted reader wasn't set, to the handler in App failed

#

quick question, on the wisepos e, how do i get it past the colorful startup screen that just says Stripe. none of the buttons work except power...

sick delta
#

That's the default screen the Reader would stay on until it receives commands from the SDK like collect payment method, show a form/input, etc

past relic
#

how would i pair it?

sick delta
#

WisePOS E is a Smart Reader that connects to the Internet directly (as opposed to Bluetooth Reader like M2)

past relic
#

sorry. register

past relic
#

If you have a BBPOS WisePOS E or Stripe Reader S700, go to the reader settings and tap Generate pairing code. - yeah, how do i get to here?

sick delta
#

You can swipe left on that home screen

past relic
#

ah ha. thanks

sick delta
#

It's not intuitive πŸ˜…
Intentional to a certain degree

past relic
#

LOG [Stripe terminal]: didUpdateDiscoveredReaders [{"availableUpdate": null, "baseUrl": null, "batteryLevel": null, "bootloaderVersion": null, "configVersion": null, "deviceSoftwareVersion": "unknown", "deviceType": "stripeM2", "emvKeyProfileId": null, "firmwareVersion": null, "hardwareVersion": "unknown", "id": null, "ipAddress": null, "label": null, "location": {"address": [Object], "displayName": "POS1", "id": "tml_E6lpbwVXIHvD0n", "livemode": false}, "locationId": "tml_E6lpbwVXIHvD0n", "locationStatus": "set", "macKeyProfileId": null, "pinKeyProfileId": null, "pinKeysetId": null, "serialNumber": "STRM26214062291", "settingsVersion": null, "simulated": false, "status": "unknown", "trackKeyProfileId": null}]
LOG Discover Readers update
LOG [Stripe terminal]: didChangeConnectionStatus notConnected
LOG connection status notConnected
LOG results undefined
LOG [Stripe terminal]: didFinishDiscoveringReaders {}
LOG [Stripe terminal]: didChangeConnectionStatus connecting
LOG connection status connecting
LOG [Stripe terminal]: didChangeOfflineStatus {"reader": {}, "sdk": {"networkStatus": "unknown", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
LOG [Stripe terminal]: didChangeOfflineStatus {"reader": {}, "sdk": {"networkStatus": "online", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
LOG [Stripe terminal]: didChangeConnectionStatus notConnected
LOG connection status notConnected
LOG connectReader error {"code": "READER_ERROR.BLUETOOTH_DISCONNECTED", "message": "Bluetooth unexpectedly disconnected during operation."}

#

that was after i said yes to pair the m2

sick delta
#

Quick question, In your bluetooth settings - how many devices do you have?

past relic
#

and after another factory reset

#

connected devices: usb (charging and debugging) and that's it

sick delta
#

I think you're looking at something else there.
Basically, if your device is hitting a bluetooth pairing limit then you'd see the SDK fail the connection as well

past relic
#

weird. it only connected if i checked the allow access to contacts and something else...

#

call history sharing

sick delta
#

That's odd. The SDK requires Location and Bluetooth access.

It shouldn't need contacts & call history access.

past relic
#

but it worked with that on. moment. resetting everything and trying again to reproduce

sick delta
#

πŸ‘

#

It seems like contact & call history sharing is just something the system bluetooth prompt always asks for when you connect to a BT device for the first time, it shouldn't matter if you check that box or not
(it also always shows up and we can't do anything about it)

#

I believe it's something like this

past relic
#

that time it worked without that option turned on

sick delta
#

Android always shows that checkbox even if the bluetooth device isn't capable of actually requesting that data

But yeah okay so it seems like something else is going on with device firmware

past relic
#

no idea

#

i have to keep testing this to reproduce everything....

sick delta
#

Once you restart, how soon are you seeing the issue crop up again?

past relic
#

btw, on the wisepos e, when shutting down, it prompts for "Your phone will shut down." Phone? lol

#

trying again

sick delta
#

The device hardware likely uses a phone's board :p

past relic
#

looks like it may be based on an android model

#

like the keyboard style

#

okay, it reproduced working after a factory reset

sick delta
#

Great. Can you disconnect and try to connect again without factory resetting it?

past relic
#

will have to reset the app ... moment

#

calling get_all_readers
LOG prior to call
LOG [Stripe terminal]: didChangeConnectionStatus discovering
LOG connection status discovering
LOG [Stripe terminal]: didUpdateDiscoveredReaders [{"availableUpdate": null, "baseUrl": null, "batteryLevel": null, "bootloaderVersion": null, "configVersion": null, "deviceSoftwareVersion": "unknown", "deviceType": "stripeM2", "emvKeyProfileId": null, "firmwareVersion": null, "hardwareVersion": "unknown", "id": null, "ipAddress": null, "label": null, "location": {"address": [Object], "displayName": "POS1", "id": "tml_E6lpbwVXIHvD0n", "livemode": false}, "locationId": "tml_E6lpbwVXIHvD0n", "locationStatus": "set", "macKeyProfileId": null, "pinKeyProfileId": null, "pinKeysetId": null, "serialNumber": "STRM26214062291", "settingsVersion": null, "simulated": false, "status": "unknown", "trackKeyProfileId": null}]
LOG Discover Readers update
LOG [Stripe terminal]: didChangeConnectionStatus notConnected
LOG connection status notConnected
LOG results undefined
LOG [Stripe terminal]: didFinishDiscoveringReaders {}
LOG [Stripe terminal]: didChangeConnectionStatus connecting
LOG connection status connecting
LOG [Stripe terminal]: didChangeOfflineStatus {"reader": {}, "sdk": {"networkStatus": "unknown", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
LOG [Stripe terminal]: didChangeOfflineStatus {"reader": {}, "sdk": {"networkStatus": "online", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
LOG [Stripe terminal]: didChangeConnectionStatus notConnected
LOG connection status notConnected
LOG connectReader error {"code": "READER_ERROR.BLUETOOTH_DISCONNECTED", "message": "Bluetooth unexpectedly disconnected during operation."}

without a factory reset on the m2

sick delta
#

Okay so you're able to connect to it once after the reboot and then it doesn't work?

past relic
#

looks it so far

sick delta
#

Gotcha. I'm relaying this to our Terminal Product team.
We might need to convert this into a Support ticket as the fix for this may depend on some internal investigation.

I'll let you know in a bit

past relic
#

i let the app sit there, and then factory reset the m2 and then try reconnecting, and it works

#

looks like i have to make some tweaks for the secret being fetched. thought it was good for the session.. drats

buoyant hingeBOT
past relic
#

now it's not wanting to work after even a factory reset

sick delta
#

Okay looks like this is something our terminal team would need to investigate and see what's going on here.

buoyant hingeBOT
#

Hello @past relic, we have sent you a direct message, please check it at https://discord.com/channels/@me/1395146970284298272

  • πŸ”—The message has instructions on how to open a direct support case with our Developer Support team, in order to help you more effectively.
sick delta
#

Can you submit a support ticket using the above? Lmk once you've done that

#

@past relic ^^ want to make sure you saw my message

agile fjord
#

πŸ‘‹ Once you've submitted the ticket I'll make sure it gets to the right place, so let us know once you've submitted it. πŸ™‚

past relic
#

submitted it

agile fjord
#

Got it - thanks! The team will follow up with you through that conversation, and you're of course welcome to send any further questions in reply.

past relic
#

can i add that you can also reach me via demodian@gmail.com? i can at least access that email address wherever

#

and i've got the source for the project down to 3-4MB zipped as I'm not sure how much under the android directory can be safely trimmed

agile fjord
#

I presume you got a response indicating a case was created, ya? If so, you can reply to that, and cc your other email, and that should mean emails will go to both.

past relic
#

will responses from Stripe use all recipients?

agile fjord
#

I believe so.

past relic
#

great. i was saving integrating with Stripe toward the end of this project, since I knew I'd be spending the most time on it. I at least got the rest of the app workflow hammered out. just need to figure out how to get this done semi-quickly as it would be nice for us to get some live testing before publishing it for our clients' use

agile fjord
#

πŸ‘ πŸ™‚

past relic
#

LOG [Stripe terminal]: didUpdateDiscoveredReaders [{"availableUpdate": null, "baseUrl": null, "batteryLevel": null, "bootloaderVersion": null, "configVersion": null, "deviceSoftwareVersion": "unknown", "deviceType": "stripeM2", "emvKeyProfileId": null, "firmwareVersion": null, "hardwareVersion": "unknown", "id": null, "ipAddress": null, "label": null, "location": {"address": [Object], "displayName": "POS1", "id": "tml_E6lpbwVXIHvD0n", "livemode": false}, "locationId": "tml_E6lpbwVXIHvD0n", "locationStatus": "set", "macKeyProfileId": null, "pinKeyProfileId": null, "pinKeysetId": null, "serialNumber": "STRM26214062291", "settingsVersion": null, "simulated": false, "status": "unknown", "trackKeyProfileId": null}]
LOG reader null
LOG Discover Readers update
LOG [Stripe terminal]: didChangeConnectionStatus notConnected
LOG connection status notConnected
LOG reader null
LOG results undefined
LOG reader null
LOG [Stripe terminal]: didFinishDiscoveringReaders {}
LOG [Stripe terminal]: didChangeConnectionStatus connecting
LOG connection status connecting
LOG [Stripe terminal]: didChangeConnectionStatus notConnected
LOG connection status notConnected
LOG connectReader error {"code": "READER_ERROR.BLUETOOTH_DISCONNECTED", "message": "Bluetooth unexpectedly disconnected during operation."}

it's still failing after the M2 is factory reset. not sure what to think about it now. 😦

agile fjord
#

I'll add this to the internal ticket, but if you can please use the support thread going forward, that will make sure the team has access to these details too.

past relic
#

(and disregard the reader null logs, as I was testing something else in the code)

#

will do. i'll hop out of here and take a mental break. Have a good evening

agile fjord
#

You too! πŸ™‚