stripe / stripe-terminal-ios

Stripe Terminal iOS SDK
https://stripe.com/docs/terminal/sdk/ios
Other
105 stars 65 forks source link

supportsReaders TapToPay unsupported reason #336

Open TomaszLizer opened 6 days ago

TomaszLizer commented 6 days ago

Summary

When requesting for Apple Tap to Pay production entitlemnts we were tasked with explicit handling of PaymentCardReaderError.osVersionNotSupported. I was studying Stripe docs for information about this topic yet did not found any mention of PaymentCardReaderError or similar errors. There are two things I have found in the docs:

Seems like all methods always return same error in case device is unsupported (unsupportedMobileDeviceConfiguration) and tells that os version is an issue.

Tested on two devices, both with missing support, one due to os, another due to hardware and os:

Error Domain=com.stripe-terminal Code=2910 "Unsupported mobile device configuration. Ensure the device is running a supported version of iOS and it has the hardware capability you are attempting to use." UserInfo={com.stripe-terminal:ReaderMessage=OS version not supported, NSLocalizedDescription=Unsupported mobile device configuration. Ensure the device is running a supported version of iOS and it has the hardware capability you are attempting to use., com.stripe-terminal:Message=Unsupported mobile device configuration. Ensure the device is running a supported version of iOS and it has the hardware capability you are attempting to use.}

This might be confusing since we are not distinguishing between devices that needs OS update and those that cannot gain access to TapToPay.

At the same time method from ProximityReader API distinguishes those two devices. Running PaymentCardReader.isSupported yields different results:

For the time being will be handling this issue outside of Stripe Terminal SDK, yet this seems to be internal issue of SDK itself.

Code to reproduce

try terminal.supportsReaders(
    of: .tapToPay,
    discoveryMethod: .tapToPay,
    simulated: false
).get()

iOS version

iPhone XR iOS 16.1 iPhone SE (1st gen) iOs 15.8.3

Installation method

Swift package through mirror: https://github.com/TomaszLizer/stripe-terminal-ios-spm

SDK version

4.1.0

Other information