Subscription manager API

Hi community, I am new to monday app development and need a help regarding app_subscription_operations quaries.

For a feature based app with monthly subscriptions and usage limits (here after refer as credits) usage of the app need to be manually updated by the developer using the increase_app_subscription_operations. And as per the my current undestanding I can compare this incremental value with a hard coded package credit value in my app to see whether the user has more credits or not for that given period. Based on that can grant access to resourses. (If this approch is not ideal pl let me know).

Now the issue in a case if the user upgrade or downgrade the subscription then according to the docs monday will handle this in a prorate manner. But in such a case as the developer how can I know the prorated value. Do I have to do the calculation my self and keep track of it or is there a better approch for this kind of a situation.

Thanks.

Hello there @Shamika,

For monthly subscriptions, the counter resets monthly based on the renewal date. For example, if a subscription renews annually on the 15th of the month, the counter will reset on the 15th of each month.

As a possible scenario, let’s say you have an app with two plans (a basic plan for 100 operations a month, and a gold plan for 200 operations a month). Let’s say an account purchases the Basic plan on April 1st. They use 80 operations (out of 100) until April 15th. And on April 15th, they purchase the Gold plan. In this scenario:

  1. The account started with the basic plan (100 operations) on April 1st.
  2. They used 80 operations until April 15th.
  3. On April 15th, they upgraded to the gold plan (200 operations).

In this case, the renewal date changes to April 15th when they upgrade to the gold plan.

  1. The new renewal date becomes April 15th.
  2. The account can be given an extra 200 operations on April 15th.
  3. The 20 unused operations from the basic plan can roll over (meaning, that in total, after they purchase the new gold plan, the account can have 220 operations)

Again, on April 15th, you can give the account 220 operations in total (200 from the new gold plan + 20 rolled over from the basic plan). The new cycle will renew on the 15th of each month going forward (giving them 200 operations each month).

It’s important to note that the operations counter resets monthly based on the renewal date. So, on May 15th, they will receive 200 operations again, as per their gold plan subscription.

What do you think?

Looking forward to hearing from you!

Cheers,
Matias

Hi @Matias.Monday thanks for the reply

This made me clear on the counter reset part. But I do have a another issue attached with that.

I got that as a developer I have to manage the counter (manage in the sense incrementing based on usage, I did not find any other operation).

  1. I compare the the counter val [the value set by this operation increase_app_subscription_operations(kind: “${kind}”, increment_by: 1)] stored in monday storage with a hardcoded package details in my code (EX: If counter val from storage > hard coded val → revoke access ). Please feel free to correct me if this is wrong.
  2. According to doc this counter var name can be defined and its for the developer to decide.
  3. In a usual flow I know exactly when to increase this counter var per usage.
  4. But in a upgrade downgrade scenario who should alter the counter is it done by Monday internally for each var defined per tier per user or do I have to listen to each upgrade downgrade subscription webhook and change the counter accordingly.
  5. According to your example after upgrade on 15th the total credits need to be 220. This need to be the value of the counter in Monday storage. Who is going to add the remaining 20 to the new quota is the developer by listening to webhooks or will Monday do it.
  6. The reason for this confusion is the AI chat in the Monday dev always output results in a tone “not to change counter on upgrades and downgrades let monday handle it”. And I tested a upgrade scenario using the mock subscription API, there every time a change happens the counter fully resets.

Let me know if anything is not clear.

Cheers.