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-interswitch-test

v1.0.0

Published

Made with create-react-library

Downloads

4

Readme

react-interswitch

Issues Forks Stars

Interswitch's official react package to easily integrate to Quickteller Business to recieve payments. To begin, create an account at https://business.quickteller.com if you haven't already.

Installation

To install, run:

npm install @interswitch/react-interswitch

Usage

Create your component like so:

import React from 'react'

import { Interswitch } from 'react-interswitch'

const App = () => {
  const paymentParameters = {
    merchantCode: 'XXXXXXX',
    payItemID: 'XXXXXXXXXXXX',
    customerEmail: '[email protected]',
    redirectURL: 'http://localhost:3000',
    text: 'Pay Now',
    mode: 'TEST',
    reference: Date.now().toString(),
    amount: '10000',
    style: {
        width: '200px',
        height: '40px',
        border: 'none',
        color: '#fff',
        backgroundColor: '#ff0000'
    },
    callback: (response) => {
      console.log('response: ', response)
    }
  }
  return <Interswitch {...paymentParameters} />
}

export default App

Note:

Parameters

Below is a list of all the supported parameters.

| Parameters | Data Type | Required | Description | |----------------------|---------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | merchantCode | string | true | This can be found on your dashboard. | payItemID | string | true | This can be found on your dashboard. | customerEmail | string | true | The email of the person making the payment. | | amount | string | true | The cost of the item being paid for in kobo. | | reference | string | true | This is a unique reference string required for every transaction. You can create a method to generate this. | | text | string | true | This represents the text on the payment button. | mode | string | true | This represents your integration mode. It can be 'TEST' or 'LIVE'. | callback | function | true | This function is called after every transaction. | redirectURL | string | false | The url you want the user to be redirected to after a transaction. | currency | string | false | The ISO code of the currency being used. If this field is not added, the currency naira is assumed. | | customerName | string | false | The name of the person making the payment. | | customerID | string | false | The ID of the person making the payment. | |payItemName | string | false | The name of the item being paid for. | | | | className | string | false | You can use this to add a CSS class to the payment button. | style | object | false | You can use this to add inline styles to the payment button.

After a transaction, a sample response from the callback function will be like so:

{
    amount: 10000,
    apprAmt: 10000,
    cardNum: "",
    desc: "Approved by Financial Institution",
    mac: "",
    payRef: "FBN|WEB|MX26070|13-04-2021|3512130|866194",
    resp: "00",
    retRef: "000106923853",
    txnref: "1618305656700",
    url: "http://localhost:3000",
}

NOTE: The key 'resp' gives the final status of the transaction.
There are quite a number of response codes that can be returned, the full list can be viewed here

- Handling the Response

For integrity purpose, you are advised to make a server side request to get the final status of a transaction before giving value. To do this, make a post request to the endpoint below:

Test mode:

https://qa.interswitchng.com/collections/api/v1/gettransaction.json?merchantcode={MERCHANT_CODE}&transactionreference={TRANSACTION_REFERENCE}&amount={AMOUNT_IN_KOBO}

Live mode:

https://webpay.interswitchng.com/collections/api/v1/gettransaction.json?merchantcode={MERCHANT_CODE}&transactionreference={TRANSACTION_REFERENCE}&amount={AMOUNT_IN_KOBO}

License

The MIT License (MIT). Please see License File for more information.