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

flutterwave-rn-pos

v0.2.0

Published

Flutterwave POS React Native SDK

Downloads

4

Readme

Flutterwave React Native POS SDK

Flutterwave POS React Native SDK is the official library that makes it easier to carry out transaction related actions on pos terminals

Table of Contents

Installation

npm install flutterwave-rn-pos

or

yarn add flutterwave-rn-pos

Usage

Import the methods you want to use from the package in your JavaScript/TypeScript code:

import {
  performKeyExchange,
  performTransaction,
  printReceipt,
  performReprintAndEOD,
  viewTransactionHistory,
} from 'flutterwave-rn-pos';

// key exchange

// ...

const result = await performTransaction(
  200,
  false,
  ['CARD', 'TRANSFER'],
  '3.2.1'
);

Key Exchange

A key exchange is done to get the terminal parameters. This should be performed upon launch of your application before you start making transactions. To do this, follow the steps below:

const ParameterResponse = await performKeyExchange(
  'Flutterwave',
  'https://flutterwave.com/waveLogo.png'
);

The merchantName represents a unique identifier for your business and customLogoUrl is an optional parameter for your custom logo.

Transactions

To perform a transaction, you'll need the following parameters

Amount shouldPrint transactionTypes and AppVersion

🚨 Note: The possible values for Transaction Types include: ‘CARD’, ‘TRANSFER’, ‘USSD’, ‘MOMO’, and ‘QR’.

const transactionResponse = await performTransaction(
  200, // Amount
  false, // Should Print
  ['CARD', 'TRANSFER'], // Transaction Types
  '3.2.1' // App Version
);

Once the function is launched, the POS will take over and complete the card processing flow. When this is completed, the transaction details are returned as a json string.

Printing

To print a receipt, design your receipt such that each line represents an instance of the PrintField object. Add each line as a print field to a array. To do this, follow the steps below:

const printResponse = await printReceipt([
  {
    header: 'Flutterwave',
    alignment: 'center',
    textSize: 40,
    bold: true,
  },
  {
    header: 'RRN',
    body: '1234567890',
    bold: false,
    alignment: 'left',
    textSize: 30,
  },
  {
    header: 'Amount',
    body: '100.0',
    bold: true,
    alignment: 'center',
    textSize: 30,
  },
]);

When the terminal completes the printing process, A response is returned as a callback contain a json with the same pattern as the TransactionResponse but with the data field set to null.

Reprint And EOD

To reprint transactions and perform end of day actions, follow the steps below:

const reprint = await performReprintAndEOD();

The POS will take over and complete the process once the function is launched.

TRANSACTION HISTORY

To view all transactions that have been made on the POS device, follow the steps below:

const launchHistory = await viewTransactionHistory();

The POS will take over and complete the process once the function is launched.

Support

For additional assistance using this library, contact the developer experience (DX) team via email or on slack.

You can also follow us @FlutterwaveEng and let us know what you think 😊.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


By contributing to the {{language}} library, you agree that your contributions will be licensed under its MIT license.

Copyright (c) Flutterwave Inc.