A basic shoppy API wrapper
- Easy usage of the shoppy API
- Easily integratable
- Support for webhooks
- Automatic validation of webhook requests
Current stable release (1.x
)
$ npm install shoppy-api
Here are some few examples of how you can use the API and how it looks like when in use
const { ShoppyAPI, WebhookAPI } = require('shoppy-api');
// OR
const shoppy = require('shoppy-api');
const { ShoppyAPI } = require('shoppy-api');
const API = new ShoppyAPI('your-token-here');
let page = 1;
API.orders.all(page);
const { ShoppyAPI } = require('shoppy-api');
const API = new ShoppyAPI('your-token-here');
let page = 1;
API.feedback.all(page);
const { WebhookAPI } = require('shoppy-api');
const webhook = new WebhookAPI('your-secret-here');
webhook.on('order:paid', (order) => {
console.log(`You received order: ${order.id}`);
});
webhook.getWebhookUrl().then((url) => { console.log(`Webhook now listening on ${url}`) });
// Incase your application does not prevent exiting of the script then you can add `process.stdin.resume();` here