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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@tender-cash/agent-sdk-vue

v0.1.9

Published

Vue SDK for Tender Cash Agent

Readme

@tender-cash/agent-sdk-vue

npm version License: MIT

Vue 3 component library for integrating the Tender Cash Agent payment flow into your application.

Installation

yarn add @tender-cash/agent-sdk-vue
# or
npm install @tender-cash/agent-sdk-vue

Usage

1. Import CSS

The SDK requires its base styles. Import the CSS file in your main application entry point (e.g., main.ts or main.js):

// src/main.ts
import { createApp } from 'vue'
import App from './App.vue'

// Import SDK styles
import "@tender-cash/agent-sdk-vue/dist/style.css"; 

createApp(App).mount('#app')

2. Use the Component

Import the TenderAgentSdk component and the relevant types into your Vue component.

<template>
  <div>
    <h1>Checkout</h1>
    <!-- Conditionally render SDK or trigger button -->
    <button 
      v-if="!showSdk" 
      @click="showSdk = true" 
      :disabled="!isValidConfig"
      class="pay-button"
    >
      Proceed to Pay ${{ amount }} {{ fiatCurrency }}
    </button>

    <div v-if="showSdk" class="sdk-wrapper">
      <TenderAgentSdk
        :access-id="accessId"
        :access-secret="accessSecret"
        :amount="amount"
        :fiat-currency="fiatCurrency"
        :env="env" 
        :on-event-response="handleSdkEvent"
      />
    </div>

    {sdkResponse && (
      <div>
        <h3>Payment Result:</h3>
        <p>Status: {sdkResponse.status}</p>
        <p>Message: {sdkResponse.message}</p>
        {sdkResponse.data && <pre>{JSON.stringify(sdkResponse.data, null, 2)}</pre>}
      </div>
    )}
  </div>
</template>

<style>
pre {
  white-space: pre-wrap;
  word-wrap: break-word;
}
</style>

<script setup>
import { ref } from 'vue'

const showSdk = ref(false)
const sdkResponse = ref(null)

// Event handler function using the imported type
function handleSdkEvent(response: onFinishResponse) {
  console.log('Tender SDK Event:', response)
  sdkResponse.value = response

  // Handle different event types based on response.status (assuming status field exists)
  switch (response.status) { 
    case 'error': 
      console.error('SDK Error:', response.error?.message || response.message || 'Unknown Error') 
      alert(`Payment Error: ${response.error?.message || response.message || 'Unknown error'}`)
      showSdk.value = false
      break
    case 'completed': 
      console.log('SDK Success:', response.data)
      alert(`Payment Successful! Data: ${JSON.stringify(response.data)}`)
      showSdk.value = false
      break
    // Add cases for other relevant statuses like 'pending', 'partial-payment', etc.
    default:
      console.log('Received SDK status:', response.status)
  }
}
</script>
  • Remember to replace placeholder credentials (YOUR_ACCESS_ID, YOUR_ACCESS_SECRET) with your actual keys.
  • Set the env variable to 'production' when deploying to a live environment.

Component Props

| Prop | Type | Required | Description | |------------------|---------------------------------------------|----------|-----------------------------------------------------------------------------| | amount | number | Yes | The amount to be charged in the specified fiat currency. | | fiatCurrency | string | Yes | The fiat currency code (e.g., "USD", "EUR"). | | accessId | string | Yes | Your Tender Cash merchant Access ID. | | accessSecret | string | Yes | Your Tender Cash merchant Access Secret. | | env | "test" | "live" | Yes | The environment to use ("test" for testing, "live" for production). | | onEventResponse| (data: onFinishResponse) => void | No | Optional callback function triggered on payment completion or status change. |

Callback Data (onFinishResponse)

The onEventResponse callback receives an object with the following structure:

interface onFinishResponse {
  status: "partial-payment" | "completed" | "overpayment" | "pending" | "error" | "cancelled";
  message: string;
  data: IPaymentData | undefined; // Contains details like amountPaid, coin, address, etc.
}

interface IPaymentData {
  id?: string;
  amount?: number;
  coinAmount?: number;
  coin?: string;
  chain?: string;
  address?: string;
  amountPaid?: string;
  balance?: string;
  status?: "partial-payment" | "completed" | "overpayment" | "pending" | "error" | "cancelled";
}

License

MIT