skipcash 0.0.8 copy "skipcash: ^0.0.8" to clipboard
skipcash: ^0.0.8 copied to clipboard

SkipCash SDK.

example/lib/main.dart

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:skipcash/skipcash.dart';
import 'package:skipcash/skipcash_apple_pay_button.dart';

void main() {
  runApp(const MaterialApp(home: MyApp()));
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _skipcash = Skipcash(
    merchantIdentifier: '',
    createPaymentLinkEndPoint: '',
    authorizationHeader: '',
  );

  StreamSubscription<dynamic>? _sheetResultSubscription;

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

    _sheetResultSubscription = _skipcash.paymentSheetResultStream.listen((result) {
      debugPrint('Payment sheet result: $result');
      showDialog(
        context: context,
        builder: (ctx) => AlertDialog(
          title: const Text('Payment Sheet Result'),
          content: Text('$result'),
          actions: [
            TextButton(
              onPressed: () => Navigator.of(ctx).pop(),
              child: const Text('OK'),
            ),
          ],
        ),
      );
    });
  }

  @override
  void dispose() {
    _sheetResultSubscription?.cancel();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('SkipCash SDK Example')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            ElevatedButton.icon(
              onPressed: () {
                _skipcash.showPaymentSheet(
                  sessionId: 'd6bebb80-47c7-4b34-8702-67770dbbdb3c',
                  creditCard: true,
                  applePay: true,
                  backgroundColor: '#ffffff',
                  closeButtonColor: '#121212',
                  cardFormPaddingTop: 20,
                );
              },
              icon: const Icon(Icons.payment),
              label: const Text('Launch Payment Sheet'),
              style: ElevatedButton.styleFrom(
                padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 16),
                textStyle: const TextStyle(fontSize: 16),
              ),
            ),
            const SizedBox(height: 24),
            ApplePayButton(
              sessionId: '',
              width: 300,
              height: 88,
              onResult: (result) {
                debugPrint('Apple Pay result: $result');
              },
            ),
          ],
        ),
      ),
    );
  }
}
2
likes
120
points
450
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

SkipCash SDK.

Homepage

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on skipcash

Packages that implement skipcash