Summary Matrix
| Attribute | Order | Transaction |
|---|---|---|
| Entity Scope | Merchant purchase agreement contract | 1-to-N Payment Gateway authorization/capture event |
| Created By | Ecommerce Storefront / Cart Checkout Engine | Payment Processor Gateway (Stripe, PayPal) |
| Data Points | Line items, shipping address, discounts, taxes | Gateway transaction ID, authorization code, card brand, risk score |
| Multiplicity | Single Order record (1) | Multiple Transaction records (N - Auth, Capture, Refund attempts) |
Key Difference
An Order is the merchant’s contract with the buyer detailing what was purchased. A Transaction is a specific financial payment attempt processed through a payment gateway.
A single Order can have multiple Transactions (e.g. an initial authorization, a partial capture, and a subsequent partial refund).
Developer Takeaway
1-to-Many Schema Modeling: Model transactions as a child array or separate table related to `order_id` via a foreign key, rather than storing gateway authorization IDs directly on the order row.