Models
Payment Gateway Models
Transaction Table
The Transaction model represents financial transactions associated with a user's purchase.
Fields
| Field | Type | Required | Description |
|---|---|---|---|
user |
ForeignKey (User) | Yes | The user who made the transaction. |
product_purchased |
ForeignKey (ProductPurchased) | Yes | The purchased product or cart items. |
transaction_id |
CharField | Yes | Unique identifier for the transaction. |
payment_method |
ForeignKey (PaymentMethod) | Yes | Payment method used for the transaction. |
shipment_address |
ForeignKey (Address) | No | Address where the product will be shipped. |
shipping_cost |
DecimalField (max_digits=10, decimal_places=2) | No | Shipping cost for the order (default: 0.00). |
tax_amount |
DecimalField (max_digits=10, decimal_places=2) | No | Tax amount for the transaction (default: 0.00). |
amount |
DecimalField (max_digits=10, decimal_places=2) | Yes | Total transaction amount. |
status |
BooleanField | No | Indicates if the transaction was successful (default: False). |
created_at |
DateTimeField | No | Timestamp when the transaction was created (auto). |
updated_at |
DateTimeField | No | Timestamp when the transaction was last updated (auto). |
Meta
- Database Table Name:
tbl_transaction
String Representation
- Returns
{transaction_id} - {status}