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.
- 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
- 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.
- Open
<YOUR_PROJECT_DIRECTORY>/example/lib/config.dart - On line 17, replace
REPLACE_MEwith the Application ID from Step 1 - On line 18, replace
REPLACE_MEwith the Location ID from Step 1
- Launch iOS emulator, run the flutter example from the
exampleproject folder:cd <YOUR_PROJECT_DIRECTORY>/example flutter run
- Launch Android emulator, run the flutter example project from the
exampleproject folder:cd <YOUR_PROJECT_DIRECTORY>/example flutter run
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 Payments API. Your production app should use a secure backend service to make calls to the Payments 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.
Rate this sample app here!
