Skip to content

Latest commit

 

History

History
73 lines (53 loc) · 1.42 KB

README.md

File metadata and controls

73 lines (53 loc) · 1.42 KB

Shoppy-API

A basic shoppy API wrapper

Features

  • Easy usage of the shoppy API
  • Easily integratable
  • Support for webhooks
  • Automatic validation of webhook requests

Installation

Current stable release (1.x)

$ npm install shoppy-api

Usage

Here are some few examples of how you can use the API and how it looks like when in use

Requiring

const { ShoppyAPI, WebhookAPI } = require('shoppy-api');
// OR
const shoppy = require('shoppy-api');

Orders

const { ShoppyAPI } = require('shoppy-api');

const API = new ShoppyAPI('your-token-here');

let page = 1;
API.orders.all(page);

Reviews

const { ShoppyAPI } = require('shoppy-api');

const API = new ShoppyAPI('your-token-here');

let page = 1;
API.feedback.all(page);

Webhook listening

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