woosignal_stripe 1.1.0 copy "woosignal_stripe: ^1.1.0" to clipboard
woosignal_stripe: ^1.1.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;
                  });
                },
              )
            ],
          ),
        ),
      ),
    );
  }
}
4
likes
125
pub points
0%
popularity

Publisher

verified publisherwoosignal.com

Stripe for WooSignal app templates.

Homepage

Documentation

API reference

License

OpenSSL, MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on woosignal_stripe