Node.js
Our simple, straightforward API gets you up and running quickly.
-
1
Install
-
2
Set API Keys
-
3
3. Try Examples
The Node.js SDK is registered with NPM and can be installed with the npm command line which comes packaged with the Node.js binary.
Install using npm:
npm install simplify-commerce // Add -g flag to install the module globally (You may need to run this command as sudo)
Alternatively, you can download the module from our site and install it directly.
Set your API Keys
After logging into your account, your API keys can be located at: Settings -> API Keys
To set your public and private API keys do the following:
Simplify.getClient({
publicKey: 'YOUR_PUBLIC_API_KEY',
privateKey: 'YOUR_PRIVATE_API_KEY'
});
Try Examples
Charging a card
You can charge a card in 2 ways. Once you have generated a card token using simplify.js, you can charge the card using the token. Alternatively, you can also charge a card by passing the card details.
For more information on the simplify.js go to Payments Form
var Simplify = require("simplify-commerce"),
client = Simplify.getClient({
publicKey: 'YOUR_PUBLIC_API_KEY',
privateKey: 'YOUR_PRIVATE_API_KEY'
});
client.payment.create({
amount : "1000",
token : "f21da65e-f0ab-45cb-b8e6-40b493c3671f",
description : "payment description",
currency : "USD"
}, function(errData, data){
if(errData){
console.error("Error Message: " + errData.data.error.message);
// handle the error
return;
}
console.log("Payment Status: " + data.paymentStatus);
});
var Simplify = require("simplify-commerce"),
client = Simplify.getClient({
publicKey: 'YOUR_PUBLIC_API_KEY',
privateKey: 'YOUR_PRIVATE_API_KEY'
});
client.payment.create({
amount : "123123",
description : "payment description",
card : {
expMonth : "11",
expYear : "99",
cvc : "123",
number : "5555555555554444"
},
currency : "USD"
}, function(errData, data){
if(errData){
console.error("Error Message: " + errData.data.error.message);
// handle the error
return;
}
console.log("Payment Status: " + data.paymentStatus);
});
For more examples see the api documentation or our tutorial