Skip to content

PurpleSoftSrl/sumup_flutter_plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

146 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sumup

pub package likes popularity pub points

A Flutter plugin for the SumUp SDK. Supports card reader and Tap-to-Pay payments on Android and iOS.

Partner Links

Support this project by purchasing SumUp terminals through our affiliate links for your country:

Prerequisites

  1. Registered for a merchant account via SumUp's country websites (or received a test account).
  2. Received a SumUp card terminal: Solo, Air, Air Lite, PIN+ terminal, Chip & Signature reader, or SumUp Air Register.
  3. Requested an Affiliate (Access) Key and registered your application ID via the SumUp Dashboard.
  4. iOS deployment target 16.0+ (16.4+ for Tap-to-Pay).
  5. Android minSdkVersion 26+ (30+ for Tap-to-Pay).

Installing

Add sumup to your pubspec.yaml:

dependencies:
  sumup:

Import sumup:

import 'package:sumup/sumup.dart';

Getting Started

// 1. Initialise the SDK with your Affiliate Key
await Sumup.init(affiliateKey);

// 2. Log in — either interactively or with an OAuth token
await Sumup.login();
// or
await Sumup.loginWithToken(token);

// 3. (Optional) Ask the user to pick / configure a card reader
await Sumup.openSettings();

// 4. Optionally warm up the reader before checkout
await Sumup.prepareForCheckout();

// 5. Run a checkout
var payment = SumupPayment(
    title: 'Coffee',
    total: 3.50,
    currency: 'EUR',
    foreignTransactionId: '', // leave empty to auto-generate a unique ID
    saleItemsCount: 1,
    skipSuccessScreen: false,
    tip: 0.0,
);

var checkout = await Sumup.checkout(SumupPaymentRequest(payment));
// checkout.success          — bool
// checkout.transactionCode  — String
// checkout.amount           — double (not available on Android Tap-to-Pay)
// checkout.currency         — String (not available on Android Tap-to-Pay)
// checkout.products         — List<SumupProduct>; iOS and Android card reader only
// checkout.merchantCode     — String; Android Tap-to-Pay only
// checkout.cardScheme       — String; Android Tap-to-Pay only
// checkout.errors           — String; non-null when success is false

Available APIs

Sumup.init(affiliateKey);

Sumup.login();
Sumup.loginWithToken(token);

Sumup.isLoggedIn;
Sumup.merchant;

Sumup.openSettings();
Sumup.prepareForCheckout();
Sumup.isTipOnCardReaderAvailable;
Sumup.isCardTypeRequired;       // iOS only
Sumup.isCheckoutInProgress;     // iOS only

// Card reader checkout
Sumup.checkout(SumupPaymentRequest(payment));

// Tap-to-Pay checkout
Sumup.checkout(SumupPaymentRequest(payment, paymentMethod: PaymentMethod.tapToPay));
Sumup.checkTapToPayAvailability();  // → TapToPayAvailabilityResult
Sumup.presentTapToPayActivation();  // iOS only; no-op on Android

Sumup.logout();

Tap-to-Pay (TTP)

Accept contactless payments directly on compatible smartphones, without any additional hardware.

iOS

Requirements:

  • iPhone XS or later, iOS 16.4+
  • Entitlement com.apple.developer.proximity-reader.payment.acceptance added to your project (requires approval from Apple)
  • See Apple's HIG for Tap to Pay on iPhone

Setup:

  1. Log in with Sumup.login() or Sumup.loginWithToken().
  2. Call Sumup.checkTapToPayAvailability(). If isActivated is false, call Sumup.presentTapToPayActivation() to run the one-time activation flow.
  3. Use PaymentMethod.tapToPay in your request:
    var request = SumupPaymentRequest(payment, paymentMethod: PaymentMethod.tapToPay);
    var checkout = await Sumup.checkout(request);

Android

Requirements:

  • NFC-enabled physical device, Android 11 (API 30)+
  • The TTP SDK is distributed via a private SumUp Maven repository — contact integration@sumup.com to get credentials, then add them to your gradle.properties:
    SUMUP_TTP_MAVEN_USERNAME=...
    SUMUP_TTP_MAVEN_PASSWORD=...
    
  • Add the utopia-sdk dependency to your app's build.gradle (same version used by the plugin) and configure the Maven repository. See example/android/ for a full working setup.
  • TTP requires a release build: the SDK performs device attestation and will refuse to run if USB Debugging or Developer Options are enabled.

Usage:

  1. You must use Sumup.loginWithToken(accessToken) — token login is required for the TTP SDK to authenticate in the background.
  2. Use PaymentMethod.tapToPay in your request:
    var request = SumupPaymentRequest(payment, paymentMethod: PaymentMethod.tapToPay);
    var checkout = await Sumup.checkout(request);

Note: The Android TTP SDK does not return amount or currency in the transaction result. If you need them, query the SumUp Transactions API using checkout.transactionCode or checkout.foreignTransactionId.

About

A Flutter wrapper to use the SumUp SDK. With this plugin, your app can easily connect to a SumUp terminal, login and accept card payments on Android and iOS.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors