-1

So here is what I am trying to do. The user can buy a particular course that runs from 15th April to 18th August. A user can also join in the middle (for example June) but will have to pay the same amount. Now, I want to end the validity of all the purchases on 19th August and restart running the course from 20th. How can I implement this? Is there really any way to implement this?

2 Answers2

1

Instead of selling courses you need to sell timed keys(licenses?) that give access to the course.

Any key purchased after April has an end date of August.

Any key purchased after August has and end date of April.

Thus only one course is ever created, and your keys grant access based on there time frames.

But because you probably don't want people that purchased a key in April/2021 to have access to the course in April/2022 you will need to create a key for each time frame. This is not unlike the other solution but this way you have separated the course from the time frame. Which will lend to greater flexibility, like a key that grants access to multiple courses. Instead of a course that grants access to multiple courses which makes far less sense.

EDIT small in-depth explanation using java objects.

public class Course{
   public long id; //id for the course
   public String name; // name of the course for display
}
//one per purchasable item
//once a item is no longer purchasable a new Key will need to be made 
//with the new values.
public class Key { 
   public long id;
   public String name; //optional name for a bundle of courses.
   public long startDate; //state date in epoch
   public long endDate; //end date in epoch
   public String price; // price of the key
   public List<Course> courses; // list of all courses this key provides access to.
}
public class User {
   public long id;
   public String username;
   public String email;
   public List<Key> keys; // List of current keys user has access to.
}

When the user logs in, the app will have access to the users keys. The app will then pull all courses from the set of keys the user has.

avalerio
  • 2,072
  • 1
  • 12
  • 11
0

Create a new in-app product for each course, activate it on the date when they can start purchasing it and deactivate it when it is too late to buy.

from56
  • 3,976
  • 2
  • 13
  • 23
  • But that will result in multiple instances of the same course in the list of courses. –  Jul 25 '21 at 13:14
  • No, the user will only be able to buy activated in-app products, it is assumed that from the same course you will only have one activated at a time, I propose this solution because selecting an expiration date as you want is not possible in the Google Play Console ... and even less a restart date – from56 Jul 25 '21 at 19:06
  • Who has bought the April course will have to pay again to follow the August course as well ? – from56 Jul 25 '21 at 19:11
  • Having multiple instances of the same course isn't bad if there is a distinguishing factor. ie Start and End date. You have effectively tied a time frame to the product thus it is a apart of the product and therefore different. – avalerio Jul 25 '21 at 20:45