Ubivar node.js bindings
Ubivar is an API that takes over the hassle of screening e-payment for
frauds.
Ubivar routes e-commerce transactions given their risk. By default the three
routing outcomes are rejection, manual verification and acceptance. And the two
elementary resources are the transactions
and the labels
. Transactions
are online sales pushed to your payment gateway and labels
define the a
posteriori truth about each transaction
, i.e. {fraud
, non-fraud
}.
Using Ubivar simply requires an access token
. Then the bindings provide the
hooks to send and receive resources to the API. For each transaction
that
Ubivar receives, it calculates a routing. Later, as you review manually some of
the transactions
or as you receive fraud notifications, you label
those transactions
as fraud
.
Quick Start
A. Install and initialize
npm install ubivar
var Ubivar = require("ubivar")
, ubivar = new Ubivar("YOUR_API_ACCESS_TOKEN", "latest")
B. Send transactions
ubivar.transactions.create({
"user_id" : "test_phahr3Eit3_123"
, "user_email" : "test_phahr3Eit3@gmail-123.com"
, "type" : "sale"
, "status" : "success"
, "order_id" : "test_iiquoozeiroogi_123"
, "tx_id" : "client_tx_id_123"
, "amount" : "43210"
, "payment_method":{
"bin" :"123456"
, "brand" :"Mastercard"
, "funding" :"credit"
, "country" :"US"
, "name" :"M Man"
, "cvc_check" :"pass"
},"billing_address":{
"line1" :"123 Market Street"
, "line2" :"4th Floor"
, "city" :"San Francisco"
, "state" :"California"
, "zip" :"94102"
, "country" :"US"
}
}, function(err, res){
if(err) return err
txId = res.data[0].id
})
C. Retrieve routing and label
ubivar.labels.retrieve(txId, function(err, res){
if(err) return err
status = res.data[0].status
})
Resources, actions, and arguments
Every resource is accessed via your ubivar
instance and accepts an optional
callback as the last argument. In the matrix below we list the resources
(rows), the actions (columns) and the arguments (cells). The full documentation
is available at
https://ubivar.com/docs/nodejs.
Filter parameters
Filter | Default | Example | Description |
---|
start_after | | {"start_after":10} | id after the one specified |
end_before | | {"end_before":10} | id before the one specified |
limit | 10 | {"limit":10} | At most 10 returned results |
gt | | {"id":{"gt":10}} | id greater than 10 |
gte | | {"id":{"gte":10}} | id greater than or equal |
lt | | {"id":{"lt":10}} | id less than |
lte | | {"id":{"lte":10}} | id less than or equal |
Configuration
ubivar.set("auth", "your-api-token")
ubivar.set("timeout", 20000) // in ms
, node's default is 120000ms
Issues and feature requests
Development
To run the tests, you will need a Ubivar test API key (from your Ubivar dashboard)
export UBIVAR_TEST_TOKEN="your-test-api-key"
npm install -g mocha
npm test
Note: on Windows, use SET
instead of export
for setting the UBIVAR_TEST_TOKEN
environment variable.
Author
Originally inspired from stripe-node. Developed by Fabrice Colas (fabrice.colas@gmail.com). Maintained by Ubivar.