cafebazaar_flutter 2.0.0 copy "cafebazaar_flutter: ^2.0.0" to clipboard
cafebazaar_flutter: ^2.0.0 copied to clipboard

PlatformAndroid

CafeBazaar In-App Billing package for flutter upgrade to poolakey this package is just for android applications

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:cafebazaar_flutter/cafebazaar_flutter.dart';

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

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

class _MyAppState extends State<MyApp> {
  late InAppPurchase inApp;
  late CafebazaarFlutter _bazaar;
  @override
  void initState() {
    super.initState();
    _bazaar = CafebazaarFlutter.instance;
    inApp = _bazaar.inAppPurchase("PUBLIC_KEY");
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
            child: Column(
          children: [
            ElevatedButton(
                onPressed: () async {
                  final PurchaseInfo? purchaseInfo = await inApp.purchase("m2");
                  await inApp.consume(purchaseInfo?.purchaseToken ?? "");
                  print(purchaseInfo?.orderId);
                  print(purchaseInfo?.purchaseToken);
                  print(purchaseInfo.toString());
                },
                child: Text("Pay")),
          ],
        )),
      ),
    );
  }
}
50
likes
135
points
50
downloads

Publisher

verified publisherflutterfarsi.ir

Weekly Downloads

CafeBazaar In-App Billing package for flutter upgrade to poolakey this package is just for android applications

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation
API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on cafebazaar_flutter