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:
- Getting started guide
- Enable Apple Pay guide
- Enable Google Pay guide
- Technical reference
- Troubleshooting guide
doc- Root directory for all documentation.
example- Root directory of the Flutter sample app (with walkthrough).
- Getting started with the example app
- Override the Native In-App Payments SDK Dependency Version
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
- 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 #
- Quick start flutter app: You can learn how the In-App-Payments Flutter plugin is used by getting started with the example app, a quick-start Flutter app that lets you take a payment after completing 6 set up steps.
- Quick start backend app: The In-App Payments Server Quickstart takes the nonce created by the flutter app and uses it to create a payment credited to your Square account. Use this backend sample to quickly create a complete payment flow.
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.
v1.2.3 September 10, 2019 #
- Bump Square In-App Payments SDK dependency to
- 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 #
paymentTypeparameter to support apple pay pending amount configuration.
v1.1.1 Mar 29, 2019 #
- Bump Square In-App Payments iOS SDK dependency to
- 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
- For SDK 1.1.0 change, please check this Change Log.
v1.0.3 Feb 14, 2019 #
- Compatible to AndroidX migration.
CardEntryDidCancelCallbackis renamed to
- 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.
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 #
- Sign in to your Application Dashboard.
- Click the New Application button on the Applications page
- Give your application a name and then click the Create Application button.
- On the Credentials page of the application control panel, copy the Application ID.
- On the Locations page of the application control panel, copy the Location ID of one of your locations.
Step 2: Configure the sample app #
- On line 27, replace
REPLACE_MEwith the Application ID from Step 1
Step 3: Run the sample app for iOS #
- Launch iOS emulator, run the flutter example from the
cd <YOUR_PROJECT_DIRECTORY>/example flutter run
Step 4: Run the sample app for Android #
- Launch Android emulator, run the flutter example project from the
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:
- Replace the Location ID placeholder in the cURL query string with the location ID that you copied in Step 1.
- Replace the access token placeholder with your access token.
- 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:
$ 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';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
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
Detected platforms: Flutter
References Flutter, and has no conflicting libraries.
|Dart SDK||>=2.0.0-dev.68.0 <3.0.0|