#yaboi_api

1 messages · Page 1 of 1 (latest)

lethal relicBOT
#

đź‘‹ 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/1423082488192041204

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

tribal sleet
#
import StripeTerminal
import SwiftUI

@Observable
class LocalReaderController {
    func connectTapToPay(_ reader: Reader) throws {
        #if DEBUG
            let locationId = "XXXXXXXX"
        #else
            let locationId = "XXXXXXXX"
        #endif
        let connectionConfig = try TapToPayConnectionConfigurationBuilder(
            delegate: ReaderDelegate(),
            locationId: locationId
         )
        .setAutoReconnectOnUnexpectedDisconnect(true)
        .build()
        
        Terminal.shared.connectReader(
            reader,
            connectionConfig: connectionConfig
        ) { reader, error in
            if let reader = reader {
                print("[STRIPE] Successfully connected to reader: \(reader)")
            } else if let error = error {
                print("[STRIPE] connectLocalMobileReader failed: \(error)")
            } else {
                print("[STRIPE] No error returned, but also no reader...")
            }
        }
    }
}

This is the connection function

copper cairn
#

Hi đź‘‹

Where does this error get thrown. When you call the connectToReader function?

tribal sleet
#

yes, it's throwing in

Terminal.shared.connectReader(
            reader,
            connectionConfig: connectionConfig
        ) { reader, error in
            if let reader = reader {
                print("[STRIPE] Successfully connected to reader: \(reader)")
            } else if let error = error {
                print("[STRIPE] connectLocalMobileReader failed: \(error)") // HERE
            } else {
                print("[STRIPE] No error returned, but also no reader...")
            }
        }
#

well, obviously it's not throwing there, it's printing there, it's throwing in the connectReader()

#

this is the tutorial code. It has 2 errors:
Value of type 'TapToPayConnectionConfigurationBuilder' has no member 'delegate'

Missing argument for parameter 'delegate' in call

copper cairn
#

I'm not sure which tutorial you are referring to here

copper cairn
#

Okay so trying to track down the wording in the error. I'm not seeing anything jumping out at me

#

But you are saying you could not add a delegate using the method outlined in the doc?

#

Can you share what version of the SDK you are using?

tribal sleet
#

I can’t add it via .delegate.
It forces me to put in in the init params.

#

And I’m using the newest version of the SDK upgrading in a new app whereas my previous iteration was using one from November 2022 so that’s pretty old

copper cairn
#

Can you please provide specific version numbers

tribal sleet
#

Yeah gimme a sec to check

copper cairn
#

Great, thanks!

tribal sleet
#

Version 4.7.2

copper cairn
#

Okay thank you.

#

I'm looking for this error text and any existing GH Issues for this part of the SDK

tribal sleet
#

Is there potentially a safer version I should try dropping back to?

copper cairn
#

Well I haven't found anything about this issue that suggests it's version related. Was your TTP app working in an earlier version?

tribal sleet
#

Kind of…

Technically this is a “new” integration, but really it’s a rewrite of an existing app that, yes, was working with TTP. But that one was one the 2022 SDK version (sorry don’t have version number) so idk how relevant that one will be other than to say it’s not my phone.

copper cairn
#

And are you re-writing the reader discovery/connection or has that code remained the same?

tribal sleet
#

Enough of its rewritten to say it’s rewritten at this point.

#

Thank you for the help btw. Really appreciate that you guys do this.

lethal relicBOT
sturdy vault
#

hello! taking over from snufkin, but give us a while to get back to you as we're currently in a meeting!

tribal sleet
#

No worries, I appreciate all the help

vague kraken
#

Hi @tribal sleet Can you share with me the code you wrote for creating the connectionConfig? I want to see if you implemented TapToPayReaderDelegate

tribal sleet
#
let connectionConfig = try TapToPayConnectionConfigurationBuilder(
            delegate: ReaderDelegate(),
            locationId: locationId
         )
        .setAutoReconnectOnUnexpectedDisconnect(true)
        .build()
