IppoPay
Search…
React JS
The Ippopay Payments plugin allows you to accept credit card, UPI, Netbanking and debit card payments via Ippopay payment gateway in your React JS.

react-ippopay

IppoPay Payment Gateway for your Online Business.

Install

with npm
1
npm install --save react-ippopay
Copied!

Usage

IppoPay Payment Gateway uses sensible defaults, so only minimal configuration via props is necessary.

Basic configuration

How to do configuration in your React Project?

Step 1

Initialize the Ippopay Payment like below.
1
import {Ippopay} from 'react-ippopay';
2
3
class App extends Component {
4
state = {
5
ippopayOpen: false,
6
order_id:'YOUR_ORDER_ID',
7
public_key:'YOUR_PUBLIC_KEY'
8
};
9
ippopayHandler(e){
10
if(e.data.status == 'success'){
11
console.log(e.data)
12
}
13
if(e.data.status == 'failure'){
14
console.log(e.data)
15
}
16
}
17
componentDidUpdate(){
18
window.addEventListener('message', this.ippopayHandler);
19
}
20
ippopayOpen(){
21
this.setState({ippopayOpen: true});
22
}
23
render() {
24
return (
25
<div>
26
<span onClick={e => this.ippopayOpen(e)}>IppoPay</span>
27
<Ippopay ippopayOpen={this.state.ippopayOpen} ippopayClose={true} order_id={this.state.order_id} public_key={this.state.public_key}
28
/>
29
</div>
30
);
31
}
32
}
Copied!

Step 2

Create order from Server side using below API and get the Order id. Click here to know how to create a order.

Step 3

When you click place order button our popup will be loaded so you can use below test card credentials to complete the order.
1
Card Number 4111 1111 1111 1111
2
Expiry 05/20
3
CVV 123
4
5
Card Number 4242 4242 4242 4242
6
Expiry 05/23
7
CVV 123
Copied!

Props

React IppoPay default props to provide a dynamic experience to open a payment widget and allow user to make a payment via Credit/Debit Card.
  • ippopayOpen - Boolean - toggles the popup open state (see above example)
  • ippopayClose - Boolean - Enables the popup close option state (see above example)
  • order_id - String - sets the Order ID as order_id state
  • public_key - String - sets your Public Key as public_key state (Check your API Settings in IppoPay Merchant Panel to know the Public Key)

Success and Error Handlers

React IppoPay gives you the handlers for Payment status and details.
After Payment done, the below line sends the Payment details and status to ippopayHandler function.
1
window.addEventListener('message', this.ippopayHandler);
Copied!
You can get the Payment status in the below function, it may be success or error.
1
ippopayHandler(e){
2
if(e.data.status == 'success'){
3
console.log(e.data)
4
}
5
if(e.data.status == 'failure'){
6
console.log(e.data)
7
}
8
}
Copied!

Author

This component is written by IppoPay.

License

IppoPay 2020 © All Rights Reserved. IppoPay
Last modified 9mo ago