For a card reader solution, you need to add specific metadata to your POS app. You also need to present a device management UI for pairing your mobile device and the card reader, connecting to the card reader, and viewing card reader details.
Skip these instructions if you are building a Tap to Pay on iPhone solution.
Manage permissions
Your POS app needs to have certain permissions for pairing the mobile device with the card reader.
- In the
Info.plist
of your POS app, add the following keys with an appropriate explanation:-
NSBluetoothAlwaysUsageDescription
: this enables setting up a Bluetooth pairing between the mobile device and the card reader. -
NSCameraUsageDescription
: this enables using the camera of the mobile device to scan the barcode of the card reader. Barcode scanning is one of the ways to select a card reader for pairing.
-
Suppress Apple Pay in your POS app
To accept payments from customers, you may need to suppress Apple Pay on the device that runs your mobile POS app.
It is possible that Apple Pay is enabled on the device that runs your mobile POS app. For example, if staff use their personal iPhone. When a card reader is near, the device running the POS app tries to use its Apple Pay passes to make the payment.
To prevent this from happening, you must suppress Apple Pay in your POS app when your app is in the foreground.
- Contact Apple Pay at apple-pay-inquiries@apple.com and ask for an entitlement to suppress Apple Pay.
- When you receive confirmation that the entitlement was granted, add the entitlement to your provisioning profile on the Apple developer website.
- In Xcode, in the Signing & Capabilities settings, add the
com.apple.developer.passkit.pass-presentation-suppression
key to the .entitlements file for your POS app. -
In your POS app, call requestAutomaticPassPresentationSuppression.
This method automatically switches between disabling Apple Pay when the POS app is in the foreground, and enabling Apple Pay when the POS app is in the background.
Use or create a UI for device management
To use the card reader, store staff needs to pair the mobile device running the Adyen SDK with the card reader. The Adyen SDK provides a built-in UI for that.
Store staff will also want to see an overview of card readers and view details of the card reader they are using. For example, to check the battery charge level. The Adyen SDK also provides a built-in UI for that. Here are some example screens.
To handle the device pairing and viewing of device details, you can:
Use the UI through SwiftUI
To use the device management screens built into the Adyen SDK from within SwiftUI:
-
Add
DeviceManagementView
to thebody
property of your View. One of the ways to do that, is using a .sheet:struct MyView: View { @State private var showingDeviceManagement = false private let paymentService: PaymentService = ... var body: some View { { ... } .sheet(isPresented: $showingDeviceManagement) { NavigationView { DeviceManagementView(paymentService: paymentService) } } } }
Use the UI through UIKit
To use the device management screens built into the Adyen SDK from within UIKit:
- Create an instance of
DeviceManagementViewController
usingDeviceManagementViewController(paymentService:)
, passing your instance ofPaymentService
. -
Present it in your preferred way. For example, with presentViewController:animated:completion::
class MyViewController: UIViewController { let paymentService = PaymentService { ... } func presentDeviceManagement() { let deviceManagementViewController = DeviceManagementViewController(paymentService: paymentService) present(deviceManagementViewController, animated: true) } }
Custom UI
If you intend to build your own UI for device management, use the DeviceManagerDelegate
protocol to obtain all the necessary information.
Refer to the Adyen SDK code for details.