Set up your project
Do these steps once for each app. At the end, your app builds with the MoneiTapToPay package, locally and in CI.
Request the Apple entitlement
Tap to Pay on iPhone needs an entitlement from Apple for your developer team. MONEI does not give this entitlement. Request it from Apple with the Tap to Pay on iPhone entitlement request form. See the Tap to Pay on iPhone developer page for Apple's guidelines.
- Request the development entitlement for your team, for each app that takes payments. You need it before you can test on a device.
- Build and test your payment flow with it.
- Request the publishing entitlement. Apple asks for screenshots or a video of your payment flow.
Apple reviews each request. Plan for this review before your launch date.
App extensions that never take payments (for example a widget extension) do not need the entitlement.
Add the package
The package is public. Swift Package Manager downloads the binaries from the release of each version. You do not need a GitHub account or a GitHub token.
- Xcode
- Package.swift
-
In Xcode, select File > Add Package Dependencies.
-
Enter the package URL:
https://github.com/MONEI/monei-tap-to-pay-ios -
Set the dependency rule to Exact Version and enter
0.7.0. -
Add the
MoneiTapToPayproduct to your app target.
dependencies: [
.package(url: "https://github.com/MONEI/monei-tap-to-pay-ios", exact: "0.7.0")
],
targets: [
.target(name: "YourApp", dependencies: [
.product(name: "MoneiTapToPay", package: "monei-tap-to-pay-ios")
])
]
Use an exact version for 0.x versions, because a 0.x minor version can change the API. From 1.0.0, use from:. See versions and compatibility.
Use 0.1.1 or later. Earlier versions download their binaries through the GitHub API, which needs GitHub authentication.
Configure your app target
Add the entitlement
Add this key to the .entitlements file of your app target:
<key>com.apple.developer.proximity-reader.payment.acceptance</key>
<true/>
Add the location usage description
The SDK needs the location of the device to accept payments. Add NSLocationWhenInUseUsageDescription to Info.plist:
<key>NSLocationWhenInUseUsageDescription</key>
<string>We use your location to accept card payments with Tap to Pay on iPhone.</string>
Without this key, iOS does not ask the user for permission. From SDK 0.5.0, the calls throw setupIncomplete at once. Earlier versions throw locationDenied.
Add your Apple Team ID
The payment engine in the SDK uses your Apple Team ID to attest your app. Add the Team ID to Info.plist with the key PRODUCT_TEAM_IDENTIFIER:
-
In the build settings of your app target, add a user-defined setting
PRODUCT_TEAM_IDENTIFIER. Set it to your Apple Team ID. The Team ID has 10 characters. It is in your Apple Developer account, under Membership details. Use the team that signs the app. -
Add this entry to
Info.plist:Info.plist<key>PRODUCT_TEAM_IDENTIFIER</key><string>$(PRODUCT_TEAM_IDENTIFIER)</string>
If Xcode generates the Info.plist of your target (there is no Info.plist file), add an Info.plist file with only this entry. Then set the build setting Info.plist File (INFOPLIST_FILE) to its path. Xcode merges the file with the generated keys. The INFOPLIST_KEY_ build settings cannot add this key.
The value must be in the Info.plist of the built app. Without this key, the reader setup fails.
Check the setup
From SDK 0.5.0, the SDK checks the entitlement, the location usage description and PRODUCT_TEAM_IDENTIFIER on a supported iPhone before it starts the reader. If an item is missing or wrong, prepare, acceptPayment, isAccountLinked and linkAccount throw setupIncomplete(fix:). fix tells you what to change, for example the Team ID that signs the app. Print the error during development to read it. The app cannot repair this at run time: correct the app and build it again.
Use the name "Tap to Pay on iPhone"
Use the name "Tap to Pay on iPhone" in your UI, as the Apple Human Interface Guidelines require.
Declare App Store privacy details
In App Store Connect, declare these data types. Declare all of them for app functionality, and not for tracking:
| Data type | Linked to the user |
|---|---|
| Coarse location | No |
| Precise location | No |
| Device ID | Yes |
Set up CI
Standard Swift Package Manager resolution works in CI. You do not need a secret.
Common questions
Package resolution fails. What do I check?
Check these items:
- The package URL is
https://github.com/MONEI/monei-tap-to-pay-ios. - The version is
0.1.1or later. Earlier versions need GitHub authentication.
Can MONEI request the Apple entitlement for me?
No. Apple gives the entitlement to your developer team, and your app uses it. Request it from Apple.