IppoPay
Search…
Flutter
A Flutter plugin for making payments via IppoPay Payment Gateway. Fully supports Android and iOS.

IppoPay Payment

A Flutter plugin for making payments via IppoPay Payment Gateway. Fully supports Android and iOS.

Installation

In the dependencies: section of your pubspec.yaml, add the following line:
1
ippo_pay: ^0.0.1
Copied!
Import in your project:
1
import 'package:ippo_pay/ippo_pay.dart';
Copied!

Create Order

Create order from Server side using below API and get the Order id. Click here to know how to create a order.

Basic Usage

1
import 'dart:convert';
2
3
import 'package:flutter/material.dart';
4
import 'dart:async';
5
6
import 'package:flutter/services.dart';
7
import 'package:ippo_pay/ippo_pay.dart';
8
9
void main() {
10
runApp(MyApp());
11
}
12
13
class MyApp extends StatefulWidget {
14
@override
15
_MyAppState createState() => _MyAppState();
16
}
17
18
class _MyAppState extends State<MyApp> {
19
TextEditingController orderIdTextField = new TextEditingController();
20
final key = new GlobalKey<ScaffoldState>();
21
22
@override
23
void initState() {
24
super.initState();
25
initPlatformState();
26
}
27
28
// Platform messages are asynchronous, so we initialize in an async method.
29
Future<void> initPlatformState() async {
30
if (orderIdTextField.text.trim().isNotEmpty) {
31
try {
32
IppoPay.initSdk("Public_Key");
33
IppoPay.setLogVisible(true);
34
var result = await IppoPay.makePayment(
35
json.encode({"order_id": orderIdTextField.text}));
36
print(result);
37
} on Exception catch (exception) {}
38
} else {
39
key.currentState.showSnackBar(new SnackBar(
40
content: new Text("Please enter orderid"),
41
));
42
}
43
// Platform messages may fail, so we use a try/catch PlatformException.
44
45
// If the widget was removed from the tree while the asynchronous platform
46
// message was in flight, we want to discard the reply rather than calling
47
// setState to update our non-existent appearance.
48
if (!mounted) return;
49
50
setState(() {
51
// _platformVersion = platformVersion;
52
});
53
}
54
55
@override
56
Widget build(BuildContext context) {
57
return MaterialApp(
58
home: Scaffold(
59
key: key,
60
appBar: AppBar(
61
title: const Text('Ippopay Example'),
62
),
63
body: Container(
64
child: Center(
65
child: Column(
66
crossAxisAlignment: CrossAxisAlignment.center,
67
mainAxisAlignment: MainAxisAlignment.center,
68
children: [
69
Container(
70
margin: EdgeInsets.all(20),
71
child: TextField(
72
controller: orderIdTextField,
73
decoration: InputDecoration(hintText: "Enter the Order id"),
74
),
75
),
76
InkWell(
77
onTap: () {
78
initPlatformState();
79
},
80
child: Container(
81
margin: EdgeInsets.all(20),
82
height: 50,
83
color: Colors.blue,
84
child: Center(
85
child: Text(
86
"Proceed Payment",
87
style: TextStyle(color: Colors.white, fontSize: 18),
88
),
89
),
90
),
91
)
92
],
93
),
94
),
95
),
96
),
97
);
98
}
99
}
Copied!
Note: If you're using the IppoPay public as a string in flutter, remember to escape the $ dollar signs although it is recommended to load these from your backend
1
IppoPay.initSdk("YOUR_PUBLIC_KEY");
Copied!
Last modified 7mo ago