title: Better way to design payment database with multiple payment methods
body: <p>I am trying to make a payment/transaction database for a pretend online store (just trying to learn). 1 payment can purchase 1 to many items. 1 payment can only have 1 payment method.</p>
  
  <p>To keep the example simple, there are 2 payment methods, PayPal and Bitcoin. Each payment method has different attributes, hence they must be different tables.</p>
  
  <p>I have my payments table which tells me what transaction bought what item/s. However, you can see that if the <code>paypal_id</code>is NULL then the <code>bitcoin_id</code> column is not. This means there are a lot of NULL's which I think is not a good design. How can I have good design in a case like this?</p>
  
  <hr>
  
  <p>paypal table</p>
  
  <pre><code>paypal_id | txn_id           | buyer_email    | amount
  1         | 3sd7fgudf23sdf34 | john@mail.com  | 50.00
  2         | 45shfik45345fg2s | mike@gmail.com | 100.00
  </code></pre>
  
  <hr>
  
  <p>bitcoin table</p>
  
  <pre><code>bitcoin_id | txn_id                     | amount
  1          | 34327yhujndreygdiusfsdf324 | 0.19203
  2          | sdfgurjibdsfhubhsdfinjo332 | 0.04123
  </code></pre>
  
  <hr>
  
  <p>items table</p>
  
  <pre><code>item_id | item name | price
  1       | ball      | 50.00
  2       | shirt     | 50.00
  </code></pre>
  
  <p>payments</p>
  
  <pre><code>payment_id | item_id | paypal_id | bitcoin_id
  1          | 1       | 1         | NULL
  2          | 1       | 2         | NULL
  3          | 2       | 2         | NULL
  4          | 1       | NULL      | 1
  5          | 1       | NULL      | 1
  6          | 1       | NULL      | 2
  </code></pre>