react-korapay
Version:
This is a react package for implementing korapay collection gateway
91 lines (70 loc) • 2.08 kB
Markdown

> This is a react package for implementing korapay collection gateway
```bash
npm install react-korapay
yarn add react-korapay
```
- Basic -
[](https://codesandbox.io/s/react-korapay-example-o6h3j?file=/src/App.js:0-26)
```javascript
import React from "react";
import { useKorapay, KorapayButton } from "react-korapay";
const config = {
public_key: "pk_test_**your_public_key**",
amount: 2000,
customer: {
name: "John doe",
email: "johndoe@gmail.com"
},
narration: "Testing korapay"
};
export default function App() {
const korapayBtnConfig = {
...config,
onClose: () => {},
onSuccess: () => {},
text: "Pay with korapay!"
};
const handleKorapay = useKorapay(config);
return (
<div className="App">
<h1>React Wrapper for Korapay collections</h1>
<h2>Check it out!</h2>
<div>
<button
onClick={() =>
handleKorapay({
onClose: () => {},
onSuccess: () => {}
})
}
>
Pay now!
</button>
<KorapayButton {...korapayBtnConfig} />
</div>
</div>
);
}
```
Please checkout
[](https://korahq.atlassian.net/wiki/spaces/AR/pages/1064370549/Collection+Modal)
for other available options you can add to the tag
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE)
file for details
> Special thanks to Ayeni Olusegun, your work on
> [react-paystack](https://github.com/iamraphson/react-paystack) helped alot!
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
[](https://github.com/all-contributors/all-contributors)
specification. Contributions of any kind welcome!