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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@speeddev/speed-js

v2.0.0

Published

Speed - Bitcoin payments made easy, lightning-fast, secure, and low-cost

Downloads

17

Readme

Speed.js ES Module

Use Speed.js as an ES module.

Note: You must load Speed.js directly from https://js.tryspeed.com. You cannot include it in a bundle or host it yourself. This package is the same as the above link and wraps the global Speed object provided by the Speed.js script as an ES module.

Version 2 is out! If you are still using version 1, we highly recommend you update or use the new version. However, if you wish to use the previous version, please visit this link

Introduction

Speed JS is an easy-to-use solution for businesses who want to start accepting crypto payments on their platform with a few lines of code.

Create a checkout session to collect payments. It is the easiest way to accept one-time payments with a custom-branded hosted payment page. Accepting cryptocurrency as a payment method will give you access to a whole new market of consumers who are a part of the community.

Installation

Use to install the Speed.js module:

npm install @speeddev/speed-js

or

yarn add @speeddev/speed-js

Usage

Import Speed.js

This function returns a newly created Speed object once speed.js is loaded. It takes the same parameters passed when directly initializing a Speed instance.

import { Speed } from "@speeddev/speed-js";

// Speed.js is not initiated until this is called
const speed = new Speed("pk_test_fdrdetxilogwetazubs");

We have placed a random API key in this example. Replace it with your actual publishable API keys to test this code through your Speed account.

For more information on how to use Speed.js, please refer to the Speed.js API reference or learn to accept a payment with Speed.

Manually include the script tag

Manually add the Speed.js script tag to the <head> on your site. When you call Speed with your publishable key, it will use the existing script tag.

<!-- Somewhere in your site's <head> -->
<script src="https://js.tryspeed.com"></script>

Once the script is loaded you can create an object of speed.js by passing a publishable key.

const speed = new Speed("pk_test_fdrdetxilogwetazubs");

Create Checkout Session

To create a checkout session you can call the function of speed.js to create a checkout session by passing a required parameter to it.

speed.createCheckoutSession({
  currency: "INR",
  amount: 100,
  successUrl: "https://example.com",
  cancelUrl: "https://example.com",
  successMessage: "Payment Successful!",
  paymentMethods: ["onchain", "lightning"],
  metadata: {
    country: "India",
  },
});

API

Below we have all the parameters that you can use to create the checkout session.

| Name | Type | Required | Description | | :------------: | :----: | :------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | currency | string | true | You must specify your preferred base currency (fiat or cryptocurrency) to create a checkout session. A three-lettered ISO-compliant currency name must be used. | | amount | number | true | Amount for which you want to create a checkout session | | successUrl | string | false | When the payment is successful, you can use this parameter to redirect the customer to your hosted page. | | cancelUrl | string | false | This parameter is used to redirect your user to any site you want when they do not proceed with the payment and click the return button. | | successMessage | string | false | This is the custom success message that will show after payment successful. | | paymentMethods | array | false | We offer both on-chain & lightning network payment options for customers to choose from. | | metadata | object | false | To help you gather additional data, this parameter has been added which you can easily add or remove while integrating. |

Speed.js Documentation