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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-atlas-pay

v1.0.14

Published

Raven Atlas Payment React library

Downloads

118

Readme

React Atlas Pay Library by Raven

NPM version Build npm-typescript github-license

React Atlas Pay by Raven bank allows you recieve payments and build powerful checkout experience on your react web apps, to use this you will need to create an account on raven atlas, visit, "Raven bank" for more.

Live Demo

✨ Features

  • Card Payments. (Visa, MasterCard)
  • USSD Payment.
  • Bank Transfers.
  • Pay with Raven.

Installation:

npm install react-atlas-pay

or

```bash
yarn add react-atlas-pay

Usage :

React Atlas Pay Uses normal react Conventions and Exposes for you a useAtlasPay Hook, below is an example usage

import { useEffect, useState } from 'react'
import useAtlasPay from 'react-atlas-pay'

export default function App() {
  const [pay, atlasEvent] = useAtlasPay()

  // The useAtlasPay hook works similar to react useState, you can call the pay or atlasEvent handler anything you wish

  const config = {
    customer_email: '[email protected]',
    description: 'test payment',
    merchant_ref: 'your_merchant_reference',
    amount: 100,
    redirect_url: '',
    payment_methods: 'card,bank_transfer,ussd,raven',
    public_key: 'your_atlas_public_key'
  }

  /**
   *  The atlasPayEvent returns and changes value based on actions carried on , on your payment window.
   *  i.e onSuccess, onLoad and onClose - this are the events you can watch for using the atlasEvent hook
   * */

  // you might want to wrap it in a useEffect to carry out action anytime the event fires

  useEffect(() => {
    if (atlasEvent.type === 'onClose') {
      // do something here if user closes the window
    }

    if (atlasEvent.type === 'onLoad') {
      // do something here if the payment window gets loaded
    }

    if (atlasEvent.type === 'onSuccess') {
      // do something here if the payment was successful i.e you can forcefully shutdown the payment window on successful payment, by default the payment window remains open on successful payment

      pay({ shutdown: true })
    }
  }, [atlasEvent])

  return (
    <div
      onClick={() => {
        pay(config)
      }}
      className=""
    >
      Pay Button
      {/* Clicking on this button will generate a payment request and initializes the payment window */}
    </div>
  )
}

If you don't need to generate a new payment request, 'i.e already have a payment reference', you can initialize the payment window directly py parsing the trx_ref as shown below.

<div
  onClick={() => {
    pay({ trx_ref: 'your_payment_reference' })
  }}
  className=""
>
  {/* Clicking on this button will generate a payment request and initializes the payment window */}
</div>

React Atlas Pay Library can also be used in a NextJS Environment but requires extra configuration, AtlasPay offers AtlasNext which is NextJS Wrapper for AtlasPay to make use of this you need to call it either within your _app.tsx or _document.tsx this can be found in your nextjs src folder, below is an example usage;


import { Manrope } from "@next/font/google";
import type { AppProps } from "next/app";
import Head from "next/head";
import {AtlasNext} from "react-atlas-pay";

const manrope = Manrope({ subsets: ["latin"] });

export default function App({ Component, pageProps }: AppProps) {

  return (
    <>
      <Head>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
      </Head>

            <main className={manrope.className}>
              <Component {...props.pageProps} />
            </main>

      <AtlasNext/>  {/* Here we instantiate the AtlasNext Wrapper */}
  );
}

License

AtlasPay by Raven bank is licensed under the MIT