How works the plans subscriptions in Midrub
If you want to use Midrub as SAAS service, you have to understand very well how works the plans subscriptions.
Your clients could pay in 3 ways for your services provided in Midrub:
- Short time manual payments(For example, monthly).
- Long time manual payments(Instead to pay monthly, your client could pay yearly).
- Recurring payments(The client's money will be taken automatically from his credit card).
Once per day, the Cron Job verifies for plans subscriptions expiration. If a plan has (5 - 0) days to left, the client will see a notification in his Dashboard. If the client has a recurring payments subscription, the notification won't be displayed.
If you've developed your apps and want to display the plan expiration notification, you can use this code:
if ( the_user_option( 'subscription', $user_id ) ) {
// This means the user has a recurring payments subscription
}
This code could be used to hide the notification, because the client has a subscription with recurring payments and it should be renewed automatically.
If the client's plan subscription has (5 - 0) days to left, every day will be executed a hook https://www.midrub.com/articles/user-plan-subscription-expires
If the client's plan subscription has been expired, every day will be executed a hook https://www.midrub.com/articles/user-plan-subscription-expired
With plugins you can control these hooks based on your needs.
At this moment, after 10 days of the plan's subscription expiration, the subscription will be cancelled. The client's plan will be changed to default.
The default plan has ID 1 and it never should be deleted. The default plan could have enabled only the Plans app(available in my newest projects). Or you can create your custom app for expired plans and redirect the client there.
If the client deletes the recurring payments subscription, his plan will be changed automatically to default(for some payments gateways only). Same if the client don't has money on his credit card.
If a user sign in and don't has a plan, automatically has the default plan.
In the video below you can see how works the recurring payments with PayPal. User could cancel the automatic payments but his plan won't be changed because the user has paid for the current period. Just will be deleted his recurring payments records from the database.