Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including moltin with all npm packages installed. Try it out:

var moltin = require("moltin")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

moltin v2.2.0

SDK for the Moltin eCommerce API

Moltin JavaScript SDK

The Moltin Javascript SDK is a simple to use interface for the Moltin eCommerce API to help you get off the ground quickly and efficiently within client and server applications.

WikiAPI docsmoltin.com

Installation

npm install --save moltin

JavaScript

import { gateway as MoltinGateway } from 'moltin';

Node.js

const moltin = require('moltin');

Usage

To get started, instantiate a new Moltin client with your store credentials.

Note: This requires a Moltin account.

JavaScript

const Moltin = MoltinGateway({
  client_id: 'XXX'
});

Note: If you're using webpack, you'll need to add the following to your projects configuration file.

node: {
  fs: 'empty'
}

Node.js

const Moltin = moltin.gateway({
  client_id: 'XXX',
  client_secret: 'XXX',
});

You can now authenticate with the Moltin service.

Moltin.Authenticate().then((response) => {
  console.log('authenticated', response);
});

Check out the wiki to learn more about authenticating and the available endpoints.

Development

The SDK is built with ES6 modules that are bundled into Node and browser compatible files using Rollup.

If you want to roll your own bundle, or make changes to any of the modules in src, then you'll need to install the package dependencies and build the dist files.

npm install
npm run build

You can learn more about Rollup, the API and configuration here.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free