instamojo_plus 0.0.7 copy "instamojo_plus: ^0.0.7" to clipboard
instamojo_plus: ^0.0.7 copied to clipboard

A Flutter package to integrate Instamojo payment gateway.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:instamojo_plus/instamojo_plus.dart';
// ignore: implementation_imports
import 'package:instamojo_plus/src/model/payment_request.dart';

void main() {
  runApp(const MyApp());
} 

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'Instamojo Demo',
        theme: ThemeData(primarySwatch: Colors.blue),
        home: Homescreen());
  }
}

class Homescreen extends StatelessWidget {
  Homescreen({
    super.key,
  });
  final paymentRequest = InstamojoPaymentRequest(
    purpose: 'Subscription',
    amount: double.parse('10'),
    buyerName: 'name',
    email: 'name@gmail.com',
    phone: 'phonenumber',
    redirectUrl: 'http://www.example.com/redirect/',
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('Instamojo Demo'),
        ),
        body: Center(
            child: ElevatedButton(
                onPressed: () {
                  Navigator.push(
                    context,
                    MaterialPageRoute(
                        builder: (context) => PaymentScreen(
                              clientId: 'clientId',
                              clientsecret: 'clientsecret',
                              paymentRequest: paymentRequest,
                              onPaymentSuccess: (p0) =>
                                  debugPrint('Payment Success: $p0'),
                              onPaymentError: (p0) => debugPrint('¸ $p0'),
                              onPaymentCancel: () =>
                                  debugPrint('Payment Cancelled'),
                            )),
                  );
                },
                child: const Text('Do payment'))));
  }
}
1
likes
140
points
352
downloads

Publisher

verified publishersujithdev.live

Weekly Downloads

A Flutter package to integrate Instamojo payment gateway.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http, url_launcher, webview_flutter

More

Packages that depend on instamojo_plus