0

I have a web app that will support multiple payment method/gateway such as pay via PayPal, Credit Card, Debit Card, and more.

Which scenario that probably fit for this case ?

1 Scenario

I only have 2 tables: Payments & Payment_Details

Payments will holds data such as price, user who paid, and what item. While the Payment_Details will have payment_id, method.

2 Scenario

I have 1 master/parent table and * childs table

table: Payments, Payments_PayPal, Payments_DebitC, Payments_CreditC, Payments_*

Please help me to understand which scenario that fits or probably what is your scenario if you are having this case.

Thanks

  • Do a search on single table inheritance and another one on class table inheritance. – Walter Mitty Mar 22 '18 at 17:19
  • Do scenario 1. Or perhaps a single table. – Rick James Mar 28 '18 at 15:48
0

Imagine in a scenario where you will accept a new method of payment. You will always have to go there in the data base and create a table besides go in the code and modify to accept the new table you have created. And for reporting? Will you need to make a JOIN with all the payment tables and to find out what the method of payment is? You will navigate among several tables to discover.

Believe, unless you act something very specific that did not mention the best scenario is to create a table of payment methods, another of payment details and another of payments. This way you will occupy less space and will take a lot of future work.

Technically speaking, the method table can have information such as link to the payment processor, description, tax and everything. I do not particularly understand the need to create a table for each payment method.

  • Hi, thank you for your response, what you said does make sense, just to be clear so you suggest to go with scenario 1 ? – Pramana Adi Putra Mar 22 '18 at 16:17
  • Exactly, this is the best way. I am seeing that it is new by the platform, if this is the answer of the question, it marks the right green below the voting buttons. – Márcio Eric Mar 22 '18 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.