bundle_rave_pay 0.0.1 bundle_rave_pay: ^0.0.1 copied to clipboard
Bundle App Rave plugin
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:bundle_rave_pay/bundle_rave_pay.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
var result;
@override
void initState() {
super.initState();
// initPlatformState();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
// Platform messages may fail, so we use a try/catch PlatformException.
try {
var cardBody = {
"amount": "3200",
"cvv": "470",
"cardExpiry": "10/22",
"cardNumber": "5399838383838381",
"saveCard": "true",
"country": "NG",
"currencyCode": "NGN",
"email": "hashilekky@gmail.com",
"firstName": "Oluwaleke",
"lastName": "Fakorede",
"transactionReference": "testingLeke",
"isLive": "false",
"publicKey": "FLWPUBK-4f031f19877151a985dfc699ca1389b8-X",
"encryptionKey": "bb9714020722eb4cf7a169f2",
"narration": "How are you doing?",
"isCard": "false",
"secretKey": "FLWSECK-fbbf7e29fe4ab5c9ad3316abf428712f-X"
};
result = await BundleRavePay.initializePayment(cardBody);
print(result);
} on PlatformException {
print('Failed to get platform version.');
}
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
setState(() {
// _platformVersion = platformVersion;
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: FlatButton(
child: Text('Running on:'),
onPressed: () => initPlatformState(),
)
),
),
);
}
}