1.2.0 • Published 11 months ago

cordova-paytm-allinonesdk v1.2.0

Weekly downloads
9
License
ISC
Repository
github
Last release
11 months ago

Paytm All-in-One SDK ionic cordova

Paytm All-in-One SDK provides a swift, secure and seamless payment experience to your users by invoking the Paytm app (if installed on your user’s smartphone) to complete payment for your order.

Paytm All-in-One SDK enables payment acceptance via Paytm wallet, Paytm Payments Bank, saved Debit/Credit cards, Net Banking, BHIM UPI and EMI as available in your customer’s Paytm account. If Paytm app is not installed on a customer's device, the transaction will be processed via web view within the All-in-One SDK.

This Cordova plugin helps you to be able to use the All-in-One SDK with your ionic application. This plugin supports both Android and iOS.

Installation:

Step 1: Add the plugin in your ionic application with the following command.

ionic cordova plugin add cordova-paytm-allinonesdk

It is also possible to install the plugin via repo url directly

ionic cordova plugin add https://github.com/paytm/paytm-allinonesdk-ionic-cordova.git

Step 2: Add an ionic wrapper for All In One SDK. npm install @ionic-native/all-in-one-sdk --save

For iOS:

Add iOS platform to you application.

ionic cordova platform add ios

This will create an iOS platform for your application at the following path: applicationName/platforms/ios/applicationName.xcworkspace

Make the following changes in your iOS project.

  1. In case merchant don’t have callback URL, Add an entry into Info.plist LSApplicationQueriesSchemes(Array) Item 0 (String)-> paytm

info.plist

  1. Add a URL Scheme “paytm”+”MID” urlScheme

Usage:

Add the plugin to your app's provider list

import { AllInOneSDK } from '@ionic-native/all-in-one-sdk/ngx'

@NgModule({
  declarations: [...],
  entryComponents: [...],
  imports: [...],
  providers: [..., AllInOneSDK],
  bootstrap: [...]
})
export class AppModule {}

In your page from where you want to invoke the All-in-One SDK, add the following code:

import { AllInOneSDK } from '@ionic-native/all-in-one-sdk/ngx'

constructor(private allInOneSDK : AllInOneSDK) {}
//Call Initiate Transaction API from your backend to generate Transaction Token.
let paymentIntent = { mid : "<Merchant ID>",
                      orderId: "<Order ID>",
                      txnToken: "<Transaction Token generated by Initiate Transaction API from your backend>",
                      amount: "<Amount>",
                      isStaging: "<Environment(true/false)>",
                      callbackUrl: "<Callback URL>",
                      restrictAppInvoke: "<Restrict(true/false)>" };

// OR
//let paymentIntent = { mid : "<Merchant ID>",
//                      orderId: "<Order ID>",
//                      txnToken: "<Transaction Token generated by Initiate Transaction API from your backend>",
//                      amount: "<Amount>",
//                      isStaging: "<Environment(true/false)>",
//                      callbackUrl: "<Callback URL>",
//                      restrictAppInvoke: "<Restrict(true/false)>"
//                      enableAssist : <Restrict(true/false)>};

this.allInOneSDK.startTransaction(paymentIntent).then(
resp => {
  // The response recieved after the transaction is completed will be an object containing `message` and `response`. You can parse both and use them as required in your application
  if(resp.response != '')alert(JSON.parse(resp.response));
  else alert(resp.message);
}).catch(error => {
  alert(error);
})

All-In-One API & SDK reference

https://developer.paytm.com/docs/all-in-one-sdk/

1.2.0

11 months ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago