This quick start guide makes the following assumptions:
- You have read the Reader 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.
- Follow the Install instructions in the Flutter Getting Started guide to setup your Flutter development environment.
- Confirm your environment meets the Reader 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/reader-sdk-flutter-plugin.git
- Open the Square Application Dashboard.
- Create a new Square application.
- Click on the new application to bring up the Square application settings pages.
- Open the Reader SDK page and click "Request Credentials" to generate your Reader SDK repository password.
- You will need the Application ID and Repository password from the Reader SDK settings page to configure Reader SDK in the next steps.
- Open
<YOUR_PROJECT_DIRECTORY>/example/android/gradle.properties. - Set the Reader SDK variables with your Reader SDK credentials:
# Set the variables below with your Reader SDK credentials SQUARE_READER_SDK_APPLICATION_ID=YOUR_SQUARE_READER_APP_ID SQUARE_READER_SDK_REPOSITORY_PASSWORD=YOUR_SQUARE_READER_REPOSITORY_PASSWORD
- Confirm you have installed the required Android SDK elements. If you are unsure, the Reader SDK build requirements are listed in the root README for this repo.
- Configure an Android emulator that runs Android API 27 (Oreo, 8.1), and launch the emulator or connect your dev machine to an Android device running Android API 27 with development mode enabled.
- Run the sample app from the
examplefolder:cd <YOUR_PROJECT_DIRECTORY>/example flutter run
- Go to the Reader SDK settings page in your Square Application Dashboard and generate a new mobile authorization code by clicking "Generate Mobile Auth Code".
- Copy the mobile authorization code string from the Square application settings page.
- Tap "Enter Code Manually" in the sample app and paste the mobile authorization code into the field provided.
You can view the transaction details in Square Dashboard.
-
Change to the
iosfolder underexample. -
Install ReaderSDK, replacing
YOUR_SQUARE_READER_APP_IDandYOUR_SQUARE_READER_REPOSITORY_PASSWORDwith your Reader SDK credentials.The command below will download the framework into the current directory. The framework must be in either the
iosdirectory or theios/Frameworksdirectory of your Flutter project.ruby <(curl https://connect.squareup.com/readersdk-installer) install \ --app-id YOUR_SQUARE_READER_APP_ID \ --repo-password YOUR_SQUARE_READER_REPOSITORY_PASSWORD -
Launch the iOS emulator or connect to an iOS device with development mode enabled.
-
Run the sample app from the
examplefolder:cd <YOUR_PROJECT_DIRECTORY>/example flutter run
-
Go to the Reader SDK settings page in your Square Application Dashboard and generate a new mobile authorization code by clicking "Generate Mobile Auth Code".
-
Copy the mobile authorization code string from the Square application settings page.
-
Tap "Enter Code Manually" in the sample app and paste the mobile authorization code into the field provided.
You can view the transaction details in Square Dashboard.
Rate this sample app here!
