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
- Transaction:
- Has a foreign key to
Userfor linking the user making the transaction. - Has a foreign key to
ProductPurchasedto associate a specific purchase. - Has a foreign key to
PaymentMethodfor the payment type used. - Has a nullable foreign key to
Addressfor shipment details. - ProductPurchased:
- Has nested relationships with purchased cart items and coupons.
- PaymentMethod:
- Contains the method used for payments (e.g., credit card, PayPal).