paytm_payments 0.3.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 80

paytm_payments #

Paytm Payments Flutter SDK

Usage #


To use this package :

  • add the dependency to your pubspec.yaml file.
      sdk: flutter
  • add following permissions to you AndroidManifest.xml file.
    <manifest xmlns:android=""
        <!-- Include these permissions in your manifest file -->
        <uses-permission android:name="android.permission.INTERNET"/>
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
        <uses-permission android:name="android.permission.READ_SMS"/>
        <uses-permission android:name="android.permission.RECEIVE_SMS"/>
  • Host a checksum generation file which will become your checksum URL which is one of the 2 required fields.

See Step- 5 of Paytm Developer Generate Checksum Url For any assistance with this step mail me at the give email address.

You may use the url with MID provided in example app to test the working of paytm staging environment. Note that you are supposed to use test credentials with the staging setup for loggin into paytm.

Test Credentials:

Number: 7777777777
OTP: 489871

License #

Copyright 2019 Apoorv Jain

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

Getting Started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

0.0.1 #

  • Pass Paytm Staging/Production user specific data and setup paytm payments within your app in a minute.

0.1.0 #

  • Tested Staging Environment.
  • Hosted php based checksum Urls. Example call to 'makePaytmPayment' works with default values too.

0.2.0 #

  • Production environment fixed and tested
  • Now generate random customer and order IDs too.

0.2.1 #

  • Option to disable Transaction Response Toast message added.
  • Method Channel call fixed.

0.3.0 #

  • Now you can listen for the transaction status response using 'PaytmPayments.responseStream.listen'.

0.3.1 #

  • Receive complete response object on 'PaytmPayments.responseStream.listen'.
  • Bad State error on setting stream listener fixed.
  • Example code more clear and easy to follow.


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

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

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

class _MyAppState extends State<MyApp> {

  void initState() {


  void setResponseListener(){

    // setting a listener on payment response
    PaytmPayments.responseStream.listen((Map<dynamic, dynamic> responseData){


      * {RESPMSG : [MSG]} // this is the type of map object received, except for one case.
      * In this unique case, Transaction Response is received of the format:
      * {CURRENCY: INR, ORDERID: 1557210948833, STATUS: TXN_FAILURE, BANKTXNID: , RESPMSG: Invalid checksum, MID: rxazcv89315285244163, RESPCODE: 330, TXNAMOUNT: 10.00}
      * Call any method here to handle payment process on receiving response. According to the response received.
      * handleResponse();
      * */

  // method to initiate payment
  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPayment() async {

    // try/catch any Exceptions.
    try {

      await PaytmPayments.makePaytmPayment(
        "rxazcv89315285244163", // [YOUR_MERCHANT_ID] (required field)
        "", // [YOUR_CHECKSUM_URL] (required field)
        customerId: "12345", // [UNIQUE_ID_FOR_YOUR_CUSTOMER] (auto generated if not specified)
        orderId:, // [UNIQUE_ID_FOR_YOUR_ORDER] (auto generated if not specified)
        txnAmount: "10.0", // default: 10.0
        channelId: "WAP", // default: WAP (STAGING value)
        industryTypeId: "Retail", // default: Retail (STAGING value)
        website: "APPSTAGING", // default: APPSTAGING (STAGING value)
        staging: true, // default: true (by default paytm staging environment is used)
        showToast: true, // default: true (by default shows callback messages from paytm in Android Toasts)

    } on Exception {

      print("Some error occurred");

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Paytm Payment'),
        body: Center(
          child: RaisedButton(
            onPressed: (){
            child: Text("Make Payment"),

Use this package as a library

1. Depend on it

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

  paytm_payments: ^0.3.1

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:paytm_payments/paytm_payments.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health issues and suggestions

Document public APIs. (-1 points)

10 out of 10 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/paytm_payments.dart. (-0.50 points)

Analysis of lib/paytm_payments.dart reported 1 hint:

line 12 col 49: Close instances of dart.core.Sink.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
http ^0.12.0+2 0.12.0+4
Transitive dependencies
async 2.4.1
charcode 1.1.3
collection 1.14.11 1.14.12
http_parser 3.1.4
meta 1.1.8
path 1.6.4
pedantic 1.9.0
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
vector_math 2.0.8
Dev dependencies