GithubHelp home page GithubHelp logo

a1111198 / paytmsdk-3.0.1 Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 902 KB

The Original Package was causing some Crashes so made bundle.toString() issue Fixed

License: Other

JavaScript 12.18% Java 10.47% Ruby 2.89% Swift 4.67% Objective-C 55.87% Dart 10.66% Shell 3.27%

paytmsdk-3.0.1's Introduction

paytm

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

For Testing/Staging credentials make sure appInvokeEnabled set to FALSE or Paytm APP is not installed on the device.

Example App in iOS

First of all get Credentials from Paytm

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

Let’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();

        String callBackUrl = (testing
                ? 'https://securegw-stage.paytm.in'
                : 'https://securegw.paytm.in') +
            '/theia/paytmCallback?ORDER_ID=' +
            orderId;

        //Host the Server Side Code on your Server and use your URL here. The following URL may or may not work. Because hosted on free server.
        //Server Side code url: https://github.com/mrdishant/Paytm-Plugin-Server
        var url = 'https://desolate-anchorage-29312.herokuapp.com/generateTxnToken';

        var body = json.encode({
          "mid": mid,
          "key_secret": PAYTM_MERCHANT_KEY,
          "website": website,
          "orderId": orderId,
          "amount": amount.toString(),
          "callbackUrl": callBackUrl,
          "custId": "122",
          "mode": mode.toString(),
          "testing": testing ? 0 : 1
        });

        try {
          final response = await http.post(
            url,
            body: body,
            headers: {'Content-type': "application/json"},
          );
          print("Response is");
          print(response.body);
          String txnToken = response.body;
          setState(() {
            payment_response = txnToken;
          });

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

          paytmResponse.then((value) {
            print(value);
            setState(() {
              loading = false;
              print("Value is ");
              print(value);
              if(value['error']){
                payment_response = value['errorMessage'];
              }else{
                if(value['response']!=null){
                  payment_response = value['response']['STATUS'];
                }
              }
              payment_response += "\n"+value.toString();
            });
          });
        } catch (e) {
          print(e);
        }
  }
  

GENERATE TOKEN

For SERVER CODE: Paytm Plugin Server Code

Support

Buy Me A Coffee

For Cloning the example app code visit: Paytm Plugin

For any query : Mail me at [email protected]

paytmsdk-3.0.1's People

Contributors

a1111198 avatar

Stargazers

 avatar

Watchers

 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.