Open harsh7703 opened 2 weeks ago
@harsh7703 some questions to help us:
@bric-stripe - Hi Ans 1: DeviceType: Stripe S700 Ans 2: I have already clarified in my question does not work state in as again under:- ~ I want to disconnect the reader when the app is supposed to go in the background state or let's say it is about to terminate state. This same code works when the app is foreground but does not work when the app is about to switch its background and terminated state. DisconnectFrom reader does not work not called completionblock. It is supposed to call before when applicationDidEnterBackground State. Terminal.shared.disconnectReader { error in if let error = error { print("Disconnect failed: (error)") } else { print("--------------- Disconnected --------------") } }
@bric-stripe - any update on this it would be fruitful for us to communicate with our clients using this device type?
@bric-stripe -I have updated the SDK to version 4.0.0, but I am still encountering the same issue. Below is the error code that might help identify the root cause. This issue is blocking the release of the new app version, so I would appreciate your assistance in resolving it as soon as possible.
collectPaymentMethod failed: Error Domain=com.stripe-terminal Code=2020 "The command was canceled." UserInfo={NSLocalizedDescription=The command was canceled., com.stripe-terminal:Message=The command was canceled.} errorCode::2020
Hi, I'm investigating the disconnect issue as reported but can you clarify when you're seeing a collectPaymentMethod cancel error? Is it related to the original issue?
Canceled collectPaymentMethod is expected if cancel is requested on the cancelable or the user cancels on the reader. Could you provide a serial number for a reader where you're hitting this? And for the collectPaymentMethod issue can you provide a PaymentIntent ID so I can try to find some additional logging/timing to help me investigate / understand the problem.
I've been unable to reproduce any issues disconnecting when going in to the background. Can you reproduce this with our repo's Example app? I added this simple diff to try to repro:
this is added at the end of AppDelegate.swift
+ NotificationCenter.default.addObserver(self, selector: #selector(appWillEnterBackground), name: UIApplication.willResignActiveNotification, object: nil)
+
return true
}
+ @objc
+ func appWillEnterBackground() {
+
+ disconnectLogger.error("---------------- Disconnecting -----")
+ Terminal.shared.disconnectReader { error in
+ if let error = error {
+ self.disconnectLogger.error("------------------ Disconnect failed: \(error)")
+ } else {
+ self.disconnectLogger.error("--------------- Disconnected Successfully --------------")
+ }
+ }
+ }
when an sPOS reader is connected I've only seen successful disconnects. Only error I've seen is when backgrounding and no reader is connected, but that's expected.