A Flutter wrapper to use the Square POS SDK.
With this plugin, your app can easily request payment via the Square POS app on Android and iOS.
- Registered for a Square developer account via Square.
- Deployment Target iOS 12.0 or higher.
- Android minSdkVersion 21 or higher.
- Add the request URL scheme as a LSApplicationQueriesSchemes key into your Info.plist file to indicate that your application uses the square-commerce-v1 URL scheme to open Square Point of Sale.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>square-commerce-v1</string>
</array>
- Add your custom response URL scheme as CFBundleURLTypes keys in your Info.plist file.
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>YOUR_BUNDLE_URL_NAME</string>
<key>CFBundleURLSchemes</key>
<array>
<string>myapp-url-scheme</string>
</array>
</dict>
</array>
Add square_pos to your pubspec.yaml:
dependencies:
square_pos:
Import square_pos:
import 'package:square_pos/square_pos.dart';
Init SquarePos SDK:
SquarePos.init(applicationID, callbackScheme);
Check if Square POS is installed on device:
SquarePos.canRequest;
Complete a transaction:
var request = SquarePosPaymentRequest(
money: SquarePosMoney(amountCents: 100, currencyCode: "USD"),
supportedTenderTypes: [
SquarePosTenderType.card,
SquarePosTenderType.cardOnFile,
SquarePosTenderType.squareGiftCard
]);
SquarePos.requestPayment(request);
SquarePos.init(applicationID, callbackScheme);
SquarePos.canRequest;
SquarePos.requestPayment(request);