This is a client library to access the Gumroad API. This client uses promises.
var Gumroad = require("gumroad-api");
var gumroad = new Gumroad({
token: "<your-gumroad-token>"
});
Reference: https://gumroad.com/api#products
gumroad.listProducts()
.then(function(products) {
...
});
gumroad.createProduct({
"name": "..."
})
.then(function(product) {
...
});
gumroad.getProduct("my-product-id")
.then(function(product) {
...
});
gumroad.updateProduct("my-product-id", {
// infos
})
.then(function(product) {
// Product has been updated
});
gumroad.toggleProduct("my-product-id", false)
.then(function(product) {
// Product has been disabled/enabled
});
gumroad.deleteProduct("my-product-id")
.then(function() {
// Product has been deleted
});
Reference: https://gumroad.com/api#offer-codes
gumroad.listOffers("product-id")
.then(function(offers) {
...
});
gumroad.createOffer("product-id", {
"name": "..."
})
.then(function(offer) {
...
});
gumroad.getOffer("product-id", "offer-id")
.then(function(offer) {
...
});
gumroad.deleteOffer("product-id", "offer-id")
.then(function() {
// Offer has been deleted
});
gumroad.updateOffer("product-id", "offer-id", {
// infos
})
.then(function(offer) {
// Offer has been updated
});
Reference: https://help.gumroad.com/customer/portal/articles/1579327-license-keys
gumroad.verifyLicense("my-product-id", "license-key")
.then(function(license) {
// License is OK
}, function() {
// License verification failed
});
Reference: https://gumroad.com/api#sales
gumroad.listSales("after-date", "before-date", "page-num")
.then(function(sales) {
...
});
gumroad.getSale("sale-id")
.then(function(sale) {
...
});