flutter_payunit 0.0.2 flutter_payunit: ^0.0.2 copied to clipboard
Pay Unit SDK Package facilitates the intergration of payments on your applications with a single button and on the go.
// import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_payunit/flutter_payunit.dart';
void main() {
runApp(const App());
}
class App extends StatelessWidget {
const App({super.key});
@override
Widget build(BuildContext context) => const MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: PayButton(),
),
);
}
class PayButton extends StatelessWidget {
const PayButton({
super.key,
});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey,
appBar: AppBar(
elevation: 1,
backgroundColor: Colors.white,
title: const Text(
"Pay unit demo",
style: TextStyle(color: Colors.black),
),
centerTitle: true,
),
body: Center(
child: Padding(
padding: const EdgeInsets.only(left: 30, right: 30),
child: PayUnitButton(
apiUsername: "xxxxxx-xxxxxxx-xxxxxx-xxxxxx",
apiPassword: "xxxxxx-xxxxxxx-xxxxxx-xxxxxx",
apiKey: 'live_xxxxxxxxxxxxxxxxxxxxxxxxxxx',
mode: 'live', // test or live
totalAmount: 1000,
currency: 'XAF',
paymentCountry: 'CM',
actionAfterProccess: (transactionId, transactionStatus) {
print("Transaction id is : $transactionId and transaction status : $transactionStatus");
if (transactionStatus == 'SUCCESS') {
// Do this if the transaction succeeds
print('The tranaction $transactionId is Successfull');
} else {
// Do this if the transaction fails
print('The tranaction $transactionId Failed');
}
},
returnUrl: 'https://webhook.site/d457b2f3-dd71-4f04-9af5-e2fcf3be8f34',
notifyUrl: 'https://webhook.site/d457b2f3-dd71-4f04-9af5-e2fcf3be8f34',
),
),
));
}
}