cafebazaar_flutter 1.0.2 cafebazaar_flutter: ^1.0.2 copied to clipboard
CafeBazaar In-App Billing package for flutter upgrade to poolakey this package is just for android applications
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> {
InAppPurchase inApp;
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");
print(purchaseInfo.orderId);
print(purchaseInfo.purchaseToken);
print(purchaseInfo.toString());
},
child: Text("Pay")),
],
)),
),
);
}
}