Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign in
Socket

paytm-blink-checkout-react

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

paytm-blink-checkout-react

React based implementation for Paytm Blink Checkout JS

latest
npmnpm
Version
0.0.4
Version published
Maintainers
2
Created
Source

Installation

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

Supported React versions

16.3.0 and above

Usage

The paytm-blink-checkout-react provides three components to incorporate Paytm Blink Checkout JS library in a project.

The component can be imported as:

import { CheckoutProvider, Checkout, injectCheckout} from 'paytm-blink-checkout-react'

The component are as follows :

CheckoutProvider

The component is responsible for setting up Paytm Blink Checkout JS in the project. It sets the Paytm Blink Checkout JS instance and make it available to all its children component via React Context Provider. It requires config property which is mandatory is order to initialize Paytm Blink Checkout JS library. Additionally following props(optional) can be passed:

  • openInPopup: To show checkout in popup or not, by default it's value is true.
  • env: To load Paytm Blink Checkout JS from 'STAGE' or 'PROD' env, by default it's value is 'PROD'.
  • checkoutJsInstance: 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

<CheckoutProvider config={config} openInPopup="false" env='PROD'>
</CheckoutProvider>

Checkout

The component is responsible for invoking and displaying the payment page. It should be always nested inside CheckoutProvider component.

Example

<CheckoutProvider config={config}>
  <Checkout />
</CheckoutProvider>

It could be nested at any nth level of CheckoutProvider.

Example

<CheckoutProvider config={config}>
  <Child1>
    <Child2>
       <Checkout />
    </Child2>
  </Child1>
</CheckoutProvider>

injectCheckout

This higher order component injects Paytm Blink Checkout JS instance to the wrapped component and make it available in the wrapped component props as checkoutJsInstance . The instance allows to directly interact with Paytm Blink Checkout JS library . The injected component should be always nested inside CheckoutProvider component.

Example

Component that makes use of checkoutJsInstance prop.

function Test(props) {
   const checkoutJsInstance = props.checkoutJsInstance;
   return <div>{checkoutJsInstance && <span>checkoutJsInstance.TOKEN</span>}</div>;
}

Wrap component in a higher order component which provides checkoutJsInstance prop.

const InjectedComponent = injectCheckout(Test);

Render the wrapped component

<CheckoutProvider config={config}>
  <InjectedComponent />
</CheckoutProvider>

Keywords

Paytm

FAQs

Package last updated on 03 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts