iOS SDK installation and configuration
The Zettle Payments SDK for iOS lets you take card payments from any iOS app, using a Zettle card reader. The following describes how to install, configure and initialize the SDK.
- Xcode 14.1+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
flag is required if your project doesn't include Swift- iOS 12 and higher
- Client ID from the Zettle Developer Portal, see Get started.
Note: Support for iOS 10 and 11 was dropped with version 3.4.0 of the iOS SDK.
You can install Zettle SDK using CocoaPods, or manually as described in the following.
CocoaPods is an easy way to install Zettle SDK.
Add following pod to your Podfile
:
1platform :ios, '<iOS platform version, 12.0 or higher>'2target 'Your App' do3pod 'iZettleSDK'4end
Drag the binary frameworks from the iZettleSDK
folder into your Xcode project:
iZettleSDK.xcframework
iZettlePayments.xcframework
You can drag these into a folder named "Frameworks" for example in your Xcode project.
See the iZettleSDK
folder in iOS SDK GitHub repository.
Ensure that you check the Copy items if needed
option as shown below.
To be able to use the SDK you must first add configurations as described in the following.
Note: An exception will be thrown if these configurations are not done.
1.1 Xcode modifications
Xcode 14.1
Select the following background modes to enable support for external accessory communication. You can find them under Signing & Capabilities
in your target.
External accessory communication
Uses Bluetooth LE accessory
Earlier Xcode versions
In your Xcode project, select the Capabilities tab. Go to the Background modes section to enable external accessory communication support.
1.2 Info.plist modifications
Edit your Info.plist file to have the following information set:
1<key>NSBluetoothAlwaysUsageDescription</key>2<string>Our app uses bluetooth to find, connect and transfer data with Zettle card reader devices.</string>34<key>NSBluetoothPeripheralUsageDescription</key>5<string>Our app uses bluetooth to find, connect and transfer data with Zettle card reader devices.</string>67<key>CFBundleURLTypes</key>8<array>9<dict>10<key>CFBundleTypeRole</key>11<string>Editor</string>12<key>CFBundleURLSchemes</key>13<array>14<string>"The scheme of your OAuth Redirect URI *"</string> // Example: if your oAuth Redirect URI is "awesomeapp://zettlelogin", then the scheme of your OAuth Redirect URI is "awesomeapp"15</array>16</dict>17</array>
Note: Zettle will ask the user for permission to allow your app access to Bluetooth capabilities. Doing so, the texts for
NSLocationWhenInUseUsageDescription
andNSBluetoothPeripheralUsageDescription
keys are displayed. You may want to update these texts to your requirements.
If you don't remember the scheme of your OAuth Redirect URI, you can verify it on the Developer Portal.
1.3 Set up external accessory protocols
In your Info.plist
, add/modify the property Supported external accessory protocols
and add com.izettle.cardreader-one
as shown below:
1<key>UISupportedExternalAccessoryProtocols</key>2<array>3<string>com.izettle.cardreader-one</string>4</array>
Important: The Zettle Bluetooth card readers are a part of the Apple MFi program. In order to release apps supporting accessories that are part of the MFi Program, you have to apply at Apple. Please contact our developer support and we will help you with this process.
The merchant must grant your app this permission. If not done, Zettle will prompt the user for permission during the first payment and execute the CLLocationManagers
method requestWhenInUseAuthorization
.
Add the key in your Info.plist
:
1<key>NSLocationWhenInUseUsageDescription</key>2<string>You need to allow this to be able to accept card payments</string>
Zettle won't accept payments without these texts implemented.
Eventually, your Info.plist
file should look like this in your Xcode editor UI:
Important: Whenever you work with SDK code, ensure that you always import the SDK framework in your code files. If you do not import the framework, it will not be accessible in your code.
Objective-C:
1@import iZettleSDK;
Swift:
1import iZettleSDK