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

@tap-payments/click-to-pay-web

v1.6.3

Published

just for wrapping click to pay button to be used in react

Readme

@tap-payments/click-to-pay-web

A web SDK for integrating the Tap Click-to-Pay button into React applications or plain HTML pages.


Table of Contents


Installation

npm install @tap-payments/click-to-pay-web
# or
yarn add @tap-payments/click-to-pay-web

NPM / React Integration

import {
  ClickToPayButton,
  Locale,
  ThemeMode,
  Edges,
  ColorStyle,
  Scope,
} from "@tap-payments/click-to-pay-web";

function App() {
  return (
    <ClickToPayButton
      scope={Scope.CHARGE}
      operator={{
        publicKey: "pk_test_YOUR_KEY",
        hashstring: "",
      }}
      merchant={{ id: "YOUR_MERCHANT_ID" }}
      order={{ amount: 100, currency: "SAR" }}
      customer={{
        id: "cus_XXXXX",
        name: [{ lang: Locale.EN, first: "John", last: "Doe", middle: "" }],
        contact: {
          email: "[email protected]",
          phone: { countryCode: "+966", number: "500000000" },
        },
      }}
      interface={{
        locale: Locale.EN,
        edges: Edges.CURVED,
        theme: ThemeMode.LIGHT,
        colorStyle: ColorStyle.COLORED,
        loader: true,
      }}
      redirect={{ url: window.location.origin }}
      onReady={() => console.log("Ready")}
      onSuccess={(data) => console.log("Success", data)}
      onError={(err) => console.error("Error", err)}
    />
  );
}

Vanilla JS Integration

Include the built main.js and main.css from the standalone bundle and use the window.TapSDKs global.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Click To Pay</title>
    <link
      rel="stylesheet"
      href="https://cdn.tap.company/tap-sdks/click-to-pay/build-1.6.0/main.css"
    />
  </head>
  <body>
    <div id="click-to-pay-button"></div>

    <script
      type="module"
      src="https://cdn.tap.company/tap-sdks/click-to-pay/build-1.6.0/main.js"
    ></script>
    <script type="module">
      const { renderClickToPayButton } = window.TapSDKs;

      renderClickToPayButton(
        {
          scope: "CHARGE",
          operator: {
            publicKey: "pk_test_YOUR_KEY",
            hashstring: "",
          },
          merchant: { id: "YOUR_MERCHANT_ID" },
          order: { amount: 100, currency: "SAR" },
          customer: {
            id: "cus_XXXXX",
            name: [{ lang: "EN", first: "John", last: "Doe", middle: "" }],
            contact: {
              email: "[email protected]",
              phone: { countryCode: "+966", number: "500000000" },
            },
          },
          interface: {
            locale: "EN",
            edges: "CURVED",
            theme: "LIGHT",
            colorStyle: "COLORED",
            loader: true,
          },
          redirect: { url: window.location.origin },
          onReady: () => console.log("Ready"),
          onSuccess: (data) => console.log("Success", data),
          onError: (err) => console.error("Error", err),
        },
        "click-to-pay-button",
      );
    </script>
  </body>
</html>

Note: Must be served over HTTP. ES modules do not work when opened directly via file://.

renderClickToPayButton

const instance = window.TapSDKs.renderClickToPayButton(config, elementId);

// Unmount when done
instance.unmount();

| Parameter | Type | Description | | ----------- | -------- | ----------------------------------- | | config | object | Same props as the React component | | elementId | string | ID of the DOM element to mount into |


Configuration

Required Props

| Prop | Type | Description | | ---------- | -------- | -------------------------------------------------------------------------------- | | scope | Scope | Transaction scope (Scope.CHARGE, Scope.TOKEN, or Scope.CLICK_TO_PAY_TOKEN) | | operator | object | { publicKey: string, hashstring: string } | | merchant | object | { id: string } | | order | object | { amount: number, currency: string } | | customer | object | Customer details (see below) | | redirect | object | { url: string } — redirect URL after payment |

Customer Object

{
  id: string;
  name: Array<{
    lang: Locale;
    first: string;
    last: string;
    middle: string;
  }>;
  contact: {
    email: string;
    phone: {
      countryCode: string; // e.g. '+966'
      number: string;
    }
  }
}

Optional Props

| Prop | Type | Description | | ------------- | --------- | ------------------------------------------------------------------------------------ | | acceptance | object | { supportedSchemes?: string[] } — filter schemes (e.g. ['VISA']) | | features | object | Feature flags (see below) | | interface | object | UI configuration (see below) | | transaction | object | { amount: number, currency: string } — overrides order amount/currency for display | | styles | object | { layoutBackgroundColor?: string } | | debug | boolean | Enable debug logging in the console |

Features Object

{
  acceptanceBadge: boolean; // show accepted card schemes badge
  customerCards: {
    saveCard: boolean; // allow saving card for future use
    autoSaveCard: boolean; // auto-save card after successful payment
  }
}

Interface Object

{
  locale: Locale; // language
  edges: Edges; // button corner style
  theme: ThemeMode; // light or dark
  colorStyle: ColorStyle; // colored or monochrome
  loader: boolean; // show loading spinner
}

Callbacks

| Callback | Signature | Description | | ----------- | ---------------------- | ------------------------------------ | | onReady | () => void | Fired when the SDK is ready | | onClick | () => void | Fired when the pay button is clicked | | onSuccess | (data: any) => void | Fired on successful payment | | onError | (error: any) => void | Fired on payment error |


Enums

All enums are exported from the package and also available on window.TapSDKs in vanilla JS.

Scope

| Value | Description | | -------------------------- | ------------------------- | | Scope.CHARGE | Charge the card | | Scope.TOKEN | Tokenize the card | | Scope.CLICK_TO_PAY_TOKEN | Tokenize via Click to Pay |

Locale

| Value | Description | | ----------- | ----------- | | Locale.EN | English | | Locale.AR | Arabic |

ThemeMode

| Value | Description | | ----------------- | ----------- | | ThemeMode.LIGHT | Light theme | | ThemeMode.DARK | Dark theme |

Edges

| Value | Description | | -------------- | --------------- | | Edges.CURVED | Rounded corners | | Edges.SHARP | Sharp corners |

ColorStyle

| Value | Description | | ----------------------- | ----------- | | ColorStyle.COLORED | Full color | | ColorStyle.MONOCHROME | Monochrome |