0 purchases
zettle
Zettle POS SDK for Flutter #
A Flutter wrapper to use the Zettle POS SDK.
With this plugin, your app can easily request payment via the Zettle readers on Android and iOS.
Note ⚠️ #
You Must Call the init function Only once a time in your app
Zettle.init(iosClientId, androidClientId, redirectUrl);
copied to clipboard
Prerequisites #
Registered for a Zettle developer account via Zettle.
Deployment Target iOS 12.0 or higher.
Android minSdkVersion 21 or higher.
Android #
Add to build.gradle (as per https://github.com/iZettle/sdk-android)
Add your personal access token to build.gradle (as per https://github.com/iZettle/sdk-android), this is used to access the Zettle maven repo on github
android {
packagingOptions {
exclude 'META-INF/*.kotlin_module'
}
}
allprojects {
repositories {
google()
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/iZettle/sdk-android")
credentials(HttpHeaderCredentials) {
name "Authorization"
value "Bearer <YOUR TOKEN HERE>"
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}
copied to clipboard
Add to manifest (as per https://github.com/iZettle/sdk-android)
<activity
android:name="com.izettle.android.auth.OAuthActivity"
android:launchMode="singleTask"
android:taskAffinity="@string/oauth_activity_task_affinity"
android:exported="true">
<intent-filter>
<data
android:host="[redirect url host]"
android:scheme="[redirect url scheme]" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
copied to clipboard
iOS #
Add reader protocol to info.plist (https://github.com/iZettle/sdk-ios)
<key>UISupportedExternalAccessoryProtocols</key>
<array>
<string>com.izettle.cardreader-one</string>
</array>
copied to clipboard
Add elements to info.plist (https://github.com/iZettle/sdk-ios)
<key>UIBackgroundModes</key>
<array>
<string>bluetooth-central</string>
<string>external-accessory</string>
</array>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Our app uses bluetooth to find, connect and transfer data with Zettle card reader devices.</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Our app uses bluetooth to find, connect and transfer data with Zettle card reader devices.</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>"The scheme of your OAuth Redirect URI *"</string>
</array>
</dict>
</array>
<key>NSLocationWhenInUseUsageDescription</key>
<string>You need to allow this to be able to accept card payments</string>
copied to clipboard
Installing #
Add zettle to your pubspec.yaml:
dependencies:
zettle:
copied to clipboard
Import zettle:
import 'package:zettle/zettle.dart';
copied to clipboard
Getting Started #
Init Zettle SDK:
Zettle.init(iosClientId, androidClientId, redirectUrl);
copied to clipboard
Complete a transaction:
var request = ZettlePaymentRequest(
amount: 100,
reference: reference,
enableLogin: true,
enableTipping: false,
enableInstalments: false);
Zettle.requestPayment(request);
copied to clipboard
Available APIs #
Zettle.init(iosClientId, androidClientId, redirectUrl);
bool Zettle.isInitialized;
Zettle.requestPayment(request);
Zettle.requestRefund(request);
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.