react-orel-card-ipg
Version:
OrelPay ipg module for React
64 lines (50 loc) • 1.34 kB
Markdown
# react-orel-card-ipg
[](https://www.npmjs.com/package/react-orel-card-ipg) [](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
```