Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

 

History

History

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/config.dart
  2. On line 17, replace REPLACE_ME with the Application ID from Step 1
  3. On line 18, replace REPLACE_ME with the Location 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 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.

Feedback

Rate this sample app here!