This is the backend server for ElectronPOS. It has 3 main functionalities.
- It creates a transaction
- It voids a transaction
- It refunds a transaction
That's really it.
In order to install just run the 2 commands below. After, you will need to configure some environment variables
$ npm install # At least npm version 3.9.5 with and node version v6.2.2
$ bundle install # At least Bundler version 1.12.3 and gem version 2.5.1
Right now we only support Authorize.net as our gateway, but eventually we will implement support for other gateways.
open up your .bashrc
or .bash_profile
and create the following environment variables
export EQ_AUTH_NET_NAME="your-authorize.net-login-id"
export EQ_AUTH_NET_TRANS_KEY="your-authorize.net-transaction-key"
That's it for now. Either source
your new bash configurations or restart bash.
$ sudo node server.js --harmony
The --harmony
flag is for arrow function support, just in case your node version is a little too low
app.post('/charge', function(req, res){
req.body.amount
req.body.cardnumber
req.body.ccv
req.body.name
req.body.expdate
// then we charge your credit card
})
Amount, CreditCardNumber, CCV, Name On Card, Exp Date
Error # (e.g. You messed it up bro, try again)
Authorization Code # (e.g. KUSI06)
Transaction ID # (e.g. 60005898263)
app.post('/void', function(req, res){
req.body.transid
})
Transaction ID # (e.g. Transaction ID from response above)
Error # (e.g. You messed it up bro, try again)
Success Code # (e.g. 1, 2, 3, 4 or 5)
app.post('/refund', function(req, res){
req.body.transid
})
Transaction ID # (e.g. Transaction ID charge response above)
Error # (e.g. You messed it up bro, try again)
Success Code # (e.g. 1, 2, 3, 4 or 5)
Eventually we will be integrating different gateway hooks so in an effort to keep the code the same on the client side, we are just going to handle the actual transactions on the server side.