I can specify a "Trial day count" for an edition and a new Edition ("Free Edition") after the subscription expires. When I create a tenant on the edition, there is a checkbox for "Unlimited time subscription", and, if unchecked, I can enter a "Subscription end date". I'm confused about why this option is there and how it relates to the "trial day count" of the edition.
My understanding is that, after the "Trial day count" plus any "Waiting days after expire days", if the user has not entered payment by clicking on the to "Extend" or "Upgrade" subscription button, it would move them to the "Free edition".
I've got 2 questions:
- When and how does the action to move the tenant to the "Free edition" happen? Is this the first time they try to login after their subscription expires? Or is there some background task running that does this after the account expires automatically?
- What is the point of setting a "Subscription end date" when you create the tenant on an edition with a "Trial day count"? Shouldn't that just get set automatically based on the create date for the tenant and the "Trial day count"? Is the "Trial day count" just ignored if you set the "Subscription end date" to a date beyond the "Trial day count" (or if you set it to Unlimited?)
Thanks in advance for explaining this to me.
-Eric Pulaski
3 Answer(s)
-
0
Hi @eric_pulaski
Below is an explanation of how subscription expiration, trial periods, and the Free Version rollback process work in ASP.NET Zero.
When and how is a tenant moved to the Free Edition?
The tenant is not moved to the Free Edition during login. Instead, this is handled by a background worker that runs automatically.
ASP.NET Zero includes a background worker:
SubscriptionExpirationCheckWorkerYourProjectName.Core/MultiTenancy/Subscription/SubscriptionExpirationCheckWorker.csThe worker runs once every hour
It finds tenants where:
SubscriptionEndDateUtcis in the past- Tenant is active
- Tenant has an Edition
It then checks whether the Waiting Day After Expire grace period has passed
Only after both the subscription end date and waiting days have elapsed does it take action
At that point, it calls:
TenantManager.EndSubscriptionAsync(...)What happens in
EndSubscriptionAsyncThere are two distinct behaviors:
Tenant is not in trial period
AND the edition has an ExpiringEditionId (e.g., Free Edition)
- The tenant is moved to the Expiring Edition
SubscriptionEndDateUtcis cleared- Tenant remains active
This is how tenants are automatically downgraded to the Free Edition.
Tenant is in trial period
- The tenant is not moved to another edition
- The tenant is simply marked as inactive
This distinction is intentional by the code.
Why can you set a Subscription End Date when creating a tenant on an edition with a Trial Day Count?
Because Trial Day Count and Subscription End Date serve different purposes.
Trial Day Count (Edition level)
- Defined on the Edition
- Used only during self-registration
- Automatically calculates the subscription end date as:
Now + TrialDayCountThis logic exists in
TenantRegistrationAppService.Subscription End Date (Tenant level)
Used when an admin manually creates a tenant
Gives the admin full control
Can be:
- Any custom date
- A long term date
- Or Unlimited (null)
When creating a tenant manually, the system does not auto calculate the end date from Trial Day Count. Instead, the manually entered value takes precedence.
Direct answers to the sub questions
Should the Subscription End Date be set automatically from Trial Day Count?
- Only during self registration
- Not during manual tenant creation
Is Trial Day Count ignored if I set a custom date or Unlimited?
- Yes
- A manually entered Subscription End Date override Trial Day Count
- If Unlimited time subscription is selected,
SubscriptionEndDateUtcis set tonull, and the tenant is never processed by the expiration worker
If these explanations do not fully address your question, please do not hesitate to reach out for further clarification.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Thanks for the explanation. This cleared a lot of things up for me, and I really appreciate you taking the time to give me such a clear and detailed response.
I have a few follow-up questions:
In your explanation above, what is the definition of “trial period”, as in “Tenant is not in trial period”? For example, does it look to see if there was ever a payment on the account to figure out that the tenant is no longer in a trial period when their subscription runs out?
We are integrating with Stripe. What is the recommended way to
a. Setup recurring billing and connect an Edition to a product in Stripe? For monthly billing, I’m guessing that the Subscription end date would get reset every month each time the user successfully completes a monthly payment in Stripe? Do we need to write custom code to do this in the Stripe event handler in ASP.NET Zero, or is there a way to set this up without customizing the event handling code in ASP.NET Zero?
b. Setup the purchase of add on SKUs other than Upgrades to a new Edition. For example, if we wanted to charge customers for “Add-on Users” using a Feature for “User count”. It looks like this would all need to be through custom code we would need to write, but I’m just wondering if there are any build in-features (for example, a way to offer a “Additional Users” when the user goes to upgrade their subscription, without writing all the code from scratch. We would like to modify the ASP.NET Zero code as little as possible, but we do need to support an add-on SKU that’s the user can purchase that is not an Edition upgrade.
Thanks in advance for your additional help!
Best,
-Eric
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi @eric_pulaski
This ticket question has been answered. If you have any further questions, you can continue here. Thank you.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)