iframe_cashpay_plugin

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

iframe cashpay plugin

iframe_cashpay_plugin #

iframe_cashpay_plugin.
A plugin to add payments iframe_cashpay to your Flutter application.

Platform Support #



Android






IOS



Getting Started #
Before you start, create an APIs with the payment providers and follow the setup instructions:
https://documenter.getpostman.com/view/29850098/2s9YXcd5Fd
Usage #
To start using this plugin, add iframe_cashpay_plugin as a dependency in your pubspec.yaml file:
dependencies:
iframe_cashpay_plugin: ^2.0.9
copied to clipboard
Example #
import 'package:iframe_cashpay_plugin/iframe_cashpay_plugin.dart';
import 'package:iframe_cashpay_plugin/CashPayButton.dart';

class PaySampleAppState extends State<PaySampleApp> {

Future<String> sendItems(itemList) async {
//Send itemList for yor server and post CreateOrder.
//iframeURL returned from Response CreateOrder
//Documentation https://documenter.getpostman.com/view/29850098/2s9YXcd5Fd
//String iframeURL = "**********************************************************";
return iframeURL;
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
backgroundColor: Colors.white,
body: ListView(children: [
CashPayButton(width:MediaQuery.of(context).size.width ,onTap: () async {
await sendItems({
{
"itemName": "كتاب",
"amount": 2000,
},
{
"itemName": "ساعة",
"amount": 5000,
}
}).then((iframeURL) => showModalBottomSheet(
context: context,
isDismissible: false,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(30.0),
),
),
isScrollControlled: true,
builder: (BuildContext context) {
return Container(
padding: const EdgeInsets.only(
left: 10.0, right: 10.0, top: 10.0),
height: MediaQuery.of(context).size.height * 0.7,
//IframeCashPay widget displays the Cash E-wallet payment iframe.
/// This widget IframeCashPay displays the Cash E-wallet payment iframe.
///
/// @param iframeURL .
/// @param onConfirmPayment.
/// @param onCancel.
/// @param onError.
/// @return message onConfirmPayment or onCancel or onError.
///
/// Example:
///
/// ```
/// IframeCashPay( iframeURL: "https://########",
/// onConfirmPayment: onConfirmPayment,
/// onCancel: onCancel,
/// onError: onError,);
/// ```
child: IframeCashPay(
iframeURL: iframeURL,
onConfirmPayment: onConfirmPayment,
onCancel: onCancel,
onError: onError,
));
}));})
]));
}

//Await for iFrameCashPay
onConfirmPayment(message) {
//After Confirmatin from iFrame Returned message {NEEDTOCHECK or Confirmation}.
//if(message.messsage==NEEDTOCHECK || message.messsage==Confirmation)
//Here use CheckOrderStatus to check order status.
//Documentation https://documenter.getpostman.com/view/29850098/2s9YXcd5Fd
}

//Await for iFrameCashPay
onCancel(message) {
//After Cancel from iFrameCashPay.
Navigator.pop(context);
}

//Await for iFrameCashPay
onError(message) {
//After return Error from iFrameCashPay.
Navigator.pop(context);
}
}
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.