Payment Transaction
Payment and invoice transaction entity
Payment and invoice transaction entity
Records all payment transactions including invoices, payments, and refunds.
Fields
Field Registry (from workspace/sources/entity-registry.csv)
| Field | Input Type | Required | Notes |
|---|
| Total | - | - | Total amount; model: total, rel: float |
| Currency | - | - | AUD; model: currency, rel: string |
| Reference Id | - | - | model: referenceId, rel: string |
| User | - | - | User Entity; model: user, rel: ManyToOne User |
| Course | - | - | model: course, rel: ManyToOne Course |
| Order Type | - | - | Corporate Subscription, Membership, Resource, Course, Event; model: orderType, rel: ManyToOne OrderType |
| Client | - | - | model: client, rel: ManyToOne ClientProfile |
| MemberProfile | - | - | model: memberProfile, rel: ManyToOne MemberProfile |
| Corporate Subscription | - | - | model: corporateSubscription, rel: ManyToOne CorporateSubscriptionPricing |
| Membership Subscription | - | - | model: membership, rel: ManyToOne MembershipPricing |
| Status | - | - | Pending, Paid, Failed; model: status, rel: ManyToOne OrderPaymentStatus |
Core Fields
| Field | Type | Required | Description |
|---|
| id | UUID | Auto | Primary key |
| userId | UUID | Yes | FK to Member |
| type | enum | Yes | membership, event, course, resource, job_posting |
| relatedEntityId | UUID | Yes | Related item ID |
Amount Fields
| Field | Type | Required | Description |
|---|
| amount | decimal | Yes | Subtotal |
| currency | string | Yes | Currency code (AUD) |
| taxRate | decimal | Yes | Tax percentage |
| taxAmount | decimal | Auto | Calculated tax |
| totalAmount | decimal | Auto | Total (amount + tax) |
| status | enum | Yes | pending, completed, failed, refunded, charged_back |
Invoice Fields
| Field | Type | Required | Description |
|---|
| invoiceNumber | string | Auto | Format: INV-YYYYMMDD-#### |
| invoiceDate | date | Auto | Invoice date |
| dueDate | date | Yes | Payment due date |
| taxReceiptGenerated | boolean | Auto | Receipt created |
Gateway Fields
| Field | Type | Required | Description |
|---|
| gateway | enum | Yes | stripe, braintree, square |
| gatewayTransactionId | string | No | Gateway reference |
| gatewayCustomerToken | string | No | Customer token |
| gatewayPaymentMethodToken | string | No | Payment method token |
Refund Fields
| Field | Type | Required | Description |
|---|
| refundAmount | decimal | No | Refund amount |
| refundReason | string | No | Refund reason |
| refundStatus | enum | No | pending, completed, failed |
| refundedBy | UUID | No | Admin who refunded |
| refundedAt | datetime | No | Refund timestamp |
System Fields
| Field | Type | Required | Description |
|---|
| createdAt | datetime | Auto | Creation timestamp |
| updatedAt | datetime | Auto | Last update |
| completedAt | datetime | No | Payment completion |
Relationships
| Relation | Type | Target Entity |
|---|
| user | ManyToOne | Member |
Features
Payment Transaction
Acceptance Criteria
Frontend
Backend / API
Permissions
Business Rules
Error Handling