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

@spring-payments/payments-vue

v0.1.0

Published

Unstyled Vue components for Spring Payments

Readme

Spring Payments for Vue

Unstyled Vue 3.5 components over @spring-payments/payments-js. Payment, processor, polling, and modal behavior stay in core. Vue owns only the host or trigger. Supports Vue >=3.5 <4, SSR and Nuxt; there is no browser access on import or server render. No plugin installation or injected CSS is required.

Vue 3.5 is the current stable line, not a separate Vue LTS edition.

npm install @spring-payments/payments-vue

Add-card dialog (Vue SFC, TypeScript)

<script setup lang="ts">
import { ref } from 'vue';
import { SpringAddCardButton } from '@spring-payments/payments-vue';
import type { ComponentOptions, CardResult } from '@spring-payments/payments-vue';

defineProps<{ customerId: string }>();
const scope = ref<HTMLElement>();
const createSession: ComponentOptions['createSession'] = async (request) => {
  const response = await fetch('/api/card-session', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    credentials: 'same-origin',
    cache: 'no-store',
    body: JSON.stringify(request),
  });
  if (!response.ok) throw new Error('Unable to start card saving');
  return response.json();
};
function handleResult(result: CardResult) {
  if (result.status === 'COMPLETED') console.log(result.paymentAccountId);
  // PENDING is not success. Refresh authoritative status through your backend.
}
</script>

<template>
  <div ref="scope" class="card-area">
    <SpringAddCardButton
      :key="customerId"
      :create-session="createSession"
      :dialog-container="scope"
      class="my-card-button"
      @result="handleResult"
    >Add a card</SpringAddCardButton>
  </div>
</template>

The server endpoint must authenticate the signed-in user, authorize their Spring customer mapping, validate the requested same-origin clean return URL, and create an ADD_CARD component session through Spring using server-only credentials. Return { sessionId, sessionToken, expiresAt, componentUrl } (expiry ISO timestamp). Never trust a browser-supplied customer ID as authorization. Never return partner API credentials or Stripe client secrets; never log/persist session tokens. Use your application's CSRF protection for this authenticated POST.

Inline card saving

<script setup lang="ts">
import { SpringAddCard } from '@spring-payments/payments-vue';
import type { ComponentOptions } from '@spring-payments/payments-vue';
defineProps<{ customerId: string; createSession: ComponentOptions['createSession'] }>();
</script>

<template>
  <SpringAddCard
    :key="customerId"
    :create-session="createSession"
    :labels="{ confirm: 'Save card' }"
    @success="state => console.log(state.paymentAccountId)"
    @error="error => console.warn(error.code)"
  />
</template>

Props, events, and lifecycle

Both accept core createSession (required), returnUrl, appearance, labels, maxPolls, and pollIntervalMs. The button also accepts dialogContainer and disabled. The default slot replaces its label; otherwise labels.button or “Add debit or credit card” is used. Attributes/classes/listeners fall through to the button or inline host. Button type is always button, with aria-haspopup="dialog" and class spring-card-trigger. The button is disabled and reports aria-busy while its dialog is open. An application click listener can prevent opening with event.preventDefault().

Core callback props become typed Vue events: stateChange (ComponentState), success (ComponentState), error (ComponentError), and submissionAttempt (no payload). Use @state-change, @success, @error, @submission-attempt in templates. The dialog button additionally emits result (CardResult): COMPLETED with paymentAccountId, or PENDING/CANCELLED/FAILED. Inline does not emit result.

Configuration (including the selected session factory and copied appearance and labels) is snapshotted on button click or inline mount. Inline mounts once per lifecycle; there is no deep watcher restarting payments. Listener changes take effect immediately without restarting an operation. Button configuration changes apply to the next action, never the active dialog. Repeated clicks while active do not start duplicate operations. Core allows one dialog per document; do not open competing triggers for different customers simultaneously.

Unmount destroys the inline view or closes the active presentation and suppresses late events. To change inline configuration, deliberately change a Vue :key to remount. Always key by signed-in customer identity so sign-out/customer changes cannot retain a prior customer's session. Key-remount cancels/closes the previous UI; it does not undo a card save or payment already submitted. Check the result through your backend after an interruption. Do not use frequently changing objects or render counters as keys. SSR renders an empty inline <div>; mounting starts only in the browser. Nuxt can import normally without a client-only plugin.

Styling

No stylesheet is included. Style .spring-card-trigger, .spring-card-dialog, .spring-card-close, .spring-card-title, .spring-card-description, .spring-card-content, and .spring-payment-component globally. Core-created nodes do not receive Vue SFC scope attributes: use global CSS or a scoped ancestor with :deep(.spring-card-dialog) / :deep(.spring-payment-component). A dialog defaults to document.body, outside your scoped ancestor; pass dialogContainer inside that ancestor as above to scope your rules. Processor iframe contents must be customized through core's appearance, not parent CSS.

Development and release

Tests pin Vue and server renderer 3.5.44. Development tooling requires Node 22.12+, 24+, or 26+ (Vitest 5). Build core 0.2.0 first, then run here:

npm ci
npm run build
npm test
npm pack --dry-run

The local file devDependency supports development before core publication; the runtime dependency remains ^0.2.0. Tests cover rendered wrapper behavior using the real core with fetch/Stripe stubs, plus SSR imports and rendering; they make no financial/network calls. Before release validate packed packages in a clean consumer against published core 0.2.0, including Nuxt/SSR. Publish core first, then review the Vue tarball and publish Vue 0.1.0 using your approved npm release workflow. prepack builds ESM and declarations; Vue and core remain external imports, not bundled. Do not publish a tarball containing source or node_modules. License: MIT.