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

@tapanytime/helcim

v1.0.3

Published

An alternative to Helcim's Helcim.js with TypeScript support

Downloads

4

Readme

Helcim Client Typescript

This library is a community-built library intended to replace Helcim.js for Verify Transactions. Instead of using form fields like Helcim.js, it provides a Javascript (with Typescript types) API that you can use in the frontend of your application.

This is especially useful if you want a custom field design and are using a Frontend framework like VueJS, React, or Angular, where Helcim.js' method of manipulating the DOM directly is a bad idea.

It is strongly recommended that you use this library for Verify Transactions ONLY It is much more secure to process purchase or capture transactions on your backend, and only transfer the customer information / tokenized Card data to your backend over an SSL connection.

How it works

This library uses Axios (an AJAX library), QS (Query String for URL-encoded data), and an XML Parser to send information to and from Helcim, and is very similar to Helcim's Helcim.js client except the data is passed in as a Javascript Object and is returned as a Javascript object. Here is an example implementation:

First, install the client in your VueJS/React/Angular Project:

$ npm install @tapanytime/helcim
// Import the Helcim Client in your frontend code in vue or react
import * as SDK from "@tapanytime/helcim"

// Create a Helcim Client Instance, passing in the Helcim.js token that you created in the Helcim Portal
const client = new SDK.HelcimClient({ token: "YOUR_HELCIMJS_TOKEN_HERE" })

// Run this in an asynchronous function
const result = await client.processTransaction({
    cardNumber: "5413330089099130", // This is a sample card number
    cardExpiryYear: "2025", // Doesn't matter if you put just the last two digits of the year or the full year, but it will only accept years in the next 19 years
    cardExpiryMonth: "01", // Doesn't matter if its a single digit month or two digit month
    cardCVV: "100", // Can be 3 or 4 numbers
    
    amount: "0.00",
    cardHolderName: "John Doe",
    cardHolderAddress: "123 Streetname St.",
    cardHolderPostalCode: "A1A 1A1", // Spaces in between will be automatically removed
})


console.log(result)
// { status: "success", data: { ... }}

// or

// { status: "error", errorCodes: [...] }

There are also a few functions implemented to help with your UI:

import * as SDK from "@tapanytime/helcim"

// This supports partial card numbers as well and it will give a best guess
const result = SDK.HelcimClient.getCardBrand("5413330089099130")

console.log(result)

// mastercard

// or unknown (if not a matching card type)
// See src/types/HelcimCardBrand.type.ts for all the possible card types
// This doesn't mean that helcim supports these cards

Building

Building this project is quite simple. Ensure you have webpack installed and then in the root directory of the project:

$ npm install

and

$ npm run build

This will output the code into a newly created dist folder, under bundle.js. That will allow you to include it in your web project with a script tag if you are not using a Vue/Angular/React project.

Limitations

This library does not currently implement Bank Transactions or Line Items. It only implements Credit Card Transactions and is intended only for Verify Transactions. If this feature is requested I can implement it, as it's very easy to do.

It also doesn't parse errors that may occur on the Helcim backend yet.

Important

If you try to test this on localhost without an SSL certificate, it will not work. This is a limitation of the Helcim.js API, not of this library. It throws an internal server error otherwise. Ensure that the endpoint you are running this off of is using HTTPS. One workaround to this is to use something like ngrok to expose your local server instance (ngrok by default converts your http site to https) to the internet and then connecting to it.