Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
62bbf9b
Merge pull request #8 from seerbit/develop
seerbit-developers Jun 14, 2022
e2dec3f
add git workflow
amoskeyz Mar 9, 2023
2c939e5
Merge pull request #9 from amoskeyz/main
seerbit-developers Mar 9, 2023
1c3b828
update params
amoskeyz Mar 9, 2023
0dd567d
Merge branch 'main' of https://github.com/amoskeyz/seerbit-reactjs
amoskeyz Mar 9, 2023
a266c60
Merge pull request #10 from amoskeyz/main
seerbit-developers Mar 9, 2023
3cb6c64
Create npm-publish.yml
seerbit-developers Mar 9, 2023
7b3c92c
update webflow
amoskeyz Mar 9, 2023
104272c
Merge pull request #11 from amoskeyz/main
seerbit-developers Mar 9, 2023
0333be5
update webflow
amoskeyz Mar 9, 2023
0424c2f
Merge pull request #12 from amoskeyz/main
seerbit-developers Mar 9, 2023
7beb788
Update npm-publish.yml
seerbit-developers Mar 9, 2023
c907edf
Update package.json
seerbit-developers Mar 9, 2023
e9a3bdf
Update npm-publish.yml
seerbit-developers Mar 9, 2023
09af01e
Update package.json
seerbit-developers Mar 9, 2023
06362b3
upgrade seerbit react sdk
amoskeyz Oct 10, 2023
63048b4
upgrade seerbit react sdk
amoskeyz Oct 10, 2023
c9736c9
Merge pull request #13 from amoskeyz/main
seerbit-developers Oct 10, 2023
848decb
Update npm-publish.yml
seerbit-developers Oct 10, 2023
77e39a6
update readme and example
amoskeyz Oct 16, 2023
8dbc450
Merge pull request #14 from amoskeyz/main
seerbit-developers Oct 16, 2023
b5cb71d
update readme and example
amoskeyz Oct 16, 2023
63fe57a
Merge pull request #15 from amoskeyz/main
seerbit-developers Oct 16, 2023
00bb6ca
update
amoskeyz Mar 6, 2025
5482309
update type
amoskeyz Mar 6, 2025
7f1bb18
Merge pull request #17 from amoskeyz/main
seerbit-developers Mar 6, 2025
8a2009e
update type
amoskeyz Mar 6, 2025
f0606d5
Merge branch 'main' of https://github.com/amoskeyz/seerbit-reactjs
amoskeyz Mar 6, 2025
402a508
Merge pull request #18 from amoskeyz/main
seerbit-developers Mar 6, 2025
9eccec2
Dynamic split support
ahntoni Nov 21, 2025
e916b39
split update
ahntoni Nov 21, 2025
bad7869
split update
ahntoni Nov 21, 2025
95d5ff1
Merge pull request #1 from ahntoni-seerbit/update
ahntoni-seerbit Nov 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Publish to NPM
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
- name: Publish package on NPM 📦
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
207 changes: 148 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,182 @@
<br/>
<br/>
<br/>
<div align="center">
<img width="400" valign="top" src="https://assets.seerbitapi.com/images/seerbit_logo_type.png">
<img width="200" valign="top" src="https://assets.seerbitapi.com/images/seerbit_logo_type.png">
</div>
<br/>
<br/>
<br/>

<h1 align="center">
<!-- <h1 align="center">
<img width="60" valign="bottom" src="https://reactnative.dev/img/header_logo.svg" alt="ReactJS">
SeerBit
</h1>
</h1> -->

# Seerbit Checkout Wrapper for ReactJS
### Seerbit Checkout Wrapper for ReactJS

# Requirements
This module was built and tested using React 15.0.0 - 18.0.0

This module was built and tested using React 15.0.0 - 19.0.0

## Get Started

A simple way to add Seerbit to your React application

