paytmkaro 1.0.1 copy "paytmkaro: ^1.0.1" to clipboard
paytmkaro: ^1.0.1 copied to clipboard

outdated

A plugin for adding Paytm Payment Gatway in Flutter.

Paytmkaro #

A flutter plugin to integrate a Paytms All in one SDK in flutter.

Right now its only support Andriod and only works with production keys.

Getting Started #

  1. Prerequisites
  2. Installation
  3. Usage
  4. Server Side Code

This flutter plugin is a wrapper around Paytm's Android All in one SDKs.

To know more about our SDKs and how to link them within the projects, refer to the following documentation:

All in one sdk in Flutter

Prerequisites #

  1. Create an account on Paytm as a merchant. Click how to create account.

  2. Get the merchant id and merchant key for the integration environment after creating the account.

  3. Go through the checksum logic to understand how to generate and validate the checksum.

  4. Calling Initiate initiate Transaction Api from your backend to generate Transaction Token.

Installation #

The plugin is avilable on pub https://pub.dev/packages/paytmkaro

Add this to dependencies in your app's pubspec.yaml

paytmkaro: ^0.0.1

Note for Android: Make sure that the minimum API level for your app is 19 or higher.

Follow this for more details.

Usage #

Sample code to integrate can be found in example/lib/main.dart.

Flow

App Invoke Flow: In case the Paytm app is installed, it will be launched to complete the transaction and give the response back to your app.

Redirection Flow: In case the Paytm app is not installed, All-in-One SDK will open a web-view to process transaction and give the response back to your app.

Create PaytmKaro Object

Before Starting Please upload server side code and don't make any changes in that.
PaytmKaro _paytmKaro=PaytmKaro();

StartTransaction

Pass the required Arguments in startTransection

// Platform messages may fail, so we use a try/catch.
    try {
      PaytmResponse paymentResponse = await _paytmKaro.startTransaction(
        url: serverside code url e.g. https://arcane-temple-61754.herokuapp.com/intiateTansection.php,
        mid: your Production merchant id,
        mkey: your merchant key,
        customerId:customer id (must be unique for every customer),
        amount: transection amount,
        orderId: Order Id (Order id must be unique Everytime for every order),
      );

      if(paymentResponse.status=="TXN_SUCCESS"){
        Navigator.push(context, MaterialPageRoute(builder: (context)=>txnSuccessful(paytmResponse: paymentResponse,)));
      }
      else if(paymentResponse.status=="TXN_FAILURE"){
        Navigator.push(context, MaterialPageRoute(builder: (context)=>txnFailed(paytmResponse: paymentResponse,)));
      }
    } 
    catch(e){
      print(e);
      key.currentState.showSnackBar(SnackBar(content: Text(e.toString())));      // platformVersion = 'Failed to get platform version.'
    }

Get the serever side code from here

Error Codes

resultCode resultMsg
07 Txn Success
227 Transection declines by bank
235 Wallet balance Insufficient, bankName=WALLET

There are much more result codes you can find them here:https://developer.paytm.com/docs/api/v3/transaction-status-api/?ref=payments

PaymentSuccessResponse #

[ORDERID] => ORDERID_98765
[MID] => INTEGR7769XXXXXX9383
[TXNID] => 202005081112128XXXXXX68470101509706
[TXNAMOUNT] => 1.00
[PAYMENTMODE] => UPI
[CURRENCY] => INR
[TXNDATE] => 2020-07-28 10:14:55.0
[STATUS] => TXN_SUCCESS
[RESPCODE] => 01
[RESPMSG] => Txn Success
[GATEWAYNAME] => PPBLC
[BANKTXNID] => 6877266
[CHECKSUMHASH] => glEBpHd9yJ5g9ReTNkpjfFsvBEb1aYIdQN1mSCbMVNcn6CGDr3UUf3psseqKGPswoU0Xdl6g9P9Jc6U9Q9Ol/JuwcudfMLRgaUjj2rsAl/8=

PaymentFailureResponse

[ORDERID] => ORDERID_98765
[MID] => INTEGR7769XXXXXX9383
[TXNID] => 202005081112128XXXXXX68470101509706
[TXNAMOUNT] => 1.00
[PAYMENTMODE] => UPI
[CURRENCY] => INR
[TXNDATE] => 2020-07-28 10:14:55.0
[STATUS] => TXN_FAILURE
[RESPCODE] => 810
[RESPMSG] => Payment failed due to a technical error. Please try after some time.
[GATEWAYNAME] => PPBLC
[BANKTXNID] => 6877266
[CHECKSUMHASH] => glEBpHd9yJ5g9ReTNkpjfFsvBEb1aYIdQN1mSCbMVNcn6CGDr3UUf3psseqKGPswoU0Xdl6g9P9Jc6U9Q9Ol/JuwcudfMLRgaUjj2rsAl/8=

Screenshot #

Payment Screen

Transection Successful

Transection Failed

ServerCode #

It's used to Initiate Transaction from server. You can find the Server code here.

Also check the offical documnts from paytm

Note #

It's only work with Production keys only.

10
likes
0
pub points
0%
popularity

Publisher

verified publishersanketbabar.me

A plugin for adding Paytm Payment Gatway in Flutter.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, http

More

Packages that depend on paytmkaro