stripe_payment 0.3.0 copy "stripe_payment: ^0.3.0" to clipboard
stripe_payment: ^0.3.0 copied to clipboard

discontinuedreplaced by: flutter_stripe
outdated

A Flutter plugin to integrate the stripe plugin for iOS and Android. Currently only adding a credit card as payment method is implemented.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:stripe_payment/stripe_payment.dart';
import 'package:stripe_native/stripe_native.dart';

void main() {
  runApp(new MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  var _paymentMethodId = "";
  var _setupPaymentId = "";
  var _confirmPaymentId = "";
  var _confirmNativePay = "";

  final _currentSecret = "...";

  @override
  initState() {
    super.initState();

    StripePayment.setSettings(StripeSettings(publishableKey: "pk_test_"));
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Plugin example app'),
        ),
        body: Column(
          children: <Widget>[
            RaisedButton(
              child: Text("Add Card"),
              onPressed: () {
                StripePayment.addSource().then((String token) {
                  setState(() {
                    _paymentMethodId = token;
                  });
                });
              },
            ),
            Text("Current payment method ID: $_paymentMethodId"),
            Divider(),
            RaisedButton(
              child: Text("Setup payment"),
              onPressed: () {
                StripePayment.setupPayment(_paymentMethodId, _currentSecret).then((String token) {
                  setState(() {
                    _setupPaymentId = token;
                  });
                }).catchError(print);
              },
            ),
            Text("Current setup payment ID: $_setupPaymentId"),
            Divider(),
            RaisedButton(
              child: Text("Confirm payment"),
              onPressed: () {
                StripePayment.confirmPayment(_paymentMethodId, _currentSecret).then((String token) {
                  setState(() {
                    _confirmPaymentId = token;
                  });
                }).catchError(print);
              },
            ),
            Text("Current confirm payment ID: $_confirmPaymentId"),
            Divider(),
            RaisedButton(
              child: Text("Native payment"),
              onPressed: () {
                StripePayment.useNativePay(Order(20, 1, 1, "Stripe Test")).then((String token) {
                  setState(() {
                    _confirmNativePay = token;
                  });
                }).catchError(print);
              },
            ),
            Text("Native payment: $_confirmNativePay"),
          ],
        ),
      ),
    );
  }
}
377
likes
0
pub points
92%
popularity

Publisher

unverified uploader

A Flutter plugin to integrate the stripe plugin for iOS and Android. Currently only adding a credit card as payment method is implemented.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, stripe_native

More

Packages that depend on stripe_payment