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

poynt

v0.0.45

Published

Poynt Node.js SDK

Downloads

389

Readme

Poynt Node.js SDK

This SDK helps you connect to the Poynt API from your Node.js apps. You can easily get/create business information, subscribe to webhooks, and send cloud messages to your terminal app.

Documentation

After you've signed up for a Poynt developer account, check out our API reference or our developer guides!

Installation

Install this package:

npm install poynt --save

Usage

You can connect to the Poynt API by passing either a filename or a string containing your PEM-encoded private key you downloaded from Poynt.net. If region param is not set, the SDK uses services.poynt.net endpoint. If you need to hit services-eu.poynt.net, you need to pass region: 'eu'.

var poynt = require("poynt")({
  // region: 'eu',
  applicationId: "urn:aid:your-application-id",
  filename: __dirname + "/key.pem",
});

or

var poynt = require("poynt")({
  applicationId: "urn:aid:your-application-id",
  key: "-----BEGIN RSA PRIVATE KEY-----\n.....\n-----END RSA PRIVATE KEY-----",
});

Then, make a request signed with your app private key:

poynt.getBusiness(
  {
    businessId: "00000000-0000-0000-0000-000000000000",
  },
  function (err, business) {
    if (err) {
      // deal with your error
    } else {
      // do something with business
    }
  }
);

We'll handle all the request signing, token refresh, etc. for you!

Namespaces and methods

Poynt Collect

  • tokenizeCard
  • charge

CloudMessages

  • sendCloudMessage
  • sendRawCloudMessage
  • sendPaymentBridgeMessage

Hooks

  • getHooks
  • createHook
  • getHook
  • deleteHook

Businesses

  • getBusiness
  • getBusinessByDeviceId
  • getMerchantPaymentAccount

Stores

  • getStore

Orders

  • getOrders
  • getOrder
  • createOrder
  • completeOrder

Transactions

  • getTransactions
  • getTransaction
  • voidTransaction
  • refundTransaction
  • createTransaction

Customers

  • getCustomers
  • getCustomer

Catalogs

  • getCatalogs
  • getCatalog
  • getFullCatalog
  • createCatalog
  • createFullCatalog
  • updateCatalog
  • deleteCatalog
  • getCategory
  • createCategory
  • lookupCategories
  • deleteCategory
  • updateCategory

Invoices

  • getInvoices
  • getInvoice
  • createInvoice
  • sendInvoiceReminder
  • cancelInvoice

Products

  • getProducts
  • getProductsSummary
  • lookupProducts
  • getProduct
  • createProduct
  • deleteProduct
  • updateProduct

Reports

  • getReports
  • createReport

Taxes

  • getTaxes
  • getTax
  • createTax
  • deleteTax
  • updateTax

Business Users

  • getBusinessUsers
  • getBusinessUser

Business Applications

  • getBusinessApplication
  • getBusinessApplicationStatus
  • getBusinessApplicationAccount
  • getBusinessApplicationOrders
  • getBusinessApplicationProfile

Examples

Charging a token from Poynt Collect V2

The most basic use case is just entering an amount and charging:

poynt.charge(
  {
    action: "SALE",
    amounts: {
      currency: "USD",
      transactionAmount: 500,
      orderAmount: 500,
    },
    businessId: "84fa5bf5-bd51-4653-80de-ce46348f7659",
    token: "...token...",
  },
  function (err, transaction) {
    if (err) {
      // deal with your error
      console.log(err);
    } else {
      // do something with transaction
      console.log(transaction);
    }
  }
);

Many other fields are accepted – including address, phone, and references. The following code makes a charge, fetches the full transaction, and then voids it.

poynt.charge(
  {
    action: "SALE",
    address: {
      line1: "858 University Ave",
      line2: "",
      city: "Palo Alto",
      territory: "CA",
      countryCode: "US",
      postalCode: "94301",
    },
    amounts: {
      currency: "USD",
      transactionAmount: 500,
      orderAmount: 500,
    },
    businessId: "84fa5bf5-bd51-4653-80de-ce46348f7659",
    emailReceipt: true,
    phone: {
      ituCountryCode: "1",
      areaCode: "234",
      localPhoneNumber: "5678901",
    },
    receiptEmailAddress: "[email protected]",
    references: [
      {
        customType: "WEBSITE_ID",
        id: "123456",
        type: "CUSTOM",
      },
      {
        customType: "CHANNEL_ORDER_ID",
        id: "abcdef",
        type: "CUSTOM",
      },
    ],
    sourceApp: "Online Store",
    token: "...token...",
  },
  function (err, transaction) {
    if (err) {
      // deal with your error
      return console.log(err);
    }

    console.log("Transaction processed", JSON.stringify(transaction, null, 2));

    // get the transaction
    poynt.getTransaction(
      {
        businessId: "84fa5bf5-bd51-4653-80de-ce46348f7659",
        transactionId: transaction.id,
      },
      function (err, transaction) {
        if (err) {
          // deal with your error
          return console.log(err);
        }

        console.log(
          "Transaction fetched",
          JSON.stringify(transaction, null, 2)
        );

        // void the transaction
        poynt.voidTransaction(
          {
            businessId: "84fa5bf5-bd51-4653-80de-ce46348f7659",
            transactionId: transaction.id,
          },
          function (err, voidedTransaction) {
            if (err) {
              // deal with your error
              return console.log(err);
            }

            console.log(
              "Transaction voided",
              JSON.stringify(voidedTransaction, null, 2)
            );
          }
        );
      }
    );
  }
);

Apple Pay Registration

  • registerApplePayMerchant
  • unregisterApplePayMerchant
  • getApplePayMerchant
  • getApplePayDomainAssociationFile