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

paytm-blink-checkout-angular

v0.0.3

Published

Angular based implementation for Paytm Blink Checkout JS

Downloads

1,019

Readme

paytm-blink-checkout-angular

Installation

$ npm install --save paytm-blink-checkout-angular

Supported Angular versions

6 and above

Usage

The paytm-blink-checkout-angular provides a module, component and service to incorporate Paytm Blink Checkout JS library in a project.

In order to make use of paytm-blink-checkout-angular, import CheckoutModule to the modules imports section.

Example

import { CheckoutModule } from 'paytm-blink-checkout-angular';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    CheckoutModule
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

CheckoutService

The service provide methods for setting up Paytm Blink Checkout JS in a project. It sets the Paytm Blink JS instance, which could be retrieved from checkoutJsInstance$ observable from the service. To initialize, one need to call service init method with config and optional openInPopup boolean value. The config argument is mandatory to be passed in order to initialize Paytm React Checkout JS library. In options (optional second argument) following could be passed:

  1. openInPopup (optional): To show checkout in popup or not, by default it's value is true.
  2. env (optional): To load Paytm Blink Checkout JS from 'STAGE' or 'PROD' env, by default it's value is 'PROD'.
  3. checkoutJsInstance (optional): To use existing checkoutjs instance.

The config should be of same format as the Paytm Blink Checkout JS library, which could be checked from this link.

Example

Service could be injected and initialized as follows :


import { Component, OnDestroy } from '@angular/core';
import { CheckoutService } from 'paytm-blink-checkout-angular';
import { Subscription } from 'rxjs';

@Component({
  selector: 'app-root',
  template: ''
})
export class AppComponent implements OnDestroy{
  private subs: Subscription;

  constructor(private readonly checkoutService: CheckoutService) {
    this.checkoutService.init(
      //config
      {
        data: {
          orderId: "test4",
          amount: "3337",
          token: "e334366c509b4294a285a3b42a5659ea1584106015734",
          tokenType: "TXN_TOKEN"
        },
        merchant: {
          mid: "wHNUTH68224456779429",
          name: "Dummy",
          redirect: true
        },
        flow: "DEFAULT",
        handler: {
          notifyMerchant: this.notifyMerchantHandler
        }
      },
      //options
      {
        env: 'PROD', // optional, possible values : STAGE, PROD; default : PROD
        openInPopup: true // optional; default : true
      }
    );

    this.subs = this.checkoutService
      .checkoutJsInstance$
      .subscribe(instance=>console.log(instance));
  }

  notifyMerchantHandler = (eventType, data): void => {
    console.log('MERCHANT NOTIFY LOG', eventType, data);
  }

  ngOnDestroy(): void {
    if (this.subs) {
      this.subs.unsubscribe();
    }
  }
}

CheckoutComponent

The component is responsible for invoking and displaying the payment page. Please make sure to call CheckoutService service init method .

Example

<paytm-checkout></paytm-checkout>