iOS SDK installation and configuration
The Zettle Payment SDK for iOS lets you accept card payments from any iOS app, using a Zettle card reader. The following describes how to install, configure and initialize the SDK.
- Xcode 11+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YESflag 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.
Install the 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
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:
You can drag these into a folder named "Frameworks" for example in your Xcode project.
iZettleSDK folder in iOS-SDK GitHub repository.
Ensure that you check the
Copy items if needed option as shown below.
Configure the SDK
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. Set up external accessory communication background mode
1.1 Xcode modifications
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
NSBluetoothPeripheralUsageDescriptionkeys 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
Note: If you are using Zettle Reader 1 then this step is needed, otherwise you can skip this.
Info.plist, add/modify the property
Supported external accessory protocols and add
com.izettle.cardreader-one as shown below:
Important: The Zettle Bluetooth card reader 1 is 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.
2. Set up CLLocationManager
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
Add the key in your
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.
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.