Skip to content

ER Diagram

Payment Gateway ER Diagram


Overview

The ER diagram represents the relationships between the Transaction model and its related entities, including users, products, payment methods, and addresses.

Diagram

erDiagram
    TRANSACTION {
        int id PK
        int user_id FK
        int product_purchased_id FK
        string transaction_id
        int payment_method_id FK
        int shipment_address_id FK
        decimal shipping_cost
        decimal tax_amount
        decimal amount
        boolean status
        datetime created_at
        datetime updated_at
    }
    PRODUCT_PURCHASED {
        int id PK
        int user_id FK
        int applied_coupon_id FK
        decimal total_purchased
        decimal discounted_amount
        decimal grand_total
        boolean has_purchased_succeed
        datetime purchased_at
    }
    PAYMENT_METHOD {
        int id PK
        string method_name
    }
    ADDRESS {
        int id PK
        string address_line_1
        string city
        string state
        string postal_code
        string country
    }
    USER {
        int id PK
        string name
        string email
    }

    TRANSACTION ||--o{ USER : "belongs to"
    TRANSACTION ||--o{ PRODUCT_PURCHASED : "links to"
    TRANSACTION ||--o{ PAYMENT_METHOD : "uses"
    TRANSACTION ||--o{ ADDRESS : "ships to"

Key Relationships

  1. Transaction:
  2. Has a foreign key to User for linking the user making the transaction.
  3. Has a foreign key to ProductPurchased to associate a specific purchase.
  4. Has a foreign key to PaymentMethod for the payment type used.
  5. Has a nullable foreign key to Address for shipment details.
  6. ProductPurchased:
  7. Has nested relationships with purchased cart items and coupons.
  8. PaymentMethod:
  9. Contains the method used for payments (e.g., credit card, PayPal).