zettle 0.2.4 copy "zettle: ^0.2.4" to clipboard
zettle: ^0.2.4 copied to clipboard

A wrapper for the Zettle POS SDK for Android and iOS. Includes support for charging and refunding.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:zettle/zettle.dart';
import 'package:uuid/uuid.dart';

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

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

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

class _MyAppState extends State<MyApp> {
  String? _message;

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

  _init() async {
    var test = await Zettle.init("ios", "android", "test://login.callback");

    setState(() {
      _message = 'init $test';
    });
  }

  _payment() async {
    var uuid = const Uuid();
    var reference = uuid.v4();

    var test = await Zettle.requestPayment(ZettlePaymentRequest(
        amount: 100,
        reference: reference,
        enableLogin: true,
        enableTipping: false,
        enableInstalments: false));

    setState(() {
      _message = '_payment $test';
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(children: [
          TextButton(child: Text('init'), onPressed: () => _init()),
          TextButton(child: Text('payment'), onPressed: () => _payment()),
          Text(_message ?? 'no message'),
        ]),
      ),
    );
  }
}
2
likes
160
points
74
downloads

Publisher

verified publisherovatu.com

Weekly Downloads

A wrapper for the Zettle POS SDK for Android and iOS. Includes support for charging and refunding.

Homepage
Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on zettle