Design DB to Implement Subscriptions using Razorpay


Guys, I need your help.
I am implementing monthly subscriptions in my app. I am using razor pay to achieve this.

Right now, I am using their APIs to create subscriptions and using webhooks I am capturing all the payment and subscription events information and storing them in a subscription table. This table has all the information from when subscription starts till its completion.

All the above records will be for a single user.

My question is whether this structure is good enough and scalable, or should I design my DB differently?

Another approach which I am thinking of is to have this table as is and store subscription status, start date and end date in user table and use them when needed.


Only one object tracks everything?

What do you mean by one object?

Currently, whenever an event happens I am storing all the information in a table.

When you say table you are referring to one data type with all of the fields right?

Yes. This is the table structure

Flat objects scale well :+1:t2:

1 Like

Thank You.

To check user’s subscription status, would you recommend storing subscription status, subscription period in user table?

I would recommend

  • Setting privacy rules
  • Place heavy data in a satelliteObject, as well as, confidential data
  • Just place fields on the object that will be displayed on RGs …. the rest to satellites
1 Like