react-ravepayment
Version:
This is a reactJS library for implementing rave payment gateway
116 lines (82 loc) • 2.4 kB
Markdown
A React library wrapper for implementing ReavePay Payment Gateway

```bash
npm install react-ravepayment --save
```
or
```bash
yarn add react-ravepayment --save
```
```js
import React, { Component } from "react";
import { useRavePayment } from "react-ravepayment";
const config = {
txref: "rave-123456",
customer_email: "user@example.com",
customer_phone: "234099940409",
amount: 2000,
PBFPubKey: "FLWPUBK-XXXXXXXXXXXXXXXXXXXXXXXXXX-X",
production: false,
};
const App = () => {
const { initializePayment } = useRavePayment(config);
return (
<div>
<button onClick={() => initializePayment()}>Pay 2000</button>
</div>
);
};
export default App;
```
```js
import React, { Component } from "react";
import { RaveProvider, RavePaymentButton } from "react-ravepayment";
const config = {
txref: "rave-123456",
customer_email: "user@example.com",
customer_phone: "234099940409",
amount: 2000,
PBFPubKey: "FLWPUBK-XXXXXXXXXXXXXXXXXXXXXXXXXX-X",
production: false,
onSuccess: () => {},
onClose: () => {}
};
const App = () => {
return (
<div>
<RaveProvider {...config}>
<RavePaymentButton>Pay 2000</RavePaymentButton>
</RaveProvider>
</div>
);
};
export default App;
```
For more usage example [check](/example/src)
See the [API reference](https://link-to-github-pages).
WHEN DEPLOYING TO PRODUCTION/LIVE SYSTEM, take note of the following;
1. Change isProduction attribute in the component tag to true i.e isProduction={true}
2. Change RavePay PUBLIC KEY
3. Ensure you implement [webhooks](https://flutterwavedevelopers.readme.io/docs/events-webhooks) to receive automatic updates when a transaction happens.
1. Fork it!
2. Create your feature branch: `git checkout -b feature-name`
3. Commit your changes: `git commit -am 'Some commit message'`
4. Push to the branch: `git push origin feature-name`
5. Submit a pull request 😉😉
This project follows the [all-contributors](https://allcontributors.org/) specification.
Contributions of any kind welcome!
Looking to contribute? Look for the Good First Issue label.
Please file an issue for bugs, missing documentation, or unexpected behavior.
MIT