Skip to content

kkiapay/kkiapay-react

Repository files navigation

kkiapay-react

Description

React hook for using kkiapay

Installation

npm i kkiapay-react

or

yarn add kkiapay-react

or

pnpm add kkiapay-react

How to use

import { useEffect } from 'react';

export default function Home() {
  const { openKkiapayWidget, addSuccessListener } = useKKiaPay();

  useEffect(() => {
    addSuccessListener(({ transactionId }: { transactionId: string }) => {
      console.log(transactionId, 'transactionId');
    });
  }, [addSuccessListener]);

  const open = () => {
    openKkiapayWidget({
      amount: 1,
      key: '3425dc6035d711eca8f5b92f2997955b',
      sandbox: true,
    });
  };

  return <button onClick={open}>Pay me</button>;
}

About

React hook for using kkiapay

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published