vague kraken
#

Are you also using the latest Stripe Terminal iOS SDK?

tribal sleet
#

yes.

#

actually, my web sdk is likely way out of date. would that matter if it's returning a valid token?

vague kraken
#

What web sdk do you refer to?

tribal sleet
#

whatever is on the server kicking out the stripetoken. (ie the one I haven't looked at since I wrote it 3+ years ago)

vague kraken
#

by stripe token, do you mean connection tokens?

tribal sleet
#

yes

vague kraken
#

Ok, the error that you encountered occurs when reaeer delegate is missing. Can you double check your Stripe Terminal iOS SDK and see if it's the latest verison (i.e., 4.7.2)

tribal sleet
#

It is. Should there be a class that is explicitly conforming to ReaderDelegate?

vague kraken
#

Can you DM me the xcode project so that I can run and reproduce the issue?

tribal sleet
#

yes, let me package it

#

sent.

vague kraken
#

Received. Let me try to run it

#

Hi @tribal sleet Looks like I need a login credential to use you app.

Anyway I'm able to use TapToPayConnectionConfigurationBuilder.init in your project. Here's my code

        let connectionConfig = try TapToPayConnectionConfigurationBuilder
            .init(delegate: LocalReaderDelegate(), locationId: locationId)
            .setAutoReconnectOnUnexpectedDisconnect(true)
            .build()
        ````
tribal sleet
#

I think that’s the same connectionConfig I’m already using. Let me make a quick user.

vague kraken
#

Getting couldn't sign in error

tribal sleet
#

Oh, I think I need to add that uid to a valid user. One moment

#

Should work now. You’re me now.

vague kraken
#
11.11.0 - [FirebaseAuth][I-AUT000018] Error getting App Check token; using placeholder token instead. Error: Error Domain=com.google.app_check_core Code=4 "The attestation provider DeviceCheckProvider is not supported on current platform and OS version." UserInfo={NSLocalizedFailureReason=The attestation provider DeviceCheckProvider is not supported on current platform and OS version.}
[AUTH][ERROR] AUTHKIT ERROR: The supplied auth credential is malformed or has expired.```
tribal sleet
#

Hmmm. Ok, I’m not 100% sure how to fix that. If you’re getting even that far though, the call is actually made in the AppDelegate so you should be seeing logs from it already.

vague kraken
#

Ok, let me dig further. I'll let you know if I find anything

vague kraken
#

I'm having some problems in getting TapToPay working in my iOS phone due to provisioning profile issue, and iOS simulator doesn't support TapToPay.

#

Can I suggest you to write in so that we can continue helping you through emails?

lethal relicBOT
#

Hello @tribal sleet, we have sent you a direct message, please check it at https://discord.com/channels/@me/1423126332979806330

  • đź”—The message has instructions on how to open a direct support case with our Developer Support team, in order to help you more effectively.
vague kraken
#

You'll receive a link in your DM, you can click on the link to create a support case with Stripe support.

tribal sleet
#

thank you so much

tribal sleet
#

UPDATE: This is fixed. I do not really know why this fixed it, but it did. Instead of building the TapToPayConnectionConfiguration in the same function as the reader connection, I moved it inside of the TerminalDelegate class which houses a shared instance of each of the delegates, etc and passed that copy into the config, then passed that config to the reader connection.

I then tried moving it back to its original class, but passed in the shared LocalReaderDelegate and building the config from there, which again, worked.

It seems that Terminal realizes when there are multiple instances of a LocalReaderDelegate in use and throws that error when one of them is attempting use. Certainly not the most obvious error!

Thank you @vague kraken. @sturdy vault, and @copper cairn for all of your help tonight, it's greatly appreciated.

sturdy vault
#

yay! great that it's fixed and thanks for sharing how you fixed it!