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

payjunction

v0.4.0

Published

PayJunction API client for node.js

Downloads

14

Readme

payjunction-nodejs TravisCI

A PayJunction API client for node

Installation

$ npm install payjunction

Usage

You will need a PayJunction account in order to use this library. If you don't have one, you should sign up. If you already have an account, then you can get started by requiring this library and instantiating a PayJunctionClient object:

var PayJunctionClient = require('payjunction');

// set the connection parameters to your own values
var payjunction = new PayJunctionClient({
  username: 'YOUR-USERNAME',
  password: 'YOUR-PASSWORD',
  appkey: 'YOUR-APP-KEY',
  endpoint: 'test' // use 'live' for production
});

The API client has a property for each of the resources it supports (transactions, receipts and customers) and each property has a method for each of the supported actions. Each of the methods return an object that emits events for you to handle. The client itself uses restler under the hood, so you can read all about which events are available and callback signatures for each event in the restler documentation.

The examples here use the 'complete' event which can be used to handle both success and failure events in the same callback, but restler allows much more flexibility in this area if you need it.

Examples

Consult the PayJunction API Documentation for information about all the available API resources and actions including what parameters can be set and example responses.

Transactions

Create a transaction for a keyed credit card:

payjunction.transaction.create({
  cardNumber: 4444333322221111,
  cardExpMonth: '01',
  cardExpYear: '18',
  cardCvv: 999,
  amountBase: '99.50'
}).on('complete', function(data){
  console.log(data);
});

Create a transaction for a swiped credit card:

payjunction.transaction.create({
  cardTrack: '%B4444333322221111^First/Last^1712980100000?;4444333322221111=1712980100000?',
  amountBase: '12.00'
}).on('complete', function(data){
  console.log(data);
});

Create a transaction for an ACH transfer:

payjunction.transaction.create({
  achRoutingNumber: 104000016,
  achAccountNumber: 123456789,
  achAccountType: 'CHECKING',
  achType: 'PPD',
  amountBase: '21.00'
}).on('complete', function(data){
  console.log(data);
});

Create a new transaction from a previous transaction:

payjunction.transaction.create({
  transactionId: 74600
}).on('complete', function(data){
  console.log(data);
});

Void a transaction:

var transaction = payjunction.transaction.update(74600, {
  status: 'VOID'
}).on('complete', function(data){
  console.log(data);
});

Read a transaction:

var transaction = payjunction.transaction.read(74600).on('complete, function(data){
  console.log(data);
});

Add signature to transaction:

payjunction.transaction.addSignature({
  id: 74600,
  // JSON signature document or raw data from a capture device
  signature: '{"width":500,"height":100,"points":[[],[109,63],[109,63],[108,63],[108,62]]}'
}).on('complete', function(data){
  console.log(data);
});

receipts

Read receipt data by transaction id:

payjunction.receipt.read(74600).on('complete', function(data){
  console.log(data);
});

Sent an email receipt:

payjunction.receipt.email(74600, {
  to: '[email protected]',
  replyTo: '[email protected]'
}).on('complete', function(data){
  console.log(data);
});

customers

Create a customer:

client.customer.create({
  companyName: 'ACME, inc.',
  email: '[email protected]',
  identifier: 'your-custom-id',
  firstName: 'Joe',
  jobTitle: 'Wage Slave',
  lastName: 'Schmoe',
  middleName: 'Ignatius',
  phone: '5555551212',
  phone2: '1234567890',
  website: 'acme.com'
}).on('complete', function(data){
  console.log(data);
});

Delete a customer:

client.customer.delete(1).on('complete', function(data){
  console.log(data);
});

Running Tests

To run the test suite, first run npm install to install the development dependencies:

$ npm install

Then run the tests:

$ npm test

Maintainer

This package is maintained by Branded Crate.

License

This package is released under the MIT License.