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

@xmoney/xmoney-js

v0.0.2

Published

Load the xMoney Checkout browser SDK and its TypeScript types

Readme

@xmoney/xmoney-js

Loads the xMoney Checkout browser script and exports TypeScript types for every public factory, config, event, and instance method.

This package does not reimplement checkout. loadXMoney() injects xmoney.js, which sets window.XMoney. Live and stage are chosen by the script from each widget's publicKey.

This package loads /sdk/v2/xmoney.js. A new script API is a new major of this package.

Install

npm install @xmoney/xmoney-js

Usage

import { loadXMoney } from '@xmoney/xmoney-js';

const xmoney = await loadXMoney();

A second call reuses the same promise. Pass a CSP nonce when the page requires one:

const xmoney = await loadXMoney({ nonce });

Every factory takes publicKey, orderPayload, and orderChecksum. paymentForm, paymentCard, applePay, and googlePay also take a container.

paymentForm

const form = await xmoney.paymentForm({
  container: document.getElementById('checkout')!,
  publicKey,
  orderPayload,
  orderChecksum,
  paymentMethods: {
    applePay: { enabled: true, appearance: { type: 'pay', style: 'black' } },
    googlePay: { enabled: true, appearance: { type: 'pay', color: 'black' } },
  },
  onPaymentComplete(transaction) {
    console.log(transaction.id);
  },
});

const validation = await form.validate();
if (validation.isValid) form.submit();

await form.updateOrder({ orderPayload: nextPayload, orderChecksum: nextChecksum });
form.updateLocale('ro-RO');
form.updateAppearance({ theme: 'dark' });
form.destroy();

paymentCard

Card fields with your own Pay button. validate, submit, updateOrder, updateLocale, updateAppearance, and destroy match paymentForm.

const card = await xmoney.paymentCard({
  container: document.getElementById('card')!,
  publicKey,
  orderPayload,
  orderChecksum,
  card: { submitButton: { visible: false } },
  onPaymentComplete(transaction) {
    console.log(transaction.id);
  },
});

await card.validate();
card.submit();

Customer details

paymentForm and paymentCard take customerDetails. fields replaces the server field list: a missing key counts as false. defaultValues prefills the card form. country is an ISO 3166-1 alpha-2 code, phone is E.164 and starts with +, and region is a subdivision name for that country. Values for inactive blocks are ignored. Standalone applePay and googlePay accept fields and their own collection flag.

customerDetails: {
  card: true,
  fields: { fullName: true, email: true, phone: true, address: true },
  defaultValues: {
    fullName: 'Ada Lovelace',
    email: '[email protected]',
    phone: '+40722123456',
    country: 'RO',
    region: 'București',
    city: 'Bucharest',
    postalCode: '010101',
    address: '1 Example Street',
  },
},

applePay

updateOrder and destroy match paymentForm. Check getPaymentMethodCapabilities before mounting.

const applePay = await xmoney.applePay({
  container: document.getElementById('apple-pay')!,
  publicKey,
  orderPayload,
  orderChecksum,
  options: { appearance: { type: 'pay', style: 'black' } },
  onPaymentComplete(transaction) {
    console.log(transaction.id);
  },
});

await applePay.updateOrder({ orderPayload: nextPayload, orderChecksum: nextChecksum });
applePay.destroy();

googlePay

updateOrder and destroy match paymentForm.

const googlePay = await xmoney.googlePay({
  container: document.getElementById('google-pay')!,
  publicKey,
  orderPayload,
  orderChecksum,
  options: { appearance: { type: 'pay', color: 'black' } },
  onPaymentComplete(transaction) {
    console.log(transaction.id);
  },
});

await googlePay.updateOrder({ orderPayload: nextPayload, orderChecksum: nextChecksum });
googlePay.destroy();

savedCardPayment

No container. Your page lists the saved cards and calls pay. updateOrder and destroy match paymentForm.

const saved = await xmoney.savedCardPayment({
  publicKey,
  orderPayload,
  orderChecksum,
  onPaymentComplete(transaction) {
    console.log(transaction.id);
  },
});

saved.pay({ cardId });

getPaymentMethodCapabilities

const { applePay, googlePay } = await xmoney.getPaymentMethodCapabilities({ timeout: 3000 });

console.log(applePay.supported, applePay.reason);
console.log(googlePay.supported, googlePay.reason);