UNPKG

react-orel-card-ipg

Version:

OrelPay ipg module for React

64 lines (50 loc) 1.34 kB
# react-orel-card-ipg [![NPM](https://img.shields.io/npm/v/react-orel-card-ipg.svg)](https://www.npmjs.com/package/react-orel-card-ipg) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) ## Install ```bash npm install --save react-orel-card-ipg ``` ## Usage ```jsx import React, {Component} from 'react' //import IPG import OrelCardIpg from 'react-orel-card-ipg' import 'react-orel-card-ipg/dist/index.css' class Example extends Component { token = 'xxxx'; reference = 'order001' stage = 'dev' //Open Card View addCard = () => { this.refs.cardAddService.addCard(this.token, this.reference, this.stage).then((res) => { console.log('cardAdding-res', res); alert(JSON.stringify(res)); }).catch(error => { console.log('cardAdding-error', error); alert(JSON.stringify(error)); }); }; //Cancel Or Close Card View cancel = () => { this.refs.cardAddService.cancel(); } render() { return ( <div> <button onClick={this.addCard}> Add Card </button> <br/><br/> <button onClick={this.cancel}> Cancel </button> <OrelCardIpg ref="cardAddService"/> </div> ); } } ``` #### Change log ```react2html V1.0.0 - Initial release ```