Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 91579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:03:07+00:00 2026-05-10T23:03:07+00:00

I have a system that creates an order and that order can be billed

  • 0

I have a system that creates an order and that order can be billed to a house account, sent Cash on Delivery (COD), or charged to a credit card. I’ve created the following tables:

ORDERS
order_id
billingoption_id

BILLINGOPTIONS
billingoption_id

I’m unsure of how the next table should be built for the billing data. Should I build a separate table for each type of billing option (ie. COD, Credit Cards, and House Account)? Then would I have another foreign key column on the Orders table that would refer to a record for the billing data?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T23:03:08+00:00Added an answer on May 10, 2026 at 11:03 pm

    You can do it either way: a big honking billingoptions table that has fields that encompasses all of the types, with NULLs for fields that don’t apply to a given type, or a bunch of baby tables that ‘star off’ of a parent billingoptions table. Both have their advantages and disadvantages.

    For the big honking table,

    • It’s nice that all data can easily be referenced in a single table.
    • Tracking foreign key dependencies and performing updates or inserts is efficent.
    • BUT you need to alter the table structure to add new billing options in the future, and there’s the possibility of invalid combinations of data being stored (for example, both a credit card type and a COD flag being set in the same record).

    For the small baby tables,

    • It’s nice that the data is partitioned and reflects your program’s object structure closely.
    • It’s nice that you can add new payment options or alter existing ones without worrying about affecting the others.
    • The relationships are VERY explicit. You can’t accidentally link a deposit with another deposit, since the foreign key will require that it be linked with an approval.
    • BUT you end up introducing a lot of tables into the design, which require lots of JOINs, can be a pain to navigate, and aren’t as efficient when it comes to inserts and updates.

    At work, we ended up going with small baby tables. It looks something like this:

     Table Orders: --> OrderId PK --> (Lots of Other Fields)  Table Payments: --> PaymentId PK --> OrderId (FK) [There may be more than one payment per order] --> PaymentType [Restricted field contains values like         'PAYPAL' or 'CREDIT', you use this to know which         baby table to look up that can contain additional         information]  Table PaymentsPayPal: --> PaymentPayPalId PK --> PaymentId FK points to Table Payments --> TransactionNo --> (Other PayPal specific fields)  Table PaymentsCheck: --> PaymentCheckId PK --> PaymentId FK points to Table Payments --> RoutingNo --> (Other e-check specific fields)  + other tables for remaining payment types.... 

    All of the payment types share three transaction related tables:

     Table PaymentApprovals: --> PaymentApprovalId PK --> PaymentId FK points to Table Payments --> Status [Some flag meaning 'Succeeded', 'Failed', 'Reversed', etc] --> ProcessorMessage [Something the service sent back, like '(M) CVV2 Matched'] --> Amount --> (Other administrative fields)  Table PaymentDeposits: --> PaymentDepositId PK --> PaymentApprovalId FK points to Table PaymentApprovals --> Status --> ProcessorMessage --> Amount --> (Other administrative fields)  Table PaymentRefunds: --> PaymentRefundId PK --> PaymentDepositId FK points to Table PaymentDeposits --> Status --> ProcessorMessage --> Amount --> (Other administrative fields) 

    All of our payment methods (Credit Card, PayPal, Google Checkout, Check, Cash, Store Credit, and Money Order) are abstracted to fit into this Approval –> Deposit –> Refund metaphor, and the UI calls the same methods on an IPayment and IPaymentProcessor interfaces with different implementations (CybersourcePaymentProcessor, PayPalPaymentProcessor, etc). The abstraction has worked pretty well over the past year and a half across these disparate methods, although sometimes the GUI will display different verbiage to the user (for example, it’ll say ‘Authorize’ and ‘Charge’ instead of ‘Approve’ and ‘Deposit’ for credit card payments, and the screen for entering cash performs the Approve/Deposit step in one fell swoop.)

    Hope that makes sense. It sounds like you’re not actually storing payment information, but it’s useful to think about where these things can end up.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We currently have a system that handles translation jobs. customer creates an order the
I have a guest order in my Magneto system that I need to now
I have a code that creates file(s) in user-specified directory. User can point to
I have created a newsletter system that allows me to specify which members should
We have system here that uses Java JNI to call a function in a
I have a system that takes dynamic data, puts it in HTML for layout
I have big system that make my system crash hard. When I boot up,
I have a system that runs like this: main.exe runs sub.exe runs sub2.exe and
I have a system that will generate messages sporadically, and I would like to
We have a system that has some Bash scripts running besides Java code. Since

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.