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

globalpayments-api

v3.5.1-fix-4

Published

Global Payments SDK for NodeJS for Heartland and Global Payments eCommerce gateways

Downloads

5,740

Readme

Heartland & Global Payments Node.js SDK

This SDK makes it easy to integrate your Node.js application with our Card Not Present and Card Present APIs.

Solutions

General / Omnichannel

  • API Payment Processing
  • Apple Pay & Google Pay
  • Secure Card Storage & Customer Management
  • Subscriptions / Recurring Billing Solutions
  • Credit, Debit, Gift & Loyalty, and eCheck/ACH

Card Not Present (Ecommerce & MOTO) Specific

  • Minimize PCI compliance requirements with Hosted Payment Solutions
  • 140+ Authorization Currencies & 16 Settlement Currencies
  • 150+ Local Payment Methods Worldwide
  • Account Updater
  • Inbuilt Fraud Prevention Rules
  • 3D Secure, AVS and CVV Checks
  • 260+ Global Enterprise Fraud Rules

Card Present (Terminal & POS) Specific

  • Secure End-To-End Encryption

Requirements

  • Node.js

Installation

Installing the SDK into your solution is usually be done by either using NPM or Yarn.

To install via NPM:

npm install --save globalpayments-api

To install via Yarn:

yarn add globalpayments-api

Documentation and Examples

You can find the latest SDK documentation along with code examples and test cards on the Global Payments and Heartland Developer Hubs.

In addition you can find working examples in the our example code repository.

Quick Tip: The included test suite can be a great source of code samples for using the SDK!

Process a Payment Example

const card = new CreditCardData();
card.number = "4111111111111111";
card.expMonth = "12";
card.expYear = "2025";
card.cvn = "123";

card
  .charge(129.99)
  .withCurrency("EUR")
  .execute()
  .then((response) => {
    const result = response.responseCode;
    const message = response.responseMessage;
  })
  .catch((e) => {
    // handle  errors
  });

Test Card Data

| Name | Number | Exp Month | Exp Year | CVN | | ----------- | ---------------- | --------- | -------- | ---- | | Visa | 4263970000005262 | 12 | 2025 | 123 | | MasterCard | 2223000010005780 | 12 | 2019 | 900 | | MasterCard | 5425230000004415 | 12 | 2025 | 123 | | Discover | 6011000000000087 | 12 | 2025 | 123 | | Amex | 374101000000608 | 12 | 2025 | 1234 | | JCB | 3566000000000000 | 12 | 2025 | 123 | | Diners Club | 36256000000725 | 12 | 2025 | 123 |

Testing Exceptions

During your integration you will want to test for specific issuer responses such as 'Card Declined'. Because our sandbox environments do not actually reach out to issuing banks for authorizations, there are specific transaction amounts and/or card numbers that will trigger gateway and issuing bank responses. Please contact your support representative for a complete listing of values used to simulate transaction AVS/CVV results, declines, errors, and other responses that can be caught in your code. Example error handling code:

card
  .charge(-5)
  .withCurrency("USD")
  .withAddress(address)
  .execute()
  .catch((e) => {
    switch (e.name) {
      case BuilderError.constructor.name:
        // handle builder errors
        break;
      case ConfigurationError.constructor.name:
        // handle errors related to your services configuration
        break;
      case GatewayError.constructor.name:
        // handle gateway errors/exceptions
        break;
      case UnsupportedTransactionError.constructor.name:
        // handle errors when the configured gateway doesn't support
        // desired transaction
        break;
      case ApiError.constructor.name:
      default:
        // handle all other errors
        break;
    }
  });

Contributing

All our code is open sourced and we encourage fellow developers to contribute and help improve it!

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Ensure SDK tests are passing
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

License

This project is licensed under the GNU General Public License v2.0. Please see LICENSE.md located at the project's root for more details.