1.0.0 • Published 3 years ago

react-directpay-ipg v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

#DirectPay ipg - React Plugin

Version 1.0.0

DirectPay Payment Gateway Plugin for React can payment using MasterCard, Visa, Amex, Frimi and LankaQr.

NPM JavaScript Style Guide

dp-ipg-react

Install

npm install --save react-directpay-ipg

Usage

import React, { Component } from 'react'

import DirectPayIpg from 'react-directpay-ipg'
import 'react-directpay-ipg/dist/index.css'

class Example extends Component {

  const onError = (data) => {
    console.log('client-on-error', data)
    alert(JSON.stringify(data))
  }

  const onSuccess = (data) => {
    console.log('client-on-Success', data)
    alert(JSON.stringify(data))
  }

  let payRequest = {
    signature: signature,
    dataString: dataString,
    stage: 'DEV'
  }

  render() {
    return <div>
      <h3>Size: 250 / ButtonColour: white / type: round</h3>
      <DirectPayIpg
        size={150}
        type={'flat'}
        colour={'white'}
        PaymentRequest={payRequest}
        onError={onError}
        onSuccess={onSuccess}
      />

      <h3>Default Button</h3>
      <DirectPayIpg
        PaymentRequest={payRequest}
        onError={onError}
        onSuccess={onSuccess}
      />

      <h3>Size: 300 / ButtonColour: blue / type: round</h3>
      <DirectPayIpg
        size={300}
        type={'round'}
        colour={'blue'}
        PaymentRequest={payRequest}
        onError={onError}
        onSuccess={onSuccess}
      />

      <h3>Size: 250 / ButtonColour: black / type: round</h3>
      <DirectPayIpg
        size={250}
        type={'round'}
        colour={'black'}
        PaymentRequest={payRequest}
        onError={onError}
        onSuccess={onSuccess}
      />
    </div>
  }
}

Properties

NameTypeDefault valueAllow valuesDescription
sizenumber200anyButton size
typestringflatflat / roundButton border style
colourstringgrayblue / white / black / grayButton colour
PaymentRequestObject{signature: object, dataString: string, stage: string (allow only: 'DEV' or 'PROD')}Generated payment requested included payment details

Events

EventDescriptionReturnType
onSuccessThe event is called after transaction success or failedJSON
onErrorThe event is called when receive error transaction initiate or transactions processingJSON

Buttons

dp-ipg-react-button

Change log

####V1.0.0 - Initial release

License

MIT © nimeshc64