#rlfrahm_terminal-reactnative

1 messages · Page 1 of 1 (latest)

restive compassBOT
#

👋 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/1271129278905319485

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

modern silo
#

Have you tried multiple networks? Could be an issue with your network connection

shut tide
#

Yes. How is it receiving a connection token from the remote server but not the other requests?

modern silo
#

Well it sounds like issue is in connecting with the device, right?

shut tide
#

Yes it does sound like that but I don't really understand how it would be able to fetch a connection token successfully, but then the calls to Stripe via getLocations() and discoverReaders() aren't connecting.

#

Let me get you some logs

#
 LOG  {"secret": "pst_test_YWNjdF8xRGhJTGVDdGJ4NXlES0tlLGMzaFdpNnpTaE0zVFR2M2s2MGVwNXNpNjZpd3FwczQ_003Vw9vC6L"}
 LOG  {"reader": undefined, "sdk": {"networkStatus": "unknown", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
 LOG  [Stripe terminal]: didChangeOfflineStatus {"reader": undefined, "sdk": {"networkStatus": "unknown", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
 LOG  StripeTerminal has been initialized properly
 LOG  {"secret": "pst_test_YWNjdF8xRGhJTGVDdGJ4NXlES0tlLGMzaFdpNnpTaE0zVFR2M2s2MGVwNXNpNjZpd3FwczQ_003Vw9vC6L"}
 LOG  {"secret": "pst_test_YWNjdF8xRGhJTGVDdGJ4NXlES0tlLGMzaFdpNnpTaE0zVFR2M2s2MGVwNXNpNjZpd3FwczQ_003Vw9vC6L"}
 LOG  [Stripe terminal]: didChangeOfflineStatus {"reader": undefined, "sdk": {"networkStatus": "online", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
 LOG  {"reader": undefined, "sdk": {"networkStatus": "online", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
 LOG  [Stripe terminal]: didFinishDiscoveringReaders {"error": {"code": "USER_ERROR.NO_LAST_SEEN_ACCOUNT", "message": "Account id must not be null, connect to reader while online."}}
 ERROR  Discover readers error USER_ERROR.NO_LAST_SEEN_ACCOUNT, Account id must not be null, connect to reader while online.
#

That error happens after the getLocations() call times out. You can see that the device says it's networkStatus is online and a connection token is fetched.

modern silo
#

Looking

restive compassBOT
hearty warren
#

rlfrahm_terminal-reactnative

modern silo
#

Can you share the reader serial num?

shut tide
#

SDR70Z1C410000038

hearty warren
#

thanks, we're looking

shut tide
#

When creating the connection token on my remote server it looks like this just as fyi:

const connectionToken = await stripe.terminal.connectionTokens.create({
  idempotencyKey: new Date().getTime().toString(),
  stripeAccount: process.env.STRIPE_ACCOUNT_ID!,
})

I originally didn't have any params passed in, but I've been attempting to debug that account id must not be null error which is why I'm manually including stripeAccount

#

And I've triple checked I'm using a secret key from that Stripe test account.

hearty warren
#

Are you using Stripe Connect? I think you got things completely mixed up

#

You seem to use the API key from the same account you pass in stripeAccount

shut tide
#

I am not using Connection... STRIPE_ACCOUNT_ID is our account id. I stuck that in there after receiving this error.

#

I will remove it

hearty warren
#

okay let me know if it still happensa fter you remove it

shut tide
#

Can you confirm what type of discoveryMethod should be used for the S700. Is it internet or handoff?

hearty warren
#

I don't really get the question. What part of the docs are you following that is confusing you?

shut tide
#

Different error, but it seems like I either get this one of the account id one

 LOG  {"secret": "pst_test_YWNjdF8xRGhJTGVDdGJ4NXlES0tlLHRpcE1tQkw4bENKU0dtUUZGdnBTMUNOV3U4Sk5SbW4_00gK7I85c7"}
 LOG  [Stripe terminal]: didChangeOfflineStatus {"reader": undefined, "sdk": {"networkStatus": "unknown", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
 LOG  {"reader": undefined, "sdk": {"networkStatus": "unknown", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
 LOG  StripeTerminal has been initialized properly
 LOG  {"secret": "pst_test_YWNjdF8xRGhJTGVDdGJ4NXlES0tlLHRpcE1tQkw4bENKU0dtUUZGdnBTMUNOV3U4Sk5SbW4_00gK7I85c7"}
 LOG  {"secret": "pst_test_YWNjdF8xRGhJTGVDdGJ4NXlES0tlLHRpcE1tQkw4bENKU0dtUUZGdnBTMUNOV3U4Sk5SbW4_00gK7I85c7"}
 LOG  [Stripe terminal]: didChangeOfflineStatus {"reader": undefined, "sdk": {"networkStatus": "online", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
 LOG  {"reader": undefined, "sdk": {"networkStatus": "online", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
 LOG  > getLocations response {"error": {"code": "NETWORK_ERROR.CONNECTION_TOKEN_PROVIDER_ERROR", "message": "Timed out waiting for connection token"}, "hasMore": undefined, "locations": undefined}
#

Now I just reloaded the app and it worked!?

hearty warren
#

lol

#

I do think you got Connect things mixed up entirely

shut tide
#

I swear

hearty warren
#

you likely were using the platform's key and the wrong account id somewhere and things got out of sync

shut tide
#

I was getting these errors before adding stripeAccount

#

Let me try my own app now and see

hearty warren
#

sounds good

shut tide
#

I've been scratching my head at these problems for 2 weeks. Nothing like getting gaslit by your own code.

#

Yeah similar error happening there still:

 LOG  > isInitialized false > connectedReader false > simulated false
 LOG  > fetchTokenProvider => https://bound-server.vercel.app/api/connection_token
 LOG  > connectionToken  pst_test_YWNjdF8xRGhJTGVDdGJ4NXlES0tlLHRpcE1tQkw4bENKU0dtUUZGdnBTMUNOV3U4Sk5SbW4_00gK7I85c7
 LOG  > fetchTokenProvider => https://bound-server.vercel.app/api/connection_token
 LOG  [Stripe terminal]: didChangeOfflineStatus {"reader": undefined, "sdk": {"networkStatus": "unknown", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
 LOG  > fetchTokenProvider => https://bound-server.vercel.app/api/connection_token
 LOG  > getting locations
 LOG  > isInitialized true > connectedReader false > simulated false
 LOG  > connectionToken  pst_test_YWNjdF8xRGhJTGVDdGJ4NXlES0tlLHRpcE1tQkw4bENKU0dtUUZGdnBTMUNOV3U4Sk5SbW4_00gK7I85c7
 LOG  > connectionToken  pst_test_YWNjdF8xRGhJTGVDdGJ4NXlES0tlLHRpcE1tQkw4bENKU0dtUUZGdnBTMUNOV3U4Sk5SbW4_00gK7I85c7
 LOG  [Stripe terminal]: didChangeOfflineStatus {"reader": undefined, "sdk": {"networkStatus": "online", "offlinePaymentAmountsByCurrency": {}, "offlinePaymentsCount": 0}}
 LOG  > locations {"error": {"code": "NETWORK_ERROR.CONNECTION_TOKEN_PROVIDER_ERROR", "message": "Timed out waiting for connection token"}, "hasMore": undefined, "locations": undefined}
hearty warren
#

Unfortunately this is going to be tough when there's absolutely no information and it was failing but then working for no apparent reason on the demo app

keen knoll
#

Hi 👋

I'm jumping in as I have a little more experience with Terminal integrations. Can you please share the specific integration documentation you are following and which step you are on when the error apepars.

#

I'm confused by your error because you log clearly shows that you received a connection token with a secret value of pst_test_YWNjdF8xRGhJTGVDdGJ4NXlES0tlLHRpcE1tQkw4bENKU0dtUUZGdnBTMUNOV3U4Sk5SbW4_00gK7I85c7

shut tide
#

I'm using the Stripe Terminal RN sdk.

#

And yes, I'm confused as well. It's as if the context from the StripeTerminalProvider is not being used properly by the useStripeTerminal() hook sometimes?

#

I've isolated my component and provider all into one file to make sure that RN layouts weren't causing an issue or anything. I was seeing a similar issue using the official example app too.

#

¯_(ツ)_/¯

#

And now it just started working randomly?... fml

#

I have never been able to discover readers on the physical device until this morning after jumping on here.

keen knoll
#

Personally I think React hooks (and therefore React Native) are one of the greatest failures of coding ever designed but let's leave that aside for now.

It sounds like it might actually have to do with the network connection. Looking at the logs for this reader, I do see a number of failures to connect to one of our servers we use to check reader health.

shut tide
#

Oh interesting...

keen knoll
#

If you see anything like the following in the logs anywhere, it implies we are trying to connect via the internet but cannot.
java.net.UnknownHostException: Unable to resolve host "armada.stripe.com": No address associated with hostname

shut tide
#

And yes, it would be SUPER if you could move to a more declarative approach for your RN sdk.

#

I don't have those logs available immediately to me because I'm using the command expo run:android

keen knoll
#

And yes, it would be SUPER if you could move to a more declarative approach for your RN sdk.
I'm not familiar enough with React architecture to fully grasp this but more declarative coding and less callbacks & hooks would make me happier too 😅

#

OH. Expo is it's own weird kettle of fish with respect to the React native SDK.

shut tide
#

I make an outside connection successfully 100% of the time to 2 different other external endpoints that I own: 1) creating the connection token, and 2) doing other queries related to the business of the app which fetch data and etc.

keen knoll
#

But I'm guessing you probably saw this already.

shut tide
#

Yeah I have that in app.json

#

Is that connection problem to stripe servers on your side or my side do you think?

keen knoll
#

It would be specificly for the S700 device

shut tide
#

Ok, not sure why that would be happening because I've switched to 2 different Wifi's to remedy with the same result.

keen knoll
#

Sorry, is this for an Android app you are writing that is deployed on the S700?

shut tide
#

RN Expo running via expo run:android on the S700 via a usb cable.

keen knoll
#

Okay but you are not building an Android app to run on a different mobile device and use the S700 just to collect card details, right?

shut tide
#

Correct. This app is dedicated S700 all-in-one.

keen knoll
#

Also, what version of the RN SDK are you using?

shut tide
#

Latest 0.0.1-beta.20

restive compassBOT
shut tide
#

So are you saying that I should be using handoff mode instead of internet?

keen knoll
#

I'm saying you should follow whatever steps are in the guide for apps on devices. I have not worked through that integration as we focus less on betas so I cannot speak to more than what is in the docs.

shut tide
#

I get the same error no matter what discover method I choose:

 LOG  > isInitialized false > connectedReader false > simulated false
 LOG  > fetchTokenProvider => https://bound-server.vercel.app/api/connection_token
 LOG  > connectionToken  pst_test_YWNjdF8xRGhJTGVDdGJ4NXlES0tlLHRpcE1tQkw4bENKU0dtUUZGdnBTMUNOV3U4Sk5SbW4_00gK7I85c7
 LOG  > getting locations
 LOG  > isInitialized true > connectedReader false > simulated false
 LOG  > locations {"error": {"code": "NETWORK_ERROR.CONNECTION_TOKEN_PROVIDER_ERROR", "message": "Timed out waiting for connection token"}, "hasMore": undefined, "locations": undefined}
#

Despite the fact that other external network requests are working. It seems like that issue with armada.stripe.com may have some merit.

keen knoll
#

Can you try modifying the DNS servers on the S700?

shut tide
#

Yes, what do you want them set as?

keen knoll
#

We mention this in our troubleshooting doc

If you’re using smart readers and our Terminal SDK on a separate point of sale device:
On your point of sale device, try resolving 10-42-42-42.test.device.stripe-terminal-local-reader.net to an IP address. That hostname should resolve to the IP 10.42.42.42. If it resolves to a different IP, or if DNS resolution fails, configure your point of sale device to use Cloudflare DNS servers (1.1.1.1 and 1.0.0.1) or Google DNS servers (8.8.8.8 and 8.8.4.4) and try again.

#

but it should still apply here. Using Cloudflare or Google DNS servers

shut tide
#

10-4, just a sec.

keen knoll
#

I've got to step away but if you are still having issues with this I recommend you reach out to Support https://support.stripe.com/contact or your Stripe account rep (if you have one) and try to be as clear and specific as you can. Include the docs you are following, the steps your application is taking, and the code that is being run.

This will help get your issue raised to the correct team with the context needed to provide an answer.

shut tide
#

been trying to get support from Stripe for weeks and it's been extremely painful. Email support has done nothing but go in circles.

#

So now it sort of works... I have been inconsistently able to discover the handoff reader, but it struggles to connect to it.

#

If I refresh the app it will then connect, sort of like it hangs up without an app refresh.

fierce nebula
#

I can understand your frustration, but please be patient with them. This will have to be raised to the product eng team, since they handle support for beta features/products

shut tide
#

They referred me here

#

Getting this error returned from GET https://api.stripe.com/v1/terminal/connection_tokens/account:

{
  "error": {
    "message": "The Stripe Terminal ConnectionToken has already been redeemed. Please generate a new one using v1/terminal/connection_tokens.",
    "request_log_url": "https://dashboard.stripe.com/test/logs/req_uzvFL58QWetAEO?t=1723140336",
    "type": "invalid_request_error"
  }
}
#

The Stripe Provider is making 3 duplicate connection token requests

fierce nebula
#

Do you have an email I can use to look up that email thread? They shouldn't be referring you here

shut tide
#

I want to apologize and mention again that I do not serve in a technical capacity here at Stripe, so I am not going to be the best person to tell you exactly why something isn't working regarding your code and the Terminal SDK. I am passing along the guidance that the Terminal product team is giving me, so I am sorry that I can't be of more help. I think it would make sense to ask the developers in our Discord channel, I think they would be able to diagnose!
My email is frahmryan@gmail.com

fierce nebula
#

Got it, alright. Yeah, I think that person was confused. The product team is responsible for handling support for beta products. I'll ping them and see if they can take a closer look. We really don't have the context needed to answer questions about it here

shut tide
#

I did find one issue on my side. The app is make several calls to my connection_token endpoint and the endpoint was caching subsequent requests, resulting in some of the errors where it doesn't like the connection token. It now seems to be discovering the reader now almost every time, it's just that my call to connect to the reader is still timing out.

#

Ultimately, once the request times out after 60 seconds I am receiving this issue:

connectHandoffReader error {
  "code": "READER_ERROR.READER_COMMUNICATION_ERROR",
  "message": "RPC application error AUTHENTICATION_FAILURE with message Invalid API Key provided: psst_off******oken"
}
restive compassBOT