square_reader_sdk 2.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 75

Flutter plugin for Reader SDK #

Build Status Pub

Square Reader SDK lets developers embed the Square checkout flow and accept in-person payments in custom apps using Square Readers. The SDK supports authorization, transaction processing, and Reader management.

Use Square's official Flutter plugin for Reader SDK to build in-person payment solutions on Android and iOS.

How to use #

The Flutter plugin for Reader SDK acts as a wrapper on the native SDKs and is currently compatible with the following native Reader SDK versions:

  • iOS: 1.3.3 and above
  • Android: 1.3.3 and above

Try the sample app to see the plugin in action or follow the instructions in the getting started guide to build a custom solution from scratch.

Additional documentation #

In addition to this README, the following is available in the flutter plugin GitHub repo:

Build requirements #

Android #

  • minSdkVersion is API 21 (Lollipop 5.0) or higher.
  • Android SDK platform: API 28.
  • Android SDK build tools: 28.0.2
  • Android Gradle Plugin: 3.0.0 or greater.
  • Support library: 26.0.2
  • Google Play Services: 16.0.1
  • Google APIs Intel x86 Atom_64 System Image

iOS #

  • Xcode version: 10.2 or greater.
  • iOS Base SDK: 11.1 or greater.
  • Deployment target: iOS 11.0 or greater.

Reader SDK requirements and limitations #

  • Reader SDK is only available for accounts based in the United States. Authorization requests for accounts based outside the United States return an error.
  • Reader SDK may not be used for unattended terminals. Using Reader SDK to implement payment solutions in unattended terminals or kiosks (for example, vending machines) is strictly prohibited.
  • Reader SDK requires an authorization token from the Mobile Authorization API to connect Square Readers and accept payments.
  • Reader SDK only supports on-screen tipping. Digital receipts and tips can be configured in Reader SDK. Tipping on printed receipts is not supported at this time.
  • Reader SDK cannot issue refunds. Refunds can be issued programmatically using the Transactions API or manually in the Square Dashboard.
  • Reader SDK is not supported in the Square sandbox. See Testing Mobile Apps for testing recommendations.
  • Your version of Reader SDK must adhere to the Square SDK update policy. To limit risk to developers and their users, Square enforces an update policy for Reader SDK that requires developers to keep their version of Reader SDK current.

License #

Copyright 2019 Square Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Changelog #

v2.1.0 Oct 22, 2019 #

  • Update Square Reader SDK minimum supported version to 1.3.3 in order to support iOS 13
  • Now requires Xcode 10.2+

v2.0.3 Sep 16, 2019 #

  • add support for isAuthorizationInProgress

v2.0.2 Aug 25, 2019 #

  • Update Square Reader SDK minimum supported version to 1.3.1
  • Add delay capture support

v2.0.1 Mar 29, 2019 #

  • Fix the bug on Android default Reader SDK version setting

v2.0.0 Mar 29, 2019 #

  • Support AndroidX.
  • Upgrade to Square Reader SDK 1.2.1 (Android Only)

v1.1.1 Mar 13, 2019 #

  • add store customer card suport.

v1.1.0 Mar 5, 2019 #

  • remove alwaysRequireSignature and add collectSignature to checkout configuration.
  • bump the minimum dependency to Reader SDK 1.1.1(iOS)/1.1.3(Android).
  • this change does NOT include all new features introduced in Reader SDK 1.1.* such as Store customer card, see reader SDK Change Log for details.

v1.0.3 Dec 5, 2018 #

  • Documentation update.

v1.0.2 Dec 4, 2018 #

  • Initial release.

example/lib/main.dart

/*
Copyright 2018 Square Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import 'package:flutter/material.dart';
import 'screens/authorize_screen.dart';
import 'screens/checkout_screen.dart';
import 'screens/manual_authorize_screen.dart';
import 'screens/splash_screen.dart';

void main() => runApp(ExampleApp());

/// The root of this example app
class ExampleApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) => MaterialApp(
        theme: _buildTheme(),
        initialRoute: '/',
        routes: {
          '/': (context) => SplashScreen(),
          '/authorize': (context) => AuthorizeScreen(),
          '/authorize/manual': (context) => ManualAuthorizeScreen(),
          '/checkout': (context) => CheckoutScreen(),
        },
      );
}

// override default theme
ThemeData _buildTheme() {
  var base = ThemeData.light();
  return base.copyWith(
    backgroundColor: Color.fromRGBO(64, 135, 225, 1.0),
    canvasColor: Colors.transparent,
    scaffoldBackgroundColor: Color.fromRGBO(64, 135, 225, 1.0),
    buttonTheme: ButtonThemeData(
      height: 64.0,
    ),
    hintColor: Colors.transparent,
    inputDecorationTheme: InputDecorationTheme(
      labelStyle: TextStyle(
        color: Colors.white,
      ),
    ),
    textTheme: TextTheme(
        button: TextStyle(
          fontSize: 20.0,
          fontWeight: FontWeight.w600,
          color: Colors.white,
        ),
        body1: TextStyle(
          fontSize: 24.0,
          fontWeight: FontWeight.w600,
          color: Colors.white,
        )),
  );
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  square_reader_sdk: ^2.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:square_reader_sdk/models.dart';
import 'package:square_reader_sdk/models.g.dart';
import 'package:square_reader_sdk/reader_sdk.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
54
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

We analyzed this package on Mar 31, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Format lib/reader_sdk.dart.

Run flutter format to format lib/reader_sdk.dart.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (built_value).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
built_collection ^4.0.0 4.3.2
built_value ^6.1.4 6.8.2 7.0.9
flutter 0.0.0
Transitive dependencies
analyzer 0.38.5 0.39.4
analyzer_plugin 0.2.1
args 1.6.0
async 2.4.1
build_config 0.4.2
charcode 1.1.3
checked_yaml 1.0.2
collection 1.14.11 1.14.12
convert 2.1.1
crypto 2.1.4
csslib 0.16.1
dart_style 1.3.3
fixnum 0.10.11
front_end 0.1.27 0.1.29
glob 1.2.0
html 0.14.0+3
js 0.6.1+1
json_annotation 3.0.1
kernel 0.3.27 0.3.29
logging 0.11.4
matcher 0.12.6
meta 1.1.8
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.9.3
path 1.6.4
pedantic 1.9.0
pub_semver 1.4.4
pubspec_parse 0.1.5
quiver 2.1.3
sky_engine 0.0.99
source_span 1.7.0
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
watcher 0.9.7+14
yaml 2.2.0
Dev dependencies
build ^1.1.0 1.2.2
build_runner ^1.2.3
built_value_generator ^6.3.0 6.8.2 7.0.9
source_gen ^0.9.4+1 0.9.4+6 0.9.5