[![NPM](https://img.shields.io/npm/v/react-seerbit.svg)](https://www.npmjs.com/package/seerbit-reactjs) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
<!-- [![NPM](https://img.shields.io/npm/v/react-seerbit.svg)](https://www.npmjs.com/package/seerbit-reactjs) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) -->

## Install

```bash
npm install --save seerbit-reactjs
```

OR

```bash
yarn add seerbit-reactjs
```

## Usage

Add Seerbit to your projects:

1. As a React Hook
2. As a React Button Component
<br/>
<br/>

### As React Hook

```jsx
import React, { Component } from "react";
import SeerbitCheckout from "seerbit-reactjs"

export default class App extends Component {
constructor(props) {
super(props);
this.state = {
public_key: "YOUR_API_KEY",
amount: 100,
tranref: new Date().getTime(),
customization: {
theme: {
border_color: "#000000",
background_color: "#004C64",
button_color: "#0084A0",
},
payment_method: ["card", "account", "transfer", "wallet", "ussd"],
display_fee: true, // true
display_type: "embed", //inline
logo: "logo_url | base64",
}
};
}

close = (close) => {
import { useSeerbitPayment } from "seerbit-reactjs";

const App = () => {
const options = {
public_key: "YOUR_PUBLIC_KEY",
amount: 100,
tranref: new Date().getTime(),
currency: "NGN",
email: "test@mail.com",
full_name: "Sam Smart",
mobile_no: "081234566789",
description: "test",
tokenize: false,
planId: "",
pocketId: "",
vendorId: "",
customization: {
theme: {
border_color: "#000000",
background_color: "#004C64",
button_color: "#0084A0",
},
payment_method: ["card", "account", "transfer", "wallet", "ussd"],
display_fee: true, // true
display_type: "embed", //inline
logo: "logo_url | base64",
},
split:{
type: "FLAT",
transactionFee: "SUB_ACCOUNT",
items: [
{ subAccountCode: "234332", subAccountName: "y6whs", value: 90 },
],
}
};

const close = (close) => {
console.log(close);
};
callback = (response) => {

const callback = (response: any, closeCheckout: any) => {
console.log(response);

setTimeout(() => closeCheckout(), 2000);
};

const initializePayment = useSeerbitPayment(options, callback, close);

return (
<div>
<h2>Make Payment</h2>
<button onClick={initializePayment}>Pay</button>
</div>
);
};

export default App;
```

### As Button Component

```jsx
import React, { Component } from "react";
import { SeerbitButton } from "seerbit-reactjs";

const App = () => {
const options = {
public_key: "YOUR_PUBLIC_KEY",
amount: 100,
tranref: new Date().getTime(),
currency: "NGN",
email: "test@mail.com",
full_name: "Sam Smart",
mobile_no: "081234566789",
description: "test",
tokenize: false,
planId: "",
pocketId: "",
vendorId: "",
customization: {
theme: {
border_color: "#000000",
background_color: "#004C64",
button_color: "#0084A0",
},
payment_method: ["card", "account", "transfer", "wallet", "ussd"],
display_fee: true, // true
display_type: "embed", //inline
logo: "logo_url | base64",
},
};

const close = (close) => {
console.log(close);
};
const callback = (response: any, closeCheckout: any) => {
console.log(response);

setTimeout(() => closeCheckout(), 2000);
};

const paymentProps = {
...options,
callback,
close,
};

checkProgress = (progress)=>{
console.log(progress)
}
render() {

return (
<SeerbitCheckout
className="btn seerbit-btn"
type='div'
tranref={this.state.tranref}
currency={"NGN"}
description={"shopping"}
country={"NG"}
public_key={this.state.public_key}
callback={this.callback}
close={this.close}
scriptStatus={this.checkProgress}
amount={this.state.amount}
tag={"button"}
full_name={"James Brown"}
email={"a@b.com"}
mobile_no={"00000000000"}
customization={this.state.customization}
version={"2"}//optional
title={'Pay with SeerBit'}
return (
<div>
<h2>Make Payment</h2>
<SeerbitButton
text="test payment"
className="app-btn"
split={{
type: "FLAT",
transactionFee: "SUB_ACCOUNT",
items: [
{ subAccountCode: "234332", subAccountName: "y6whs", value: 90 },
],
}}
{...paymentProps}
/>
);
}
}
</div>
);
};

export default App;
```

Please checkout <a href='https://doc.seerbit.com'>Seerbit Documentation</a> for other available options you can add to the tag
Expand Down
23 changes: 23 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
46 changes: 46 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
21 changes: 21 additions & 0 deletions example/craco.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const path = require('path');

module.exports = {
webpack: {
configure: (webpackConfig) => {
webpackConfig.resolve.plugins = webpackConfig.resolve.plugins.filter(
plugin => plugin.constructor.name !== 'ModuleScopePlugin'
);

webpackConfig.resolve.alias = {
...webpackConfig.resolve.alias,
react: path.resolve(__dirname, './node_modules/react'),
'react-dom': path.resolve(__dirname, './node_modules/react-dom'),
'react/jsx-runtime': path.resolve(__dirname, './node_modules/react/jsx-runtime'),
'react/jsx-dev-runtime': path.resolve(__dirname, './node_modules/react/jsx-dev-runtime'),
};

return webpackConfig;
},
},
};
Loading