title: Integrating payment methods in db schemas
body: <p>I have a requirement where I need to create A database where a user can have multiple payment methods and against those multiple payment methods multiple transactions can be processed.</p>
  
  <p>I have created the following schema</p>
  
  <p><a href="https://i.stack.imgur.com/LRp9C.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LRp9C.png" alt="enter image description here"></a></p>
  
  <blockquote>
    <p><strong>WHY THESE TABLES:</strong></p>
  </blockquote>
  
  <p><strong>user:</strong> This table contains information about the user. Ex: First Name, Last Name, Email etc</p>
  
  <p><strong>user_payment_method:</strong> Since a single user can have multiple payment methods I created a table to identify all the payment methods he has so that i can reference them in the transactions table and could know on exactly which payment method the transaction was made on.</p>
  
  <p><strong>transaction:</strong> This table contains all the data about all the transactions. Ex: Time, user_id, user_method_id, amount etc</p>
  
  <p><strong>payment_method:</strong> This table acts as a junction table(pivot table) to reference all the payment methods that could exist. Since all payment methods have different details I cannot make a single table for this.</p>
  
  <p><strong>specific payment method tables</strong>: Tables like bank_transfer and paypal contain the specific details the user has about that payment method. Ex: paypal keys or bank account numbers</p>
  
  <blockquote>
    <p><strong>THE PROBLEM</strong></p>
  </blockquote>
  
  <p>I am stuck at creating a relationship between <code>payment_method</code> and <code>specific payment method tables</code>.</p>
  
  <p>How do I reference different payment methods within a single column in the payment_method table. Do i create a junction(pivot) table for each specific payment method?</p>
  
  <p><strong><em>EDIT</em></strong>: If anyone has a simpler different approach please let me know too I am open to all ideas.</p>