flutter_satispay 1.0.1
flutter_satispay: ^1.0.1 copied to clipboard
Flutter package to handle Satispay payments in your mobile apps.
Satispay for Flutter #
Getting started #
Android #
In your AndroidManifest.xml
add these queries:
<queries>
<!-- PRODUCTION ENVIRONMENT -->
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="satispay" />
</intent>
<!-- STAGING ENVIRONMENT -->
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="satispay-stag" />
</intent>
</queries>
iOS #
In your Info.plist
add these LSApplicationQueriesSchemes
entries:
<key>LSApplicationQueriesSchemes</key>
<array>
<!-- PRODUCTION ENVIRONMENT -->
<string>satispay</string>
<!-- STAGING ENVIRONMENT -->
<string>satispay-stag</string>
</array>
Usage #
Initialize the package #
import 'package:flutter_satispay/flutter_satispay.dart';
void main() {
// You must run this only once
Satispay.init(environment: SatispayEnvironment.production);
runApp(MyApp());
}
Check if Satispay is available #
import 'package:flutter_satispay/flutter_satispay.dart';
final bool isAvailable = await Satispay.instance.isAvailable();
Redirect to the Satispay app #
import 'package:flutter_satispay/flutter_satispay.dart';
await Satispay.instance.loadPayment(
token: 'payment_id',
callbackUrl: 'callback_url',
);
Display the payment button #
import 'package:flutter_satispay/flutter_satispay.dart';
SatispayButton(
onPressed: () async {
// TODO: Check if Satispay is available
// TODO: Create payment on your server
// TODO: Redirect the user to the Satispay app
},
);