rave-simple
    TypeScript icon, indicating that this package has built-in type declarations

    0.0.2 • Public • Published

    rave-simple

    rave-simple bundle size MIT NPM

    <1kb Framework/Library agnostic rave wrapper

    INSTALLATION

    npm install rave-simple
    

    USAGE

    Basic Usage

    import rave from "rave-simple";
     
    const rave = Rave();
     
    rave.addOptions({
      PBFPubKey: 'PBFPubKey-xxxx-xxxx',
      customer_email: 'mail@example.com',
      customer_phone: '0810987655432',
      amount: 150000,
      txref: `REF-${(Math.random() * 10000).toFixed()}`,
      callback: () => {
        r.close();
      },
    });
     
    rave.pay();

    Test Environment

    import rave from "rave-simple";
     
    const rave = Rave({ test: true }); // Uses rave's test script
     
    rave.addOptions({
      PBFPubKey: 'PBFPubKey-xxxx-xxxx',
      customer_email: 'mail@example.com',
      customer_phone: '0810987655432',
      amount: 150000,
      txref: `REF-${(Math.random() * 10000).toFixed()}`,
      callback: () => {
        r.close();
      },
    });
     
    rave.pay();

    Set GlobalConfig

    import Rave, { setGlobalConfig } from "rave-simple";
     
    setGlobalConfig({ PBFPubKey: 'PBFPubKey-xxxx-xxxx' }) // Key has been set globally
     
    const paymentInstance = Rave();
     
    paymentInstance.addOptions({ // No need to add it here
      amount: 5000,
      customer_email: 'mail@example.com',
      customer_phone: '0810987655432',
      callback: (res) => {
        paymentInstance.close()
        // act on response
      }
    })
     
    paymentInstance.pay() // Pay

    What's Cool?

    • Less than 1kb
    • Framework/Library agnostic
    • Simple API
    • Intellisense support

    Install

    npm i rave-simple

    DownloadsWeekly Downloads

    2

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    9.25 kB

    Total Files

    10

    Last publish

    Collaborators

    • ashinzekene