woosignal_stripe 1.0.0
woosignal_stripe: ^1.0.0 copied to clipboard
Stripe for WooSignal app templates.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:woosignal_stripe/woosignal_stripe.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _paymentMethodId;
@override
void initState() {
super.initState();
FlutterStripePayment.setStripeSettings(
applePayMerchantIdentifier: "{STRIPE_APPLE_PAY_MERCHANTID}",
stripeAccount: "",
liveMode: false);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Stripe App Example'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
_paymentMethodId != null
? Text(
"Payment Method Returned is $_paymentMethodId",
textAlign: TextAlign.center,
)
: Container(),
ElevatedButton(
child: Text("Add Card"),
onPressed: () async {
var paymentResponse =
await FlutterStripePayment.addPaymentMethod();
setState(() {
_paymentMethodId = paymentResponse.paymentMethodId;
});
},
)
],
),
),
),
);
}
}