Code Monkey home page Code Monkey logo

paytm-all-in's Introduction

paytm

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

Example App in iOS

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();
      });
    });
  }
  

paytm-all-in's People

Contributors

ykcirdeep avatar

Watchers

Amit Agarwal avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.