fluidcoins-pay-react
Official React package for Fluidcoins pay
Fluidcoins React package
Fluidcoins – The easiest way for African businesses to accept cryptocurrencies online.
Installation
npm install fluidcoins-pay-react
Usage
import React from 'react'
import { useFluidcoins } from 'fluidcoins-pay-react'
// ...
export default function App() {
const config = {
key: 'PUBLIC_KEY',
amount: 'AMOUNT_IN_KOBO',
email: '[email protected]',
name: 'John Doe',
phone: '08012345678',
metadata: {
moniker: 'ezemmuo'
},
onSuccess: (data) => {
console.log('? onSuccess', data)
},
onError: (error) => {
console.log('? onError', error)
},
onClose: () => {
console.log('? onClose: SDK closed')
},
onLoad: () => {
console.log('? onClose: SDK closed')
}
}
const handlePayment = useFluidcoins(config)
return (
<div className='App'>
<h1>Fluidcoins SDK</h1>
<button onClick={handlePayment}>Pay with Fluidcoins</button>
</div>
)
}
Configuration Options
key
string: Required
Your public key can be found on your dashboard.
email
string: Required
The user’s email address
amount
string | number: Required
The amount you intend to send in kobo
name
string | number: Required
The name of the user
phone
string | number: Required
The phone number of the user
onSuccess
(response) => void: Required
This is called when a transaction is successfully. It returns an object as a response with the transaction details.
Check the Fluidcoins Docs for response object
onError
(response) => void: Optional
This is called when a transaction fails. It returns a response with error type
Check the Fluidcoins Docs for error object
onLoad
(response) => void: Optional
This is called when the SDK loads up.
onClose
(response) => void: Optional
This is called when a user clicks on the close button.
metadata
object: Optional
This object should contain additional/optional attributes you would like to have in your transaction response
Support
If you’re having trouble with Fluidcoins React package please reach out to me at [email protected] or the Fluidcoins team at [email protected] if you have issues with your integration. We’re more than happy to help you out.
Fluidcoins API References
License
MIT for more information.