SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Oct 2003
    Posts
    245
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Handling Payment

    What is a good way to handle payment transactions to the database?

    I came up like this:

    Orders Table
    - OrderID (primary key)**
    - MemberID (FK)
    - OrderTotal
    - Status (Pending, Processing, Completed, cancel) //Order Status
    - Paid (0, 1, 2) //0 Not Paid, 1 Paid, 2 Refund

    order_payment Table
    - PaymentID (primary key)
    - OrderID (related to Orders table)
    - DateTransaction
    - TransactionStatus

    If there is a row of order_payment.TransactionStatus = 'Sucess' then Orders.Paid become 1
    If TransactionStatus = 'Decline' then Orders.Paid will still remain 0 as default

    order_payment table are updated via payment gateway
    [Home Sweet Home]

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,022
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    that looks okay to me
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •