npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-monnify-sdk

v1.0.3

Published

This is an reactJS library for implementing Monnify payment gateway

Downloads

13

Readme

react-monnify-sdk

This is a react library for implementing Monnify payment gateway

Get Started

This React library provides a wrapper to add Monnify Payments to your React application

Install

npm install react-monnify-sdk --save

or with yarn

yarn add react-monnify-sdk

Usage

This library can be implemented into any react application in 3 different ways:

  1. By using a imperative forward component,
  2. Hooks provided by the library, and
  3. button.

Note that The implementations produce the same results.

1. Using the imperative Monnify forward component

import React, { useRef } from 'react';
import {
	IMonnifyCallbacks,
	IMonnifyConfig,
	IMonnifySuccessResponse,
	MonnifyCheckout,
	MonnifyForwardRef,
} from 'react-monnify-sdk';
import './App.css';

function App() {
	const monnifyRef = useRef<MonnifyForwardRef>(null);
	const configs: IMonnifyConfig = {
		apiKey: 'MK_TEST_........',
		contractCode: '1234567890',
		mode: 'TEST', // TEST or LIVE
	};

	const callbacks: IMonnifyCallbacks = {
		onClose: (data) => {
			//Implement what should happen when the modal is closed here
			console.log('Payment Close => ', data);
		},
		onComplete: (response: IMonnifySuccessResponse) => {
			//Implement what happens when the transaction is completed.
			console.log('Payment Completed => ', response);
		},
		onLoadComplete: () => {
			console.log('SDK is UP');
		},
		onLoadStart: () => {
			console.log('loading has started');
		},
	};

	const handleInitializePayment = () => {
		monnifyRef.current?.initialize({
			amount: 500,
			customerFullName: 'Emmanuel Tochukwu',
			customerEmail: '[email protected]',
			paymentMethods: ['ACCOUNT_TRANSFER'],
			reference: '123456789',
			paymentDescription: 'Testing payment description',
			currency: 'NGN',
		});
	};

	return (
		<div>
			<MonnifyCheckout
				ref={monnifyRef}
				config={configs}
				callbacks={callbacks}
			/>
			<button onClick={handleInitializePayment}>MAKE PAYMENT</button>

			{/* children */}
		</div>
	);
}

export default App;

2. Using the monnify hook

import {
IMonnifyCallbacks,
IMonnifyConfig,
IMonnifySuccessResponse,
useMonnifyCheckout,
} from 'react-monnify-sdk';
import './App.css';

function App() {
const configs: IMonnifyConfig = {
apiKey: 'MK*TEST*........',
contractCode: '1234567890',
mode: 'TEST', // TEST or LIVE
};

    const callbacks: IMonnifyCallbacks = {
    	onClose: (data) => {
    		//Implement what should happen when the modal is closed here
    		console.log('Payment Close => ', data);
    	},
    	onComplete: (response: IMonnifySuccessResponse) => {
    		//Implement what happens when the transaction is completed.
    		console.log('Payment Completed => ', response);
    	},
    	onLoadComplete: () => {
    		console.log('SDK is UP');
    	},
    	onLoadStart: () => {
    		console.log('loading has started');
    	},
    };

    const { initialize } = useMonnifyCheckout({
    	configs,
    	callbacks,
    });

    return (
    	<div>
    		<button
    			onClick={() => {
    				initialize({
    					amount: 500,
    					customerFullName: 'Emmanuel Tochukwu',
    					customerEmail: '[email protected]',
    					paymentMethods: ['ACCOUNT_TRANSFER'],
    					reference: '123456789',
    					paymentDescription: 'Testing payment description',
    					currency: 'NGN',
    				});
    			}}
    		>
    			MAKE PAYMENT
    		</button>

    		{/* children */}
    	</div>
    );

}

export default App;

2. Using the Monnify button

import { IMonnifySuccessResponse, MonnifyButton } from 'react-monnify-sdk';
import './App.css';

function App() {
	return (
		<MonnifyButton
			apiKey='MK_TEST_........'
			amount={500}
			customerEmail='[email protected]'
			contractCode='1234567890'
			paymentMethods={['ACCOUNT_TRANSFER']}
			customerFullName='Emmanuel Tochukwu'
			reference='123456789'
			paymentDescription='Testing payment description'
			currency='NGN'
			onClose={(data) => {
				//Implement what should happen when the modal is closed here
				console.log('Payment Close => ', data);
			}}
			onComplete={(response: IMonnifySuccessResponse) => {
				//Implement what happens when the transaction is completed.
				console.log('Payment Completed => ', response);
			}}
			onLoadComplete={() => {
				console.log('SDK is UP');
			}}
			onLoadStart={() => {
				console.log('loading has started');
			}}
		>
				MAKE PAYMENT
		</MonnifyButton>
	);
}

export default App;

If you want to style Monnify button, you have the option to use className or style

Props

Common props you may want to specify include:

  • amount (Float(required)) :- The amount(in Naira) to be paid, minimum is N20
  • customerName (String(required)) :- The name of the customer
  • customerEmail (String(required)) :- The customer email
  • paymentReference String(required) :- A unique string of characters that identifies each transaction
  • paymentDescription (String(required)) :- A description of the payment
  • currencyCode (String) - The currency code
  • contractCode String(required) :- The merchant contract code
  • paymentMethods (String) :- The method of payment collection, one of CARD, ACCOUNT_TRANSFER, USSD, or PHONE_NUMBER, default to CARD and ACCOUNT_TRANSFER
  • incomeSplitConfig List<IncomeSplitConfig> :- A way to split payments among subAccounts. IncomeSplitConfig { String subAccountCode; Float feePercentage; Float splitPercentage; Float splitAmount; Boolean feeBearer; }
  • metaData Map<String,Object> :- This field can be used to pass extra information from customers

Please checkout monnify Documentation for other available options you can add to the tag

Methods

  • onLoadStart: () => void;
  • onLoadComplete: () => void;
  • onComplete: (response: IMonnifySuccessResponse) => void;
  • onClose: (data) => void;

Thanks

Why not give the GitHub repo a star? I'd really appreciate the attention! Also, feel free to share the repository link on Twitter or any social media platform. Let's spread the word!

If you like React Monnify SDK, you should follow me on X, and LinkedIn!

Thanks! Emmanuel Tochukwu.

License

This project is licensed under the MIT License - see the LICENSE.md file for details