Data Structure for eCommerce Subscriptions

:wave: thanks in advance for the help with this. I’ve built out a wholesale ecommerce app, and am trying to add the ability to create product subscriptions. I’m at a bit of a crossroads on the best way to accomplish this.

What I’m trying to do: A customer can subscribe to a recurring order, which contains a set of products.

For data types, I’m thinking:

  • Product
  • Subscription
  • Order
  • Order Items

Here is where I’m not sure how to proceed. Upon signing up for the subscription, I can do 1 of 3 things (if you can think of another better option, please share!):

  1. Create a subscription, and schedule order and order items created on a backend workflow at the specified cadence. This backend workflow would schedule the next one, and this would keep going until the subscription is cancelled.
  2. Create a subscription with a list of order dates, or just a next order date. Every day (or with a recursive workflow) the app would look for subscriptions that have an order date that day. For every subscription with an order date on that day, it would create a new order and order items.
  3. Create a number of orders and order items to some far out point in the future. Upon editing or cancelling a subscription, I would be deleting or editing all of these. The problem (beyond having a lot of orders taking up a lot of space) is that at some point I’ll have to create more orders and order items, leaving me at the same place as the other two options.

Thanks again for any and all help on this, and definitely up for other ways to tackle this as well. At this point I’m just a bit hesitant to trust all of this to happen with backend workflows, which is the only reason to choose option 3, but will mean I’ll have to answer the backend workflow problem at a later date.

1 Like