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

@boltpay/bolt-js

v0.2.5

Published

BoltJS connects your frontend to the Bolt ecosystem

Readme

Bolt JavaScript SDK

What is this?

Native JavaScript/TypeScript support support for Bolt Web Payments. A programmatic way to for out-of-app purchases and subscriptions.

We also support other platforms:

Discord

Chat with us on Discord for help and inquiries!

📚 Documentation

For documentation and API reference visit our quick start guide.

💰 Why Bolt

Only with Bolt you get 2.1% + $0.30 on all transactions. That's 10x better than traditional app stores which take 30% of your revenue! That's the fair and transparent pricing you get with using Bolt.

🛠️ Prerequisites

You need 3 things to get started:

  1. Existing Web App: You will need a web application (React, Vue, Angular, or vanilla JavaScript)
  2. Backend Server: You will need to bring your own backend server (any language)
  3. Bolt Merchant Account: Dashboard access to manage your gaming store (signup or login)

📦 Installation

Step 1: Install the JavaScript SDK

The SDK can be installed with either npm, pnpm, bun or yarn package managers.

NPM

npm install @boltpay/bolt-js

PNPM

pnpm install @boltpay/bolt-js

Bun

bun install @boltpay/bolt-js

Yarn

yarn add @boltpay/bolt-js

Optional: Run the SDK locally

The SDK comes with an sample webpage with a basic form of all the different integrations. With your package manager of choice just install and run dev to see it in your browser.

npm install
npm run dev

Step 2: Add code to your game

There is a sample integration in the examples/ folder.

  • main.ts: will showcase how to initialize the client and open links

Step 3: Continue with Backend Integration

You will need to bring your own backend server to complete integration.

  • Quick Start: View our quickstart guide to get the API running
  • Example Server: We also have a sample server in NodeJS for your reference during implementation

TypeScript Types

For TypeScript projects, the SDK provides full type definitions:

import { Charge, BoltTransactionSuccess } from '@boltpay/bolt-js'

// Transaction result type
interface BoltTransactionSuccess {
  reference: string // Unique transaction reference
}

Framework Integration Examples

React
import { Charge } from '@boltpay/bolt-js'
import { useState } from 'react'

function CheckoutButton({ checkoutUrl }: { checkoutUrl: string }) {
  const [loading, setLoading] = useState(false)

  const handlePayment = async () => {
    setLoading(true)
    const transaction = await Charge.checkout(checkoutUrl)
    console.log('Payment completed:', transaction.reference)
    // Redirect to success page or update UI
    setLoading(false)
  }

  return (
    <button onClick={handlePayment} disabled={loading}>
      {loading ? 'Processing...' : 'Pay with Bolt'}
    </button>
  )
}
Vue.js
<template>
  <button @click="handlePayment" :disabled="loading">
    {{ loading ? 'Processing...' : 'Pay with Bolt' }}
  </button>
</template>

<script setup>
import { ref } from 'vue'
import { Charge } from '@boltpay/bolt-js'

const props = defineProps(['checkoutUrl'])
const loading = ref(false)

const handlePayment = async () => {
  loading.value = true
  const transaction = await Charge.checkout(props.checkoutUrl)
  console.log('Payment completed:', transaction.reference)
  loading.value = false
}
</script>

Advertisement Integration

The SDK also provides support for displaying advertisements to users:

import { BoltSDK } from '@boltpay/bolt-js'

// Open an advertisement with an optional callback when claimed
BoltSDK.gaming.openAd('https://your-ad-link.com', {
  onClaim: () => {
    console.log('Ad reward claimed!')
    // Update game state or provide rewards
  },
})

React Example with Advertisements

import { BoltSDK } from '@boltpay/bolt-js'

function AdButton({ adLink }: { adLink: string }) {
  const handleAdDisplay = async () => {
    await BoltSDK.gaming.openAd(adLink, {
      onClaim: () => {
        // Handle reward claim
        console.log('Reward claimed!')
      },
    })
  }

  return <button onClick={handleAdDisplay}>Watch Ad</button>
}

Vue Example with Advertisements

<template>
  <button @click="handleAdDisplay" :disabled="loading">
    {{ loading ? 'Loading...' : 'Watch Ad' }}
  </button>
</template>

<script setup>
import { ref } from 'vue'
import { BoltSDK } from '@boltpay/bolt-js'

const props = defineProps(['adLink'])
const loading = ref(false)

const handleAdDisplay = async () => {
  loading.value = true
  try {
    await BoltSDK.gaming.openAd(props.adLink, {
      onClaim: () => {
        // Handle reward claim
        console.log('Reward claimed!')
      },
    })
  } finally {
    loading.value = false
  }
}
</script>

Need help?

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.