Get Transactions
Retrieve a paginated list of transactions for the authenticated user.
curl -X GET "https://api.cryptoshop.com/api/transactions?type=purchase&status=confirmed&limit=10&page=1" \
-H "Authorization: Bearer YOUR_TOKEN"
Query Parameters
Filter by transaction type. Options: purchase, refund, deposit, withdrawal
Filter by transaction status. Options: pending, confirmed, failed
Number of transactions to return per page
Page number for pagination
Response
Indicates if the request was successful
Array of transaction objects
User ID who created the transaction
Associated order ID (if applicable)
Transaction type: purchase, refund, deposit, or withdrawal
Currency used (default: TRX)
Blockchain network (default: TRC-20)
Blockchain transaction hash
Destination wallet address
Transaction status: pending, confirmed, or failed
Number of blockchain confirmations
Transaction creation timestamp
Transaction last update timestamp
Pagination information
Total number of transactions matching the query
{
"success": true,
"transactions": [
{
"_id": "648a1234567890abcdef1234",
"userId": "648a1234567890abcdef5678",
"orderId": "648a1234567890abcdef9012",
"type": "purchase",
"amount": 25.5,
"currency": "TRX",
"network": "TRC-20",
"transactionHash": "a1b2c3d4e5f6...",
"fromAddress": "TGzz8gjYiYRqpfmDwnLxfgPuLVNmpCswVp",
"toAddress": "TXyza9876543210zyxwvutsrqponmlkjih",
"status": "confirmed",
"confirmations": 19,
"createdAt": "2024-03-15T10:30:00.000Z",
"updatedAt": "2024-03-15T10:35:00.000Z"
}
],
"pagination": {
"total": 45,
"page": 1,
"pages": 5
}
}
Get Transaction by ID
Retrieve a specific transaction by its ID.
curl -X GET https://api.cryptoshop.com/api/transactions/648a1234567890abcdef1234 \
-H "Authorization: Bearer YOUR_TOKEN"
Path Parameters
Response
Indicates if the request was successful
The transaction object (see structure above)
{
"success": true,
"transaction": {
"_id": "648a1234567890abcdef1234",
"userId": "648a1234567890abcdef5678",
"type": "withdrawal",
"amount": 100,
"currency": "TRX",
"network": "TRC-20",
"transactionHash": "xyz789...",
"fromAddress": "TGzz8gjYiYRqpfmDwnLxfgPuLVNmpCswVp",
"toAddress": "TXyza9876543210zyxwvutsrqponmlkjih",
"status": "confirmed",
"confirmations": 25,
"createdAt": "2024-03-15T10:30:00.000Z",
"updatedAt": "2024-03-15T10:35:00.000Z"
}
}
Error Responses
{
"error": "Transaction not found"
}
Users can only access their own transactions. Attempting to access another user’s transaction will return a 403 error.