i’m trying to set up the database structure for a marketplace platform, in this platform buyers can have their own shopping cart add multiple products from different sellers. The point with the shopping cart is facilitate the payment process and just make 1 payment for all their shopping cart. Then each seller gets transferred their respective amount for the items sold in the platform. I’m using Stripe Connect to process payments.
I need to track buyer full payment for all items in the shopping cart in case a buyer ask for full refund, and also I need to track each transfer to each seller in case a user ask for partial refund. Here is how I set up the database so far.
I need recommendations on how to set this up to get it the most automated as possible.
Database structure is a big work and cannot be done with just a forum reply post. I suggest you to hire some experienced bubbler for a few hours to help you with the db design.
The point of positing in the bubble forum is to share insights and recommendations between users and not to promote our services as developers. The reason I posted in the forum is to avoid hiring someone and spend extra money so I would appreciate if you could add any value to the post with your reply.
Instead of having list of shopping card on the User, I will have only Active Order (type Order) field on the user.
I will create an Order data type that will hold list of cart items for a payment since a user can always create different cart items and pay for them from time to time, and in the future might want to process a refund on a particular order that was made in the past. This data type will have a status field that can tell you if it is paid, inprogress, refunded, partially refunded etc
then I will create a Cart Item data type just as you currently have it.
I can add a Refund data type that keeps track of refunds, and this data type will have a fields such as Order - so that you can know the order you are refunding for, amount refunded, and even the list of cart item (incase of you are not refunding for the whole list of cart items in that order)
This may not cover you whole use case, but it can give you a good head start.
But I wonder why you want to have Transfers and Transactions data type since all the amount, product owner, are contained in the other data types already.