square_in_app_payments 1.2.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 93

Flutter plugin for In-App Payments SDK #

The Flutter plugin for Square In-App Payments SDK is a wrapper for the native Android and iOS SDKs and supports the following native In-App Payments SDK versions:

  • iOS: 1.2.0
  • Android: 1.2.0

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 Target SDK version: API 27 (Oreo, 8.1).
  • Android SDK build tools: 26.0.3
  • Android Gradle Plugin: 3.0.0 or greater.
  • Support library: 27.1.1
  • Google Play Services: 16.0.1
  • Google APIs Intel x86 Atom_64 System Image

iOS #

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

In-App Payments SDK requirements and limitations #

  • In-App Payments SDK cannot issue refunds. Refunds can be issued programmatically using the Transactions API or manually in the Square Dashboard.

Sample applications #

License #

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.

Changelog #

v1.2.3 September 10, 2019 #

  • Bump Square In-App Payments SDK dependency to 1.2.0.
  • Add support for Sandbox v2.

v1.2.2 July 23, 2019 #

  • Fixed an exception introduced in a recent Flutter update.

v1.2.1 June 5, 2019 #

  • Added paymentType parameter to support apple pay pending amount configuration.

v1.1.1 Mar 29, 2019 #

  • Bump Square In-App Payments iOS SDK dependency to 1.1.1.
  • Enable iOS and android In-App Payments SDK version override.
  • Fix #35 - support AndroidX release build

v1.1.0 Feb 27, 2019 #

  • Support Square In-App Payments iOS and Android SDK 1.1.0.
  • For SDK 1.1.0 change, please check this Change Log.

v1.0.3 Feb 14, 2019 #

  • Compatible to AndroidX migration.
  • CardEntryDidCancelCallback is renamed to CardEntryCancelCallback.
  • Some updates to improve error messages.
  • Minor code style improvements.

v1.0.2 Jan 22, 2019 #

  • Fix Apple Pay issue #18.
  • Refine Apple Pay quick start example.

v1.0.1 Jan 9, 2019 #

  • Initial release.

example/README.md

In-App Payments Quick Start Sample Flutter Application #

Assumptions and prerequisites #

This quick start guide makes the following assumptions:

  • You have read the In-App Payments SDK Overview. This quick start focuses on getting the sample app installed and running to demonstrate how the Flutter plugin works.
  • You have a Square account enabled for payment processing. If you have not enabled payment processing on your account (or you are not sure), visit squareup.com/activate.
  • You are familiar with basic Flutter development.

Before you run the In-App Payments Quick Start #

  • Follow the Install instructions in the Flutter Getting Started guide to setup your Flutter development environment.
  • Confirm your environment meets the In-App Payments SDK build requirements listed in the root README for this repo.
  • Clone this repo (if you have not already): git clone https://github.com/square/in-app-payments-flutter-plugin.git

Step 1: Get a Square Application ID and Location ID #

  1. Sign in to your Application Dashboard.
  2. Click the New Application button on the Applications page
  3. Give your application a name and then click the Create Application button.
  4. On the Credentials page of the application control panel, copy the Application ID.
  5. On the Locations page of the application control panel, copy the Location ID of one of your locations.

Step 2: Configure the sample app #

  1. Open <YOUR_PROJECT_DIRECTORY>/example/lib/main.dart
  2. On line 27, replace REPLACE_ME with the Application ID from Step 1

Step 3: Run the sample app for iOS #

  1. Launch iOS emulator, run the flutter example from the example project folder:
     cd <YOUR_PROJECT_DIRECTORY>/example
     flutter run
    

Step 4: Run the sample app for Android #

  1. Launch Android emulator, run the flutter example project from the example project folder:
     cd <YOUR_PROJECT_DIRECTORY>/example
     flutter run
    

Step 5: Use the nonce in a cURL payment command #

Take a payment with the card nonce by executing the cURL command written into the debug output. of your development environment.

Update the cURL command by completing the following steps:

  1. Replace the Location ID placeholder in the cURL query string with the location ID that you copied in Step 1.
  2. Replace the access token placeholder with your access token.
  3. Run the cURL command to take a payment in your Square account.

Note: We provide a cURL command in the debug output that you can use to easily test the payment with our Transactions API. Your production app should use a secure backend service to make calls to the Transactions API and should never expose your access token in the client.

Square provides a backend service in our sample app to get your started. follow the steps in the backend service setup guide to configure the backend sample.

For help getting started with Flutter, view documentation online.

Use this package as a library

1. Depend on it

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


dependencies:
  square_in_app_payments: ^1.2.3

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_in_app_payments/google_pay_constants.dart';
import 'package:square_in_app_payments/in_app_payments.dart';
import 'package:square_in_app_payments/models.dart';
import 'package:square_in_app_payments/models.g.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
86
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
93
Learn more about scoring.

We analyzed this package on Oct 18, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
built_collection ^4.0.0 4.2.2
built_value ^6.1.5 6.7.1
flutter 0.0.0
meta ^1.1.6 1.1.7
Transitive dependencies
collection 1.14.11 1.14.12
fixnum 0.10.9
matcher 0.12.5
path 1.6.4
quiver 2.0.5
sky_engine 0.0.99
stack_trace 1.9.3
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
build ^1.1.0
build_runner ^1.2.3
built_value_generator ^6.3.0
source_gen ^0.9.4+1