A Node.JS library for communicating with the Beanstream API.
Currently only supports these actions of the Transactions API:
- Card Purchase & Pre-Authorization
- Return
- Pre-Authorization Completion
- Void Purchase & Void Return
npm install --save beanstream
var Beanstream = require("beanstream");
var beanstream = new Beanstream(options);
options
objectmerchant_id
stringpasscode
stringusername
stringpassword
stringversion
number / string; optional, defaults to1
Credentials for authenticating with Beanstream. Provide username
+ password
, or merchant_id
+ passcode
. merchant_id
is required regardless.
beanstream.cardPurchase(card, order, callback);
card
object- see Card Object
order
object- see Order Object
callback
functioncallback
gets passed two arguments:error
anddata
. Data contains to JSON response from Beanstream.
beanstream.preAuthorization(card, order, callback);
card
object- see Card Object
order
object- see Order Object
callback
functioncallback
gets passed two arguments:error
anddata
. Data contains to JSON response from Beanstream.
This creates a pre-auth charge by automatically setting card.complete
to false
. See completePreAuthorization for completing the pre-auth transaction.
beanstream.completePreAuthorization(transaction_id, options, callback);
transaction_id
stringoptions
objectamount
number- order_number string; optional
callback
functioncallback
gets passed two arguments:error
anddata
. Data contains to JSON response from Beanstream.
This completes a pre-auth charge.
beanstream.return(transaction_id, options, callback);
transaction_id
stringoptions
objectamount
number- order_number string; optional
callback
functioncallback
gets passed two arguments:error
anddata
. Data contains to JSON response from Beanstream.
This creates a return transaction.
beanstream.void(transaction_id, options, callback);
transaction_id
stringoptions
objectamount
number- order_number string; optional
callback
functioncallback
gets passed two arguments:error
anddata
. Data contains to JSON response from Beanstream.
This creates a void transaction.
complete
boolean; optional, defaults totrue
name
stringnumber
stringexpiry_month
number / stringexpiry_year
number / stringcvd
string
order_number
string,amount
number,comments
string; optionalbilling
object; optionalname
"Beanstream Internet Commerce",address_line1
stringaddress_line2
string; optionalcity
stringprovince
stringcountry
stringpostal_code
stringphone_number
stringemail_address
string
language
string; optional, defaults to"eng"
customer_ip
: string; optionalterm_url
string; optional
Follow the instructions in test/credentials_template.js
, then run tests with npm test