0.1.0 • Published 11 years ago
beanstream v0.1.0
Node-Beanstream
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
Installation
npm install --save beanstreamUsage
Constructor
var Beanstream = require("beanstream");
var beanstream = new Beanstream(options);optionsobject -merchant_idstring -passcodestring -usernamestring -passwordstring -versionnumber / string; optional, defaults to1
Credentials for authenticating with Beanstream. Provide username + password, or merchant_id + passcode. merchant_id is required regardless.
cardPurchase
beanstream.cardPurchase(card, order, callback);cardobject - see Card Objectorderobject - see Order Objectcallbackfunction -callbackgets passed two arguments:erroranddata. Data contains to JSON response from Beanstream.
preAuthorization
beanstream.preAuthorization(card, order, callback);cardobject - see Card Objectorderobject - see Order Objectcallbackfunction -callbackgets passed two arguments:erroranddata. 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.
completePreAuthorization
beanstream.completePreAuthorization(transaction_id, options, callback);transaction_idstringoptionsobject -amountnumber - ordernumber _string; optionalcallbackfunction -callbackgets passed two arguments:erroranddata. Data contains to JSON response from Beanstream.
This completes a pre-auth charge.
return
beanstream.return(transaction_id, options, callback);transaction_idstringoptionsobject -amountnumber - ordernumber _string; optionalcallbackfunction -callbackgets passed two arguments:erroranddata. Data contains to JSON response from Beanstream.
This creates a return transaction.
void
beanstream.void(transaction_id, options, callback);transaction_idstringoptionsobject -amountnumber - ordernumber _string; optionalcallbackfunction -callbackgets passed two arguments:erroranddata. Data contains to JSON response from Beanstream.
This creates a void transaction.
Objects
Card Object
completeboolean; optional, defaults totruenamestringnumberstringexpiry_monthnumber / stringexpiry_yearnumber / stringcvdstring
Order Object
order_numberstring,amountnumber,commentsstring; optionalbillingobject; optional -name"Beanstream Internet Commerce", -address_line1string -address_line2string; optional -citystring -provincestring -countrystring -postal_codestring -phone_numberstring -email_addressstringlanguagestring; optional, defaults to"eng"customer_ip: string; optionalterm_urlstring; optional
Tests
Follow the instructions in test/credentials_template.js, then run tests with npm test
0.1.0
11 years ago