README
node-paddle
node-paddle
is an unofficial API for Paddle's vendor dashboard. This module was built because Paddle currently does not have an API for these features. If they ever implement an official API, I will update this module either to use that API or make these functions deprecated.
Important
- This module is slow. It is technically a web browser that's logging into the vendor dashboard and doing these actions for you. I don't recommend that you use it directly on a website, instead do these operations behind the scenes and send the results to the user by e-mail.
- Security is not a guarantee. As mentioned above this module will do actions on the vendor dashboard on your behalf. Neither I or Paddle are responsible for the safety of your credentials when using this module, keep them safe!
- This is an unofficial API, and is not endorsed by Paddle. Because of this, it's important to remember that there's a risk that an API may stop working when Paddle do updates to their vendor dashboard.
How it works
node-paddle
uses a framework called Zombie, that's originally made for testing client-side web projects in a simulated environment. In other words, it lets you browse the web in a fake browser.
When using a method in this API, the module is basically logging into the vendor dashboard and doing automated tasks on your behalf.
Getting started
First of all, install the module via npm:
npm install --save node-paddle
Require the module in your code and make a new instance of the module:
var Paddle = require('node-paddle'),
paddle = new Paddle();
Next you will have to use the login
method before doing any tasks. Make sure that you keep your credentials safe and don't upload them to a repository by accident or similar. One suggestion is inserting them via environment variables.
paddle.login(EMAIL, PASSWORD, function(err) {
if (!err) {
// Successfully logged in
} else {
// The login failed, wrong credentials?
}
});
Now you're ready to do some tasks! Read the documentation below to find out what you can do.
API Reference
login(email, password, callback)
email
- The e-mail adress you use to sign in on the vendor dashboard.password
- Your password.callback
- An anonymous function with one argument:err
- If an error occurs, this will be an object containing aerror
andmessage
property. If there were no errors, this argument will benull
.
findLicencesWithEmail(email, productId, callback)
This method will search licence keys that have been used with an e-mail adress. It's currently not possible to search unused licence keys.
email
- The e-mail adress you want to search for.productId
- The ID of the product you want to find a licence for. It can also be an array of product IDs.callback
- An anonymous function with two argumentserr
- If an error occurs, this will be an object containing aerror
andmessage
property. If there were no errors, this argument will benull
.result
- An array with found licence keys. Each licence is an object with the following properties:licence
- The licence key.product
- Name of the product the key can activate.active
- A boolean showing if the key is active or not.isBatch
- A boolean showing if the key is a part of a batch.allowedUses
- How many times the key can be used.timesUsed
- How many times the key has been used.