react-cobuyr
v1.0.2
Published
This is a react package for implementing cobuyr payment gateway
Downloads
10
Readme
react-cobuyr
This is a react package for implementing cobuyr payment gateway
Install
npm install --save react-cobuyr
Usage
import React, { Component } from 'react'
import { CobuyrButton, useCobuyrPayment } from 'react-cobuyr'
import 'react-cobuyr/dist/index.css'
const config = {
amount: <number>,
totalQuantity: <number>,
publicKey: <string>,
order: {
name: <string>,
description: <string>,
price: <number>,
quantity: <number>,
id: <string>,
productType: <string>,
image: <string>
}[]
}
Hook Example
import React, { Component } from 'react'
import { useCobuyrPayment } from 'react-cobuyr'
import 'react-cobuyr/dist/index.css';
const CobuyrHookExample = () => {
const initializePayment = useCobuyrPayment()
return (
<div>
<button
onClick={() => {
initializePayment({ config })
}}
>
Cobuyr Hooks Implementation
</button>
</div>
)
}
Button Example
import React, { Component } from 'react'
import { CobuyrButton } from 'react-cobuyr'
import 'react-cobuyr/dist/index.css'
const App = () => {
return (
<div>
<CobuyrButton {...config} text='Proceed to payment' />
</div>
)
}
License
MIT © rayking12