Why kosher-
? This software does its best to conform to all the holy best practices of JavaScript; including proper style, linting, and testing. It aims to be an acceptable tool as well as an exemplar for learning and instructing good style.
Send the Credit Card information and returns a Transaction ID, which you can use as a token for future transactions.
var BluePay = require('kosher-bluepay');
var connection = BluePay.connect({
accountId: 'ACCOUNT_ID',
secretKey: 'SECRET_KEY',
mode: 'TEST'
});
connection
.setCustomerInformation()
.setCardInformation()
.makeToken()
.process()
.then(function (status, transaction) {
}, function (err) {
});
// Continuing with the example above, using the same customer information.
connection
.sale('3.00')
.process()
.then(function (status, transaction) {
}, function (err) {
});
or reuse a transaction token
// Clear the transaction specific data from connection
connection.reset();
// Load the transaction and complete the sale.
connection.sale('1.99', token).process();
Determine if customer has enough credit available without charging card.
connection.auth('1.99').process();
connection.refund('1.99', token).process();
You can cancel a transaction if it has not yet been settled. If a transaction has already been settled, then you must issue a refund instead.
This code cancels single transactions; it doesn't cancel recurring payments.
connection.void(transactionId).process();