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

@ionicfi/js

v0.2.2

Published

Ionic browser payment SDK loader. Loads the Ionic SDK from https://js.ionicfi.com so card handling is never bundled into your app.

Readme

@ionicfi/js

Browser SDK loader for Ionic payments. It loads the Ionic SDK from https://js.ionicfi.com so card entry stays inside Ionic-hosted iframes and never enters your application bundle.

Install

npm install @ionicfi/js

Ionic Blocks

Use Blocks when your application owns the payment page and Pay button. Your server creates a PaymentIntent and returns its client secret with your publishable key.

import { loadIonic } from "@ionicfi/js";

const ionic = await loadIonic("pk_v1_test_...");
const blocks = ionic.blocks({ clientSecret: "pi_..._secret_..." });
await blocks.create("payment").mount("#payment");
// In your Pay handler:
const result = await ionic.confirmPayment({ blocks });

Use confirmSetup with a SetupIntent to save a card without charging. For Connect, pass { account: connectedMerchantId } to loadIonic and create the intent for the same merchant on your server. Call blocks.destroy() when the view unmounts.

See Build a payment page and How Connect works for complete walkthroughs.

Loading and errors

loadIonic and loadIonicCheckout share one script load. Loading rejects after 30 seconds or on a script error. Call again to retry. If you supplied a script tag yourself, remove or replace a failed tag before retrying. A conflicting window.Ionic value must be removed or renamed before loading. This includes unrelated functions; an existing v1 SDK factory is recognized by its original checkout helpers, including bundles from before session helpers were added.

For tokenization-only integrations using mountPaymentFields, catch errors with isPaymentFieldsError(error). PaymentFieldsError is a TypeScript type; use the guard instead of constructing it or checking instanceof:

import { isPaymentFieldsError } from "@ionicfi/js";

try {
  await fields.tokenize();
} catch (error) {
  if (isPaymentFieldsError(error)) {
    console.error(error.code, error.message);
    // If error.terminal is true, obtain a fresh session and mount again.
  } else {
    throw error;
  }
}

Module format

This package ships ES modules. CommonJS applications can use require() on Node 20.19+ or 22.12+, or dynamic import() on older Node versions. Jest setups using CommonJS transforms must also transform the Ionic packages; an export fallback alone does not transform ES modules.

Embedded checkout

Create a checkout session on your server with ui_mode: "embedded", return it to your frontend, and mount it. Include an element with id="payment-message" and role="status" next to the checkout for messages:

import { loadIonicCheckout } from "@ionicfi/js";

const IonicCheckout = await loadIonicCheckout();

const checkout = IonicCheckout.mountSession("#checkout", {
  session,
  onComplete: ({ sessionId }) => {
    window.location.href = `/success?session_id=${encodeURIComponent(sessionId)}`;
  },
  onError: (error) => {
    const message = document.querySelector("#payment-message");
    if (message) message.textContent = error.message;
  },
});

// When the host view unmounts:
checkout.destroy();

The SDK reads id, client_secret, and embed_url from the session your backend returns. It keeps the client secret out of the iframe URL and sends it only after the checkout document reports that it is ready.

Apple Pay

Pass applePay: true to render an Apple Pay button above the card form:

const checkout = IonicCheckout.mountSession("#checkout", {
  session,
  applePay: true,
});

The button renders in your page rather than inside the iframe, because Apple validates the top-level page's domain when the payment sheet opens. It stays hidden, with no layout impact, until the session supports Apple Pay on the current device.

Apple Pay requires your domain to be registered with Ionic, HTTPS on the page and every ancestor frame, and Safari 17 or later for cross-origin iframe checkouts. If your page sets a Content-Security-Policy, see the integration guide for the entries to allow.

Script tag

The SDK is also available without a bundler:

<script src="https://js.ionicfi.com/v1/ionic.js"></script>
<script>
  const checkout = window.Ionic.IonicCheckout.mountSession("#checkout", {
    session,
  });
</script>

Versioning

0.x releases may introduce breaking changes without a major version bump.

License

MIT