NodeJS integration to Beanstream API.
The Node SDK for Beanstream lets you take payments, save payment profiles, and run reports on your transactions. It's easy to get started, just follow the steps below
Step 1) Install the module using NPM
Import the project directly from npm:
npm install beanstream-node
Step 2) Import the module to your project
var beanstream = 'merchantId' 'Payments API key' 'Profiles API key' 'Reporting API key';
Supply your merchant ID, payments API Key, Profiles API key (optional), and Reporting API key (optional).
Step 3) Make a Payment
The Beanstream SDK uses promises to handle asynchronous calls to the server. You will get your results in a Promise object. Here is an example:
var tokenPayment =order_number: 'order-abc1234'amount:1000payment_method:'card'token:name:'John Doe'code: 'token-string'complete: true;beanstreampayments;
Here is an example with a raw card number:
var cardPayment =order_number: 'order-abc1234'amount:1000payment_method:'card'card:name:'John Doe'number:'5100000010001004'expiry_month:'02'expiry_year:'19'cvd:'123';beanstreampayments;
Note that you should tokenize cards in your client-side app in order to reduce your PCI scope. More: http://developer.beanstream.com/documentation/legato/
Step 4) Examples
Visit http://developer.beanstream.com for more code examples. You will learn how to:
- create a card token
- make a payment with a token
- make a card payment
- make a card pre-authorization and completion
- make a payment profile
- charge a payment profile
- update payment profiles
- query your transaction history using reports
Want to help improve the SDK?
Whether it is a bug fix or a new feature improvement feel free to fork the project and send us pull requests. We are always excited to work with the community to improve the project. We even have code bounties as a reward for great contributions. So never hesitate to send improvements our way!