M
M
Michael2020-02-12 22:41:46
Database design
Michael, 2020-02-12 22:41:46

How to implement a paid subscription system?

Hello. It is required to implement a system of paid subscriptions. How to implement this in terms of the database?
I had an idea to make 2 tables: with all possible subscriptions and with those already issued, but I don't understand how to store the rights for each of the subscriptions.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xmoonlight, 2020-02-13
@Kodaf

1. Table of all criteria: id, min, max, desc
2. Table of restrictions (permissions):
id, "depends on the restriction (parent):ID", "criteria1:ID", ..., "criteriaN:ID", ACL
3. Table of access rights to resources:
id, itemID, typeID, ACL
4. Table of paid user subscriptions: id, "parental restriction:ID", userID
, expiredAt (when expires)
the desired restriction for subscriptions (clause 2).
Based on the subscription id of the user restriction (item 4), we find the id of the restriction (item 2).
Then, we check the summary ACL and the subscription expiration date.
Then - everything else according to the criteria and restrictions.

S
Sanes, 2020-02-12
@Sanes

An intermediate table from a many-to-many relationship. You can name subscriptions or orders.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question