The library can be used in any bundled JavaScript application, in server or client contexts.

Add swell-js dependency to your project:

Add swell-js dependency to your project:
yarn add swell-js

The client uses your store ID and public key for authorization. You can find these in your dashboard under Settings > API.

import swell from 'swell-js'
// Initialize client with your store ID and a public key
swell.init('<store-id>', '<public_key>')

If your application uses camelCase, you can set a flag to transform the API's snake_case responses. This works on objects you pass to it as well.

Example
const options = {
  useCamelCase: // true | false (default is false)
};

swell.init('<store-id>', '<public_key>', options)