Data Structure
List Transactions
Retrieve a paginated list of transactions.Query Parameters
The API supports the following query parameters using Spatie Query Builder:Filtering
- Simple Filters:
- Range Filters:
- Multiple Values:
- Complex Filters:
Including Relationships
You can include related models in the response:site- The site this transaction belongs touser- The user who initiated this transactionorder- The order associated with this transaction
Sorting
Sort results by one or multiple fields:created_atupdated_atamountstatustypeprocessor
Selecting Fields
Select specific fields to return:Append Computed Attributes
Include computed attributes in the response:processor_feenet_amountrefundable_amountrisk_level
Pagination
Control the number of results per page:Create Transaction
Create a new transaction record.Validation Rules
| Field | Rules |
|---|---|
| order_id | Required, exists in orders table |
| processor | Required, valid payment processor |
| amount | Required, numeric, min:0.01 |
| type | Required, valid transaction type |
| processor_token | Required for new payments |
| processor_card_id | Required for saved cards |
Get Transaction
Retrieve details of a specific transaction.Refund Transaction
Process a refund for a completed transaction.Void Transaction
Void a pending or processing transaction.Relationships
BelongsTo Relationships
site- The site this transaction belongs touser- The user who initiated the transactionorder- The order associated with the transaction
Transaction Types
- Sale
- Standard payment transaction
- Creates a new charge
- Requires payment details or saved card
- Refund
- Refunds a previous sale
- References original transaction
- Can be partial or full amount
- Void
- Cancels a pending transaction
- Must be within processor timeframe
- No financial impact
- Free
- Zero-amount transaction
- Used for free orders
- No payment processing needed
Transaction Status Flow
Security Considerations
- Payment Data Protection
- Payment details are never stored
- Processor tokens are short-lived
- All amounts are validated
- Response data is sanitized
- Access Control
- Transactions are site-scoped
- Refunds require special permissions
- Void operations are time-limited
- Full audit trail is maintained
- PCI Compliance
- No card data in logs
- Secure token transmission
- Regular security scans
- Employee training required
Error Handling
HTTP Status Codes
- 401 Unauthenticated
- 403 Unauthorized
- 404 Not Found
- 422 Validation Error
Processor-Specific Errors
- Card Declined
Best Practices
- Transaction Processing
- Use idempotency keys
- Validate amounts before processing
- Handle timeouts gracefully
- Implement retry logic
- Monitor success rates
- Security
- Regular security audits
- Monitor unusual patterns
- Implement rate limiting
- Track IP addresses
- Validate request origins
- Performance
- Optimize database queries
- Cache processor responses
- Use background jobs
- Monitor processing times
- Set proper timeouts
- Compliance
- Maintain audit logs
- Follow data retention policies
- Regular compliance reviews
- Document all procedures
- Train support staff
- Error Handling
- Proper error logging
- User-friendly messages
- Consistent error format
- Recovery procedures
- Support documentation
- Reconciliation
- Daily balance checks
- Automated reconciliation
- Discrepancy alerts
- Regular reporting
- Clear documentation

