cyberpaysdkflutter 1.0.0+27
cyberpaysdkflutter: ^1.0.0+27 copied to clipboard
The Android SDK to integrate to the cyberpay payment gateway The Cyberpay SDK makes it quick and easy to build seamless payment into your android app.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:cyberpaysdkflutter/cyberpaysdkflutter.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
static const platform = const MethodChannel('cyberpayflutter_plugin');
@override
void initState() {
super.initState();
initCyberPayState();
platform.setMethodCallHandler((call) {
final String argument = call.arguments;
switch (call.method) {
case "onSuccess":
print("SUCCESS $argument");
break;
}
return;
});
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initCyberPayState() async {
try {
await CyberpayflutterPlugin.makePaymentWithReference(
integrationKey: "d5355204f9cf495f853c8f8d26ada19b",
reference: "shaba@gmail.com",
liveMode: false);
} on PlatformException {}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Text('Running on: \n'),
),
),
);
}
}