upetch_razor_pay_plugin 0.0.1 upetch_razor_pay_plugin: ^0.0.1 copied to clipboard
A new Flutter plugin.
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:upetch_razor_pay_plugin/upetch_razor_pay_plugin.dart';
main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("Open RazorPay"),
),
body: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
MaterialButton(
onPressed: _showRazorPayView,
color: Colors.blue,
child: Text(
"Pay with RazorPay",
style: TextStyle(color: Colors.white),
),
)
],
),
),
),
);
}
Future<Null> _showRazorPayView() async {
String apikey = "API_KEY";
Map<String, dynamic> options = Map();
options.putIfAbsent("name", () => "Testing");
options.putIfAbsent("image", () => "");
options.putIfAbsent("description", () => "Testing");
options.putIfAbsent("amount", () => "100");
options.putIfAbsent("email", () => "test@test.com");
options.putIfAbsent("contact", () => "100");
options.putIfAbsent("currency", () => "INR");
options.putIfAbsent("api_key", () => apikey);
Map<dynamic, dynamic> paymentResponse = Map();
paymentResponse =
await UpetchRazorPayPlugin.openRazorPaymentDialog(options);
print("response $paymentResponse");
}
}