@chuttapp/in-app-react
v1.4.0
Published
Typescript template for creating and publishing with rollup, typescript, jest, eslint, prettier, and husky
Downloads
19
Maintainers
Readme
@chuttapp/in-app-react
This package has everything you need to develop a ChuttApp In-App service.
Install
With npm
npm install @chuttapp/in-app-react
With yarn
yarn add @chuttapp/in-app-react
Usage
For Nodejs environments.
React
, Angular
etc.
import { InAppService, Button, ... } from '@chuttapp/in-app-react'
Browser environment.
<script src="@chuttapp/in-app-react/dist/esm/index.browser" type="module">
</script>
...or inlcude bundle
<script src="https://unpkg.com/@chuttapp/in-app-react@{{PKG_VERSION}}/dist/esm/index.browser.js"></script>
Usage example
Accepting payments
import { onPay } from '@chuttapp/in-app-react'
const onPayClick = () => {
const payload = {
amount: 3.5, // REQUIRED
currency: 'GHS', // REQUIRED
data: {
// ...pass stuff here (OPTIONAL)
}
}
onPay(payload)
}
Open Scanner
import { onOpenScanner } from '@chuttapp/in-app-react'
const openScanner = () => {
onOpenScanner()
}