#etienne-s_api
1 messages ยท Page 1 of 1 (latest)
๐ 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. Thank you for your patience!
โฑ๏ธ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime! If this thread is closed and you have another question you'll need to start a new thread.
๐ 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/1214328352115007648
๐ Have more to share? You can add more detail below, including code, screenshots, videos, etc.
Thanks for the info. Do you know the model and OS version of this iPad? And have you tested with other similar iPads on the same OS and such?
The following works:
- iPad 8th gen running 16.6.1
- iPad mini 4 running 15.8
- iPad mini 6 running 17.3
The following does not work:
- iPad 5th gen running 16.7.5
I'm the lead developer on our POS software and I'm trying to troubleshoot this issue that our one customer is experiencing. They said they also bought a new iPad and it also didn't work but they didn't say what model or iPadOS it was running.
On their iPad mini 6 running 17.3 and all our development devices (web, iPads and Android tablet) it works without any problems.
It's a little tricky troubleshooting this because I of course can't get access to their physical iPad or get login details for their Stripe account but I've asked them to send screenshots of logs etc.
Interesting, so a different iPad on their same network can connect properly?
Yes it seems that way
They also sent a screen recording showing this. The iPad mini connects no problems but the normal iPad and apparently the new one they bought just shows the above mentioned error.
I tried searching for issues in github with the Stripe PHP library but those issues were talking about registering new locations. This is just to get the connection token.
It looks like this is a client-side error from the reader. Trying to find more on it
Thanks, much appreciated
Unfortunately I am not finding much on how to find the specific error here. I will consult my colleagues and get back to you
Thanks yeah I was also looking to see if there's somewhere in some code where it returns that error to see when it might occur and also only for this one iPad
Also, to confirm, I assume you are using our React Native SDK rather than integrating our iOS and Android SDKs separately?
Currently our software is native on web using React, native on iOS using cocoapods and native on Android. I'm actually starting to look into React Native
Gotcha, will pass that on
Also would you be able to send your code for your fetchConnectionToken method here? I don't think the code itself would be the problem if other devices are connecting fine, but it may still be helpful to have on hand
This is my token provider
And in my PHP API call I have:
try {
$stripe = new \FooSales\Stripe\StripeClient( $stripe_secret_key );
$connection_token = $stripe->terminal->connectionTokens->create( array() );
$result = array(
'status' => 'success',
'secret' => $connection_token['secret'],
);
} catch ( \FooSales\Stripe\Exception\ApiErrorException $e ) {
$result['message'] = $e->getMessage();
} catch ( Exception $e ) {
$result['message'] = $e->getMessage();
} catch ( Error $e ) {
$result['message'] = $e->getMessage();
}
Thank you
Still brainstorming what may be happening. Can you tell me more about what this user's situation is? It sounds like they are a single person and it is on your users to set up the device and connection unsupervised?
We have a WordPress plugin that does all the communication between Stripe and our native React, iOS and Android apps. So basically they use our POS software but with their Stripe account details. So they grab their API keys from their Stripe dashboard and save it in their database. They setup their own Stripe locations but in the app they can register a new device using the registration token (talking about the WisePOS E reader).
The app has the token provider which sends a request via our plugin's API that sits on their own server which then requests the connection token from Stripe using their API keys.
...if that makes sense
Hi ๐
I'm stepping in to help take a second look since this is an odd situation.
I know right? We don't have any other customers with the same issue.
The error is saying that the completion block was called with an error. Is it possible they used the iPad bluetooth settings to connect with the readers?
Our interface has a very specific distinction between the Bluetooth reader and the smart reader. They first tried the M2 reader and sent screenshots showing it discovering nearby Bluetooth readers. They were able to connect their iPad mini to the M2 reader but not the iPad.
They then went and got the WisePOS E reader and could get it connected on the iPad mini but also not on the iPad.
Hmmmm..... ๐ค
Each of those seems to point to the iPads being the problem, not your server code or the readers. But, of course, we still want to help them.
That's what I've been thinking, but I can't think of what might be different just on that one iPad.
Just the one? I thought there were two that were not connecting.
Sorry yes it was the iPad 5th gen and they said they bought a new one and it did the same. I've asked them what model and iPadOS it's running.
I've asked about possible VPNs or some other configuration on the iPad that would be different from the iPad mini but they're adamant there's nothing.
As I said I've tried digging through the iOS and PHP Stripe library code to see exactly where that error is returned but wasn't able to find it. Not sure if that's received directly from the Stripe server though
Yeah it appears to be something the iOS SDK throws.
Do you see the requests for Connection Tokens coming from the iPads that are failing?
Do you mean in the Stripe dashboard developer logs?
They sent me screenshots of the logs where the iPad mini connected successfully:
No I mean the request going to your PHP server
They then also said:
"I then disconnected the reader from the iPad mini, and attempted to connect it to the regular 7th generation iPad running IPad OS 16.5. As. you can see it gave me a discover readers request, and nothing else -- no connection tokens, no errors, etc."
RIght, we know those work
What I"m asking is, does their request to create a Connection Token reach your PHP server? Which is what makes the call to the Stripe API, right?
Yes it does. Just to clarify the PHP is running on their own server. There isn't any connection via a server of ours. The iPad app sends an API request to our WordPress plugin which is installed on their own site which then connects to the Stripe server.
Okay, got it.
There would only be errors in the logs if there was a critical PHP failure for some reason and it doesn't look like there were any of those.
Okay so unforunately I think that is where we need much more detail
Yeah it's super tricky when most of the work is done on devices or servers we don't have access to.
I'll see if I can get them to export a server log just to see if there was maybe a connection issue or what might be preventing the PHP from generating a token
If the request wasn't making it to the PHP code, then we could blame the connectivity of the ipads. But at this point I think we need to validate what is being returned to them when the request hits that PHP code
This is our block of PHP that performs that request:
try {
$stripe = new \FooSales\Stripe\StripeClient( $stripe_secret_key );
$connection_token = $stripe->terminal->connectionTokens->create( array() );
$result = array(
'status' => 'success',
'secret' => $connection_token['secret'],
);
} catch ( \FooSales\Stripe\Exception\ApiErrorException $e ) {
$result['message'] = $e->getMessage();
} catch ( Exception $e ) {
$result['message'] = $e->getMessage();
} catch ( Error $e ) {
$result['message'] = $e->getMessage();
}
Looking at the token provider, it would fail if:
- there is no valid data
- the data cannot be serialized from the JSON
- if there is no secret
It also looks like if there is no data it specifically would show "No data in response from ConnectionToken endpoint" and the no secret message would be "Missing secret in ConnectionToken JSON response"
So the only other one would be the jsonSerializationError which just sends along whatever that error was.
What I can try is create a development build and then output what that entire jsonSerializationError is.
That would be helpful. It looks like this is a generic client side error for when your completion returns an error. I will try setting messages via userInfo like you are to see if that effects the popup.
Thanks for the assistance, I know it's a weird one this. I'll reply here in case I figure out anything else.