paytm

A Flutter plugin to use the Paytm as a gateway for accepting online payments in Flutter app.

Example App in iOS

IMG_0CA99F9C709C-1

First of all get Production Credentials from Paytm

Plugin will only work with Production Keys https://dashboard.paytm.com/next/apikeys

Lets’s begin

iOS Configuration:

In case merchant don’t have callback URL, Add an entry into Info.plist

  1. LSApplicationQueriesSchemes(Array) Item 0 (String)-> paytm iosInvoke

  2. Add a URL Scheme “paytm”+”MID” app-invoke-ios-inti

Start Payment

  void generateTxnToken(int mode) async {
    
    String orderId = DateTime.now().millisecondsSinceEpoch.toString();

    //Replace this with your server callBackUrl If any
    String callBackUrl =
        'https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=' + orderId;

    //Replace this with your server generateTxnToken (This is a Token Generation Tool hosted on a free server. Must host the same on your server)
    var url =
        'https://desolate-anchorage-29312.herokuapp.com/generateTxnToken' +
            "?mid=" +
            mid +
            "&key_secret=" +
            key_secret +
            "&website=" +
            website +
            "&orderId=" +
            orderId +
            "&amount=" +
            amount.toString() +
            "&callbackUrl=" +
            callBackUrl +
            "&custId=" +
            "122" +
            "&mode=" +
            mode.toString();

    final response = await http.get(url);

    print("Response is");
    print(response.body);
    String txnToken = response.body;

    var paytmResponse = Paytm.payWithPaytm(
      mid,
      orderId,
      txnToken,
      amount.toString(),
      callBackUrl,
    );

    paytmResponse.then((value) {
      print(value);
      setState(() {
        loading = false;
        payment_response = value.toString();
      });
    });
  }
  

GENERATE TOKEN

For SERVER CODE: Paytm Plugin Server Code

Support

For Cloning the example app code visit: Paytm Plugin

For any query : Mail me at mr.dishantmahajan@gmail.com

Libraries

paytm