Moltin JavaScript SDK

A simple to use API interface to help get you off the ground quickly and efficiently with your Moltin JavaScript apps.
š Wiki ā š API docs ā š moltin.com
Installation
Install the package from npm and import in your project.
npm install --save @moltin/sdk
import { gateway as MoltinGateway } from '@moltin/sdk';
const moltin = require('@moltin/sdk');
Usage
To get started, instantiate a new Moltin client with your store credentials.
Note: This requires a Moltin account.
const Moltin = MoltinGateway({
client_id: 'XXX'
});
const Moltin = moltin.gateway({
client_id: 'XXX',
client_secret: 'XXX',
});
Note: If you're using webpack, you'll need to add the following to your projects configuration file.
node: {
fs: 'empty'
}
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.
Contributing
We love community contributions. Here's a quick guide if you want to submit a pull request:
- Fork the repository
- Add a test for your change (it should fail)
- Make the tests pass
- Commit your changes (see note below)
- Submit your PR with a brief description explaining your changes
Note: Commits should adhere to the Angular commit conventions.
Development
The SDK is built with ES6 modules that are bundled 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 the Rollup API and configuration here.