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

@billmyagent/payments-vue

v2.1.2

Published

Vue composable + button for paying x402-gated APIs (viem signer)

Readme

@billmyagent/payments-vue

Vue 3 composable and component for the x402 payment protocol.

A thin wrapper around @billmyagent/payments-core that lets Vue apps call x402-gated URLs and automatically pay the HTTP 402 challenge when one is returned (the core client signs an EIP-3009 transferWithAuthorization and the facilitator settles it on-chain):

  • <PaymentButton> — drop-in button that calls a URL and pays the 402, with built-in loading and error states
  • usePayment() — composable for calling an x402-gated URL imperatively and tracking the request lifecycle

Install

npm install @billmyagent/payments-vue @billmyagent/payments-core

Peer dependency: Vue >=3.0.0.

Quick start

Build a PaymentClient with a signer. In a browser, pass a viem wallet client backed by the user's wallet; on a server/agent, build one from a private key with createSigner (never ship a real key to a browser).

Drop-in button

<script setup lang="ts">
import { PaymentButton, PaymentClient, createSigner } from '@billmyagent/payments-vue';

const signer = await createSigner('base', import.meta.env.VITE_PRIVATE_KEY);
const client = new PaymentClient({ signer });
</script>

<template>
  <PaymentButton
    :client="client"
    url="https://api.example.com/premium-article"
    label="Read article"
    :onSuccess="(data) => console.log('unlocked:', data)"
    :onError="(err) => console.error(err)"
  />
</template>

Imperative composable

<script setup lang="ts">
import { usePayment } from '@billmyagent/payments-vue';

const { pay, data, loading, error, paid } = usePayment(client);
</script>

<template>
  <button :disabled="loading" @click="pay('https://api.example.com/premium')">
    {{ loading ? 'Loading…' : 'Load premium' }}
  </button>
  <p v-if="error">Error: {{ error.message }}</p>
  <p v-else-if="data">Loaded{{ paid ? ' (paid)' : '' }}: {{ data }}</p>
</template>

API

<PaymentButton> props

| prop | type | required | notes | |---|---|---|---| | client | PaymentClient | yes | instance created with a signer | | url | string | yes | the x402-gated URL to call (and pay, if challenged) | | requestConfig | AxiosRequestConfig | no | method, headers, body, params | | label | string | no | button label; defaults to "Pay" | | onSuccess | (data: unknown) => void | no | | | onError | (error: Error) => void | no | |

usePayment(client)

Returns { data, loading, error, paid, pay, reset } as refs/functions:

  • pay(url, config?) — call an x402-gated URL; if it responds 402 and the client has a signer, the payment is made and the request retried. Resolves with the body.
  • paidtrue when the most recent call required and completed a payment.
  • reset() — clear data, error, and paid.

For merchant account operations and the payment REST API, use the PaymentClient methods directly — see @billmyagent/payments-core.

Supported networks

EVM only, exact scheme: Base, Ethereum, Polygon.

Development

# from sdk/vue/
npm install
npm test
npm run build

License

Apache 2.0 — see LICENSE.