John S.
John S.

Reputation: 75

Website Transactions in MySQL Database

Good Day,

I'm currently designing database structure for a website of mine. I need community assistance in one aspect only as I never did something similar.

Website will include three types of the payments:

  1. Internal payments (Escrow kind payments). User can send payment to another user.
  2. Deposits. Users add fund to their accounts.
  3. Withdrawal. User can request a withdrawal. Money will be sent to their bank/PayPal account.

Basically, I need some tips to get the best design possible.

Here's what I'm thinking about:
deposits - this table will store info about deposits
deposits_data - this table will store info about deposit transaction (ex. data returned by PayPal IPN)
payments - table to store internal payments
withdrawals - table to store info about withdrawal request
transactions - table to store info about ALL transactions (with ENUM() field called type with following values possible: internal, deposit, withdrawal)

Please note that I have already a table logs to store every user action.

Unfortunately, I feel that my design approch is not the best possible in this aspect. Can you share some ideas/tips?

PS. Can I use a name "escrow" for internal payments or should I choose different name?

Edit
DEPOSITS, PAYMENTS and WITHDRAWALS tables store specific transaction details. TRANSACTIONS table stores only limited info - it's a kind of logs table - with a details field (which contains a text to display in user log section, ex: "User 1 sent you a payment for something")/

Of course I have users tables, etc.

Upvotes: 2

Views: 1488

Answers (1)

APC
APC

Reputation: 146179

Can I use a name "escrow" for internal payments or should I choose different name?

Escrow has a specfic financial/legal meaning, which is different from how you seem to mean it: "a written agreement (or property or money) delivered to a third party or put in trust by one party to a contract to be returned after fulfillment of some condition" (source)

So choosing a different name seems like a good idea.

As for design, what data will DEPOSITS, PAYMENTS and WITHDRAWALS store which TRANSACTIONS won't? Also, you need an ACCOUNTS table. Or are you planning to just use your existing USERS table (I presume you have such a thing)? You probably ought to have something for external parties, even if you only intend to support PayPal for the time being.

Upvotes: 1

Related Questions