0.0.3 • Published 5 years ago

process-order v0.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

process-order

Process orders using express for PayPal etc. easily. More coming soon.

Status: In Progress

Config:

var config = {
  endpoint: {
    url: "<your project link goes here>",
    api: "process"
  },
  keyLength: 16,
  decimals: 2,
  expressPort: 3000,
  paypal: {
    "mode": "sandbox", //sandbox or live
    "client_id": "<client_id>",
    "client_secret": "<secret_key>"
  }
};

Usage:

var Order = require("process-order");
var app = new Order(config, express); // express is optional
var result = app.paypal({
  items: [{
    name: "AN-ITEM",
    sku: "AN-ITEM",
    price: 23,
    quantity: 1
  }],
  currency: "USD",
  return: function(request, response, id) {
    response.send("processed: " + id);
  },
  cancel: function(request, response) {
    response.send("cenceled");
  }
});
result.then(function(link) {
  console.log("authorization link: " + link);
}).catch(function(error) {
  console.log(error);
});