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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ezetap-razorpay-pos

v1.0.33

Published

A simple React hook for integrating Razorpay POS (Ezetap) payments in your React apps. Handles payment initiation, status polling, and cancellation with a single hook.

Readme

ezetap-razorpay-pos

A simple React hook for integrating Razorpay POS (Ezetap) payments in your React apps. Handles payment initiation, status polling, and cancellation with a single hook.

🚀 Features

  • Easy Integration: Just use the useRazorpayPOS hook.
  • Status Tracking: Get real-time payment status (processing, waiting, success, error, etc.).
  • Cancellation: Cancel pending payments with one function.
  • TypeScript Support: Fully typed for maximum safety.
  • Custom Endpoints: Use your own test/live endpoints if needed.

🛠️ Installation

npm install ezetap-razorpay-pos

or

yarn add ezetap-razorpay-pos

💬 Usage


import React, { useState } from "react";
import { useRazorpayPOS } from "ezetap-razorpay-pos";

const initialConfig = {
  testMode: true,
  apiKey: "YOUR_API_KEY",
  username: "YOUR_USERNAME",
  terminalId: "YOUR_TERMINAL_ID",
  allowedPaymentModes: "ALL",
};

export default function MyPaymentComponent() {
  const [amount, setAmount] = useState(100);
  const { status, error, result, sendPaymentRequest, cancelPayment } = useRazorpayPOS(initialConfig);

  return (
    <div>
      <input
        type="number"
        value={amount}
        onChange={e => setAmount(Number(e.target.value))}
        placeholder="Amount"
      />
      <button onClick={() => sendPaymentRequest(amount)}>Start Payment</button>
      {status && <div>Status: {status}</div>}
      {error && <div>Error: {error}</div>}
      {result && <pre>{JSON.stringify(result, null, 2)}</pre>}
      <button onClick={cancelPayment}>Cancel Payment</button>
    </div>
  );
}

🧩 Configuration

Pass a config object to the hook with these options:

| Name | Type | Required | Default | Description | | :-- | :-- | :-- | :-- | :-- | | testMode | boolean | No | true | Use test or live mode | | apiKey | string | Yes | | Your Razorpay API key | | username | string | Yes | | Your Razorpay username | | terminalId | string | Yes | | Your POS terminal ID | | allowedPaymentModes | string | No | "CASH" \| "CARD" \| "UPI" \| "BHARATQR" \| "ALL" | Allowed payment modes (comma-separated) | | testEndpoint | string | No | | Custom test endpoint URL | | liveEndpoint | string | No | | Custom live endpoint URL |

🧑‍💻 Hook API

The hook returns:

  • status: 'idle' | 'processing' | 'waiting' | 'success' | 'error' | 'force_done'
  • error: error message (if any)
  • result: full Razorpay response (on success)
  • sendPaymentRequest(amount: number): Start a payment
  • cancelPayment(): Cancel the current payment

📄 Types

RazorpayPosConfig

interface RazorpayPosConfig {
  testMode?: boolean;
  apiKey: string;
  username: string;
  terminalId: string;
  allowedPaymentModes?: string;
  testEndpoint?: string;
  liveEndpoint?: string;
}

RazorpayResponse

interface RazorpayResponse {
  success?: boolean;
  errorCode?: string;
  p2pRequestId?: string;
  status?: string;
  authCode?: string;
  cardLastFourDigit?: string;
  externalRefNumber?: string;
  reverseReferenceNumber?: string;
  txnId?: string;
  paymentMode?: string;
  paymentCardType?: string;
  paymentCardBrand?: string;
  nameOnCard?: string;
  acquirerCode?: string;
  createdTime?: string;
  messageCode?: string;
  errorMessage?: string;
  message?: string;
}

🖥️ Compatibility

  • Razorpay POS Terminal:
    Fully supported for seamless payment initiation, status polling, and cancellation.

  • Kotak POS Terminal:
    Compatible and tested for all major payment flows.

Note: This hook is designed to work with both Razorpay and Kotak POS terminals, ensuring flexibility for merchants using either device.

📢 Support & Contributing

  • Issues and PRs are welcome!
  • For questions, please open an issue on GitHub.

📜 License

MIT