sumup-capacitor-plugin
v3.1.0
Published
SumUp SDK Capacitor Plugin
Readme
sumup-capacitor-plugin
Capacitor Plugin for the SumUp SDK – Native card terminal integration for Android and iOS.
✅ Prerequisites (iOS&Android)
- A SumUp Merchant Account
- A supported SumUp card terminal (Solo, Solo Lite, Air, 3G, PIN+)
- An Affiliate (Access) Key from the SumUp Developer Dashboard
- Add the Application ID to the Affiliate Key (ex. com.example.app)
📦 Install
npm install sumup-capacitor-plugin
npx cap sync📱 Android Setup
✅ Requirements
| Requirement | Version | | --------------------- | --------------- | | Android SDK | minSdkVersion 26 | | Target SDK | 31 or higher | | Android Gradle Plugin | 7.3.0 or later | | Kotlin | 1.7.21 or later | | Java | 11 or later |
🔧 Configuration
Add SumUp Maven repository In
android/build.gradle:allprojects { repositories { maven { url '[https://maven.sumup.com/releases](https://maven.sumup.com/releases)' } // ... other repositories ... } }Add SumUp SDK dependency In
android/app/build.gradle:dependencies { implementation 'com.sumup:merchant-sdk:5.0.3' // ... other dependencies ... }Set minimum SDK version In
gradle.propertiesorvariables.gradle:minSdkVersion = 26
🍏 iOS Setup
✅ Requirements
| Requirement | Version | | ----------- | ---------------- | | Xcode | 14.x or later | | iOS SDK | 13.0 or later | | Swift | 5.0 or later | | CocoaPods | 1.11.x or later |
🔧 Configuration
Add SumUp SDK Dependency The Capacitor plugin should already contain a
.podspecfile. Ensure it includes theSumUpSDKdependency. InYourPluginName.podspec:s.dependency 'SumUpSDK'Install Pods After verifying the dependency, run the sync command from your project's root directory. This will install the SDK into your iOS project.
npx cap sync iosConfigure Info.plist The SumUp SDK requires several keys in your app's
Info.plistfile to function correctly. Openios/App/App/Info.plistand add the following keys inside the main<dict>tag:<key>LSApplicationQueriesSchemes</key> <array> <string>sumup</string> </array> <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>com.example.app.sumup</string> </array> </dict> </array> <key>NSBluetoothAlwaysUsageDescription</key> <string>This app needs Bluetooth access to connect to SumUp card readers.</string>LSApplicationQueriesSchemesallows your app to check if the SumUp app is installed.CFBundleURLTypesregisters a unique URL scheme so that the SumUp app (or a web flow) can redirect back to your application after an operation. You must replacecom.example.app.sumupwith a unique identifier for your app.NSBluetoothAlwaysUsageDescriptionis the message shown to the user when the app requests Bluetooth permission to connect to a card reader.
🧪 Sample App
https://github.com/simonezucaro/sumup-capacitor-plugin/tree/main/demo-sumup-app
📚 API Reference
setup(...)login()isLoggedIn()getCurrentMerchant()logout()prepareForCheckout()openCardReaderPage()checkout(...)
setup(...)
setup(options: { affiliateKey: string; }) => Promise<{ message: string; }>Initializes the SumUp SDK. Must be called once before any other operations.
| Param | Type |
| ------------- | -------------------------------------- |
| options | { affiliateKey: string; } |
Returns: Promise<{ message: string; }>
login()
login() => Promise<{ resultCode: number; message: string; }>Starts the login flow.
Returns: Promise<{ resultCode: number; message: string; }>
isLoggedIn()
isLoggedIn() => Promise<{ isLoggedIn: boolean; }>Checks if the user is currently logged in.
Returns: Promise<{ isLoggedIn: boolean; }>
getCurrentMerchant()
getCurrentMerchant() => Promise<{ merchantCode: string; currency: string; }>Retrieves the details of the current merchant.
Returns: Promise<{ merchantCode: string; currency: string; }>
logout()
logout() => Promise<void>Performs a logout.
prepareForCheckout()
prepareForCheckout() => Promise<void>Prepares the terminal for checkout (warm-up).
openCardReaderPage()
openCardReaderPage() => Promise<{ resultCode: number; message: string; }>Opens the card reader settings screen.
Returns: Promise<{ resultCode: number; message: string; }>
checkout(...)
checkout(options: { amount: number; currency?: string; title?: string; foreignTransactionId?: string; }) => Promise<{ resultCode: number; message: string; transactionCode?: string; }>Performs a payment.
| Param | Type |
| ------------- | -------------------------------------------------------------------------------------------------- |
| options | { amount: number; currency?: string; title?: string; foreignTransactionId?: string; } |
Returns: Promise<{ resultCode: number; message: string; transactionCode?: string; }>
