Credit Card Tokenizer Server
The server side component of the cc-tokenizer.
Usage
Install with Npm/Yarn
npm install --global @brad-jones/cc-tokenizer-server
OR
yarn global add @brad-jones/cc-tokenizer-server
Configure the environment
The server use environment variables for configuration.
-
NODE_ENV: Set this
development
when testing and debugging. -
CC_TOKENIZER_HOST: Set this to an ip addresses that the server will listen on, you may use
0.0.0.0
to attach to all interfaces. -
CC_TOKENIZER_PORT: Set this to a port number that the server will listen on, something like port
80
. - CC_TOKENIZER_TOKEN_RECEIVER: Set this to a URL that will be called when a new token is created. See the token receiver section below for more info.
-
CC_TOKENIZER_BPOINT_ENDPOINT: The base url for the Bpoint API, defaults to
https://www.bpoint.com.au/webapi/v3
. - CC_TOKENIZER_BPOINT_MERCHANTNO: A Bpoint Merchant Number.
- CC_TOKENIZER_BPOINT_USERNAME: A Bpoint Username.
- CC_TOKENIZER_BPOINT_PASSWORD: A Bpoint Password.
-
CC_TOKENIZER_EWAY_ENDPOINT: The base url for the Eway API, defaults to
https://api.ewaypayments.com
. - CC_TOKENIZER_EWAY_USERNAME: A eWay Username.
- CC_TOKENIZER_EWAY_PASSWORD: A eWay Password.
Then just run cc-tokenizer-server
, which should be on your $PATH
after doing a global install of the package.
NOTE: Alternative Install Method
Instead of installing the package globally, you could install it into a local node.js project. And then create a.env
file with the above configuration.
The Token Receiver
This package is all well and good, it can create new credit card tokens for you. However it obviously does not understand how / where you would like to store your new credit card tokens.
The token receiver is a fully qualified URL that will be "POSTed" to every time a new token is created.
The payload that your reciever endpoint will get, looks like:
{
"token": "d3b63d3b-c435-4cb6-9842-87e0dc48598d",
"resultToken": "44375cd4-99d4-4719-9868-8c0c1da4147d",
"customerRef": "61612"
}
Now you can store the token
against the customerRef
in your database.
NOTE:
resultToken
is an intermediate token and is only included for "completeness" sake. Maybe it might be useful in debugging / logging.