Skip to content

Conversation

@joshheald
Copy link
Contributor

Closes: #8172

Description

In sTAP Away, we will add the ability to take card payments using the phone's built in card reader. This PR adds LocalMobileReaderDelegate conformance to our StripeCardReaderService, and discovery method support to our calls into the CardReaderService.

The Tap on Mobile functionality is behind a feature flag, and only available on localDeveloper Xcode builds. Alpha and Release builds do not currently have the correct entitlement to use the built-in reader functionality, and the feature toggle is not available on those builds.

When the feature toggle is enabled, all connection attempts will be made to the built-in reader; when it's disabled, all attempts will be bluetooth. In future, the feature flag will be changed to show the user-facing selection screen.

This PR does not address any UI changes, it only adds the feature flag, and the ability to connect to the built-in reader for payments when the toggle is enabled.

Duplication

There's quite a bit of duplicated code in the StripeCardReaderService. Future work will address this, for now it's important to keep the changes as simple as possible to enable us to work on the user-facing flows sooner.

Testing instructions

Simulated reader

The Stripe simulated reader can be used if this does not build to a device with your installed provisioning profiles. Updates to the profiles have been requested.

To enable the Stripe simulated reader, in Xcode go to Product > Scheme > Edit Scheme and select Run in the sidebar, then Arguments in the tabs. Check the -simulate-stripe-card-reader box.

Testing a

  1. Using a WCPay or Stripe US store
  2. Navigate to Menu > Settings cog > Experimental features
  3. Toggle Tap to Pay on iPhone
  4. Go back to Menu
  5. Tap Payments > Collect payment and go through the Simple Payments flow.
  6. Select Card on the payment methods screen, and connect to the (built-in) reader
  7. Observe that you can take a payment using the built in reader.

Screenshots

With simulated reader

Note that there is a bug in the Stripe simulated reader, which means the Preparing reader screen remains on screen and the other screens do not show the payment details.

tap-on-iphone-simulator.mp4

With physical device

This shows the flow, but the screen recording does not capture the out-of-process Apple Tap on iPhone payment screen, which is shown over the Reader is ready screen you see in this video.

tap-on-iphone-device.mp4

Simulator without turning on the simulated reader

If you try to use the built-in (non-simulated) reader in a simulator, you'll see this error

tap-on-iphone-without-simulated-reader


  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@joshheald joshheald added type: enhancement A request for an enhancement. feature: mobile payments Related to mobile payments / card present payments / Woo Payments. status: feature-flagged Behind a feature flag. Milestone is not strongly held. labels Nov 21, 2022
@joshheald joshheald added this to the 11.4 milestone Nov 21, 2022
@joshheald joshheald force-pushed the issue/8172-add-localMobile-discovery-to-StripeCardReaderService branch from f10c9af to 5233d70 Compare November 21, 2022 18:14
@wpmobilebot
Copy link
Collaborator

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr8174-924d537 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@joshheald joshheald marked this pull request as ready for review November 23, 2022 10:01
@joshheald
Copy link
Contributor Author

@jostnes @lmischner I've added you as optional reviewers. I'll be refactoring quite a bit, so there will be more chances to test this as we go along.

@toupper similarly for context... this is the early stages of getting the structure in place.

@toupper
Copy link
Contributor

toupper commented Nov 24, 2022

The code looks good and it tests well, what a great addition to IPP! 🎉 :shipit:

/// Boolean flag Indicates that clients have provided a CardReaderConfigProvider
var didReceiveAConfigurationProvider = false

/// DiscoveryMethod recieved on starting a payment
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here: received 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will fix that in a future PR :)

@joshheald joshheald merged commit 87020e6 into trunk Nov 24, 2022
@joshheald joshheald deleted the issue/8172-add-localMobile-discovery-to-StripeCardReaderService branch November 24, 2022 15:13
@joshheald joshheald restored the issue/8172-add-localMobile-discovery-to-StripeCardReaderService branch November 24, 2022 16:11
@joshheald joshheald deleted the issue/8172-add-localMobile-discovery-to-StripeCardReaderService branch November 25, 2022 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: mobile payments Related to mobile payments / card present payments / Woo Payments. status: feature-flagged Behind a feature flag. Milestone is not strongly held. type: enhancement A request for an enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Mobile Payments] Add support for localMobile reader discovery and connection to the CardReaderService

4 participants