GET /api/transactions/:id
Retrieves detailed information about a specific transaction. The transaction must belong to the authenticated user, otherwise a 404 error is returned.Authentication
This endpoint requires authentication. Include a valid JWT token in the Authorization header:Path Parameters
The unique identifier of the transaction to retrieve.The transaction must belong to the authenticated user. If the transaction doesn’t exist or belongs to another user, a 404 error is returned.
Example Request
Response
Returns a single transaction object with all details.The unique identifier for the transaction.
The ID of the user who owns this transaction. Always matches the authenticated user’s ID.
The type of transaction:
"Comprar" (Buy) or "Vender" (Sell).The base amount in USD before commission.
The commission amount in USD that was applied to this transaction.Commission is calculated based on the amount:
- 9.99: $0.80
- 14.99: $1.00
- 25: $1.40
- Above 1.40 + (25))
The final amount in USD after applying commission.
- For Comprar (Buy):
amount_usd + commission_usd - For Vender (Sell):
amount_usd - commission_usd
The exchange rate in Bolivares (Bs) per USD that was used for this transaction.
The total amount in Bolivares, calculated as
total_usd * rate_bs.The unique payment reference number for this transaction.
The current status of the transaction. Common values:
"Pendiente"(Pending) - Transaction created but not yet processed"Completada"(Completed) - Transaction successfully processed"Cancelada"(Cancelled) - Transaction was cancelled
The payment method used for this transaction.Common values:
- “Pago Móvil” (Mobile payment)
- “Transferencia” (Bank transfer)
- “Zelle”
- “PayPal”
The recipient account information associated with this transaction.Format varies by payment method:
- Phone number for Pago Móvil (e.g., “0414-1234567”)
- Email for Zelle/PayPal (e.g., “[email protected]”)
- Account number for bank transfers (e.g., “0102-1234-5678-9012”)
The timestamp when the transaction was created (ISO 8601 format).
The timestamp when the transaction was last updated (ISO 8601 format).
Success Response Example
Error Responses
Returned when the authentication token is missing, invalid, or expired.
Returned when the transaction ID doesn’t exist or belongs to a different user.This error is returned in two scenarios:
- The transaction ID doesn’t exist in the database
- The transaction exists but belongs to another user (security measure to prevent enumeration)
Returned when an unexpected server error occurs.
Implementation Details
Security
The endpoint implements authorization at the database level. The query includes both the transaction ID and the authenticated user’s ID:- Users can only access their own transactions
- Transaction IDs of other users cannot be enumerated
- Both missing and unauthorized transactions return the same 404 error (security best practice)
Use Cases
Transaction Details Page
Display complete transaction information on a dedicated details page:Verify Transaction Status
Check if a transaction has been processed:Refresh Transaction Data
Fetch the latest data for a transaction after an update:Generate Receipt
Use transaction details to generate a receipt or invoice:Related Endpoints
- Create Transaction - Create a new buy or sell transaction
- List Transactions - Get all transactions for the authenticated user