Few questions, thinking about switching to moltin



Im currently using a different BaaS. I had a few questions about some specifics related to moltin:

  • Product images. Lets say I want to display 6 of my 100 products on my home screen. And lets say its the 6 latest products. Once I make my api call to get all of these products, do I have to make 6 more api calls in order to get the images for each product? It seems a bit excessive to get the images in a separate api call when I’ve already got the product in one.

  • Carts. Do the carts act like a singleton? Can only one cart be active at a time?

  • Documentation. Is there any actual examples of the javascript sdk anywhere? There are a few spots in the docs it says something like “to get products, do Moltin.Products.All()”, but is there any code examples of checking out (with different providers), managing carts, etc.

  • Webhooks. Is there no customer creation webhook?

  • Authenticating. I’m assuming that Authenticate() is called once it stores the bearer token in localStorage so that all subsequent api calls will automatically have the bearer token in placed in the right spot. When the token expires, how does a new one get assigned?


Hey @meeoh :wave:

Welcome to the forum :slight_smile:

  1. You can with the JS SDK call Moltin.Products.With('main_image').Limit(6).All(). This will return an included items object with your main images.

  2. You can use the API to create and add products to multiple carts. The JS SDK supports this. As shown below.

Moltin.Cart("{CART_REFERENCE}").AddProduct("{PRODUCT_ID}", 1).then(cart => {
  // Do something
  1. Currently supported SDK methods are available within the API reference. You can see see a fully working React app that uses the JS SDK which might be further help getting you going using the SDK. https://github.com/moltin/react-demo-store

  2. Currently we don’t have a Customer observable but I will make mention this feature request to our engineering and product team.

  3. You don’t have to call Authenticate() directly as the SDK will perform a check to see if the token has expired. If the token has expired, we will silently authenticate using the credentials set inside, as shown below.

  client_id: 'XXX'

I hope this helps :smile: and please keep us updated with what you build using motlin :slightly_smiling_face:


Thanks for the detailed reply notrab! My only confusion still is with the carts. In my app, I want the user to only be able to have one cart at a time. Is there a way to ensure that they’re always using the same cart until checkout? I wouldnt want the multiple carts feature implemented.

Also, where can I find the docs that specify what the .With('...') parameters are?

And is there any tier between Developer and Pro? It seems like you’re either getting 30k requests for free and if you go over that then your paying $1000 a month.


Hi @meeoh

The default functionality of the SDK is to store the cart token in localStorage, so if you call the Cart().AddProduct("PRODUCT_ID") it will add the product to the same cart. You could also create a unique cart token via your application and store that yourself, to make sure you’re adding the product to the correct cart.

I should also mention that carts are persisted for 7 days from last update

Currently the API reference covers the includes. I’ll make an issue to document this with the JS SDK. The current supported include are; main_image, files, brands, categories, collections

Please reach out via Intercom on our website to discuss pricing :slight_smile:


Hmm, the case I’m thinking of is:

  • I log into my website from computer A
  • Add some items to my cart
  • Log in from computer B
  • Is the cart from computer A lost if I dont store the token my self? Or does moltin have something like a getLatestCart() method that will return the newest cart


Hey @meeoh

You could make use of the customer resource and Flows. You can use Flows to extend the customer resource and attach additional fields and data to customers.

If you stored the Cart ID with a Customer, next time they login from another computer, you can get the latest Cart ID and use that for adding carts. Carts will still expire 7 days from last update, so something to keep in mind.

I’ve attached some screenshots below which display this functionality from inside the moltin Dashboard.

  1. Create a flow with the slug customers

  1. Create a Field on the Customers Flow with the slug ‘cartId’ (or any naming you prefer)

  1. Manage customers, customer tokens and updating customers via the API. See the API reference for implementation details.

As an added bonus you can view custom field data inside the moltin Dashboard, as shown below.

Hopefully this helps, this is a great use case for Flows and something I’ll add to my personal todo list and get a video/article created to share this functionality.



Awesome, looks very interesting, thanks for the responses :slight_smile:


No problem, if there’s anything else we can do to help, please reach out here :slight_smile:

I’ll go ahead and mark this topic as solved. :tada:


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.