flutterpaytm 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 78

FlutterPaytm #

A new Flutter plugin for Paytm Payment Gateway support with Flutter.

How to Install #

    flutterpaytm: ^1.0.0

How to Use #

Configuration #

FlutterPaytm paytm = FlutterPaytm();
  Map<dynamic, dynamic> response;
  String checksumURL = "Your Checksum generator URL Here";
  String mid = "YOUR MID HERE";
  String verificationURL = "Verification Callback URL";
  String industryType = "Retail";
  String website = "WEBSTAGING";
  bool isTesting = true;

  @override
  void initState() {
    super.initState();
    paytm.configPaytm(mid: mid, checksumURL: checksumURL, verificationURL: verificationURL, industryType: industryType, website: website, isTesting: isTesting);
  }

Start a Payment #

Future<void> doPayment() async {

    Map<dynamic, dynamic> res;
    String orderID = "YOUR ORDER ID HERE";
    String customerID = "YOUR CUSTOMER ID HERE";
    String amount = "AMOUNT HERE";
    try {
      res = await paytm.startPayment(orderId: orderID, customerId: customerID, amount: amount);
    } on PlatformException {
      // do something
    }

    if (!mounted) return;

    setState(() {
      response = res;
    });
  }

Contact #

Email: vaibhavpathak9984@gmail.com Github: @vkpdeveloper Telegram: @vkpdeveloper

1.0.0 #

  • TODO: Describe initial release.

example/lib/main.dart

import 'dart:convert';

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:flutterpaytm/flutterpaytm.dart';
import 'package:http/http.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  FlutterPaytm paytm = FlutterPaytm();
  Map<dynamic, dynamic> response;
  String checksumURL = "Your Checksum generator URL Here";
  String mid = "YOUR MID HERE";
  String verificationURL = "Verification Callback URL";
  String industryType = "Retail";
  String website = "WEBSTAGING";
  bool isTesting = true;

  @override
  void initState() {
    super.initState();
    paytm.configPaytm(mid: mid, checksumURL: checksumURL, verificationURL: verificationURL, industryType: industryType, website: website, isTesting: isTesting);
  }

  Future<void> doPayment() async {

    Map<dynamic, dynamic> res;
    String orderID = "YOUR ORDER ID HERE";
    String customerID = "YOUR CUSTOMER ID HERE";
    String amount = "AMOUNT HERE";
    try {
      res = await paytm.startPayment(orderId: orderID, customerId: customerID, amount: amount);
    } on PlatformException {
      res['error'] = true;
      res['result'] = "PLATFORM EXCEPTION";
    }

    if (!mounted) return;

    setState(() {
      response = res;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: response != null ? Text(response.toString()) : MaterialButton(
            onPressed: doPayment,
            color: Colors.blue,
            height: 40.0,
            minWidth: 180,
            child: Text("Pay Me", style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16.0, color: Colors.white),),
          )
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutterpaytm: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutterpaytm/flutterpaytm.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
56
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
78
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because of import path [package:flutterpaytm/flutterpaytm.dart] that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because of import path [package:flutterpaytm/flutterpaytm.dart] that declares support for platforms: android, ios

Package does not support Flutter platform web

Because of import path [package:flutterpaytm/flutterpaytm.dart] that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because of import path [package:flutterpaytm/flutterpaytm.dart] that declares support for platforms: android, ios

Package not compatible with SDK dart

because of import path [flutterpaytm] that is in a package requiring null.

Health issues and suggestions

Document public APIs. (-1 points)

5 out of 5 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/flutterpaytm.dart. (-1 points)

Analysis of lib/flutterpaytm.dart reported 2 hints:

line 35 col 24: Avoid using braces in interpolation when not needed.

line 39 col 12: Name non-constant identifiers using lowerCamelCase.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
http ^0.12.1 0.12.1
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
http_parser 3.1.4
meta 1.1.8
path 1.7.0
pedantic 1.9.0 1.9.1
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test