npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nstudio/nativescript-paytm

v1.0.0

Published

NativeScript plugin to integrate Paytm payments SDK to your app.

Downloads

4

Readme

nativescript-paytm

Works on Android and iOS. For use in India to pay via Paytm.

Installation

tns plugin add @nstudio/nativescript-paytm

Usage

You will need a working backend server to generate paytm orders. Do not generate the order or checksum in the app.

Typescript / Angular

import {
    Paytm,
    Order,
    TransactionCallback,
    IOSCallback
} from "nativescript-paytm";

export function onPayWithPaytm(args: observable.EventData) {
    paytm.setIOSCallbacks({
        didFinishedResponse: function(response) {
            console.log(response);
        },
        didCancelTransaction: function() {
            console.log("User cancelled transaction");
        },
        errorMissingParameterError: function(error) {
            console.log(error);
        }
    });

    // Sample order
    const order: Order = {
        // This will fail saying duplicate order id
        // generate your own order to test this.
        MID: "Tomcas09769922377481",
        ORDER_ID: "ORDER8874",
        CUST_ID: "CUST6483",
        INDUSTRY_TYPE_ID: "Retail",
        CHANNEL_ID: "WAP",
        TXN_AMOUNT: "10.00",
        WEBSITE: "APP_STAGING",
        CALLBACK_URL: "https://pguat.paytm.com/paytmchecksum/paytmCallback.jsp",
        CHECKSUMHASH:
            "NDspZhvSHbq44K3A9Y4daf9En3l2Ndu9fmOdLG+bIwugQ6682Q3JiNprqmhiWAgGUnNcxta3LT2Vtk3EPwDww8o87A8tyn7/jAS2UAS9m+c="
    };

    paytm.createOrder(order);

    paytm.initialize("STAGING"); // set to PRODUCTION when you go live

    paytm.startPaymentTransaction({
        someUIErrorOccurred: function(inErrorMessage) {
            console.log(inErrorMessage);
        },
        onTransactionResponse: function(inResponse) {
            console.log(inResponse);
        },
        networkNotAvailable: function() {
            console.log("Network not available");
        },
        clientAuthenticationFailed: function(inErrorMessage) {
            console.log(inErrorMessage);
        },
        onErrorLoadingWebPage: function(
            iniErrorCode,
            inErrorMessage,
            inFailingUrl
        ) {
            console.log(iniErrorCode, inErrorMessage, inFailingUrl);
        },
        onBackPressedCancelTransaction: function() {
            console.log("User cancelled transaction by pressing back button");
        },
        onTransactionCancel: function(inErrorMessage, inResponse) {
            console.log(inErrorMessage, inResponse);
        }
    });
}

NOTE: If you are using Sandbox credentials, then you won't be able to see the option to pay with Credit/Debit card or netbanking. That is perfectly normal. Once you get staging and production credentials from paytm, you will be able to use it just fine.

API

setIOSCallbacks (object with callback methods for iOS) : void - Used to set the iOS Callbacks Available callbacks are

didFinishedResponse (response) : void
didCancelTransaction () : void
errorMissingParameterError (response): void

createOrder (order object) : void - Used to create an order using paytm order object. Please refer the usage guide for sample order.

initialize (string) : void - Used to initialise paytm environment. Accepted strings are "STAGING" and "PRODUCTION"

startPaymentTransaction (object with callback methods for Android) : void - Used to start a transaction. Available callbacks are

someUIErrorOccurred (inErrorMessage) : void
onTransactionResponse (inResponse) : void // transaction successful
networkNotAvailable () : void
clientAuthenticationFailed (inErrorMessage) : void
onErrorLoadingWebPage (iniErrorCode, inErrorMessage, inFailingUrl) : void
onBackPressedCancelTransaction ()
onTransactionCancel (inErrorMessage, inResponse) : void

The callback method names are self explanatory.

License

Apache License Version 2.0, January 2004