Frontend API

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.

swell.init('<store-id>', '<public_key>')
Note: swell.auth() was renamed to swell.init() in v1.3.0.

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.

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

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