Transactions
Get Transaction by Reference
GET
https://backendapi.sayswitchgroup.com/api/v1/transaction/verify/{reference}Retrieve transaction details using a unique reference identifier. This endpoint allows you to verify and fetch the status of any transaction using its reference code.
Path Parameter
Request
Headers
JSON
{
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_SECRET_KEY"
}Example Request
cURL
curl --location --request GET 'https://backendapi.sayswitchgroup.com/api/v1/transaction/verify/TEST_TXN_REF_001' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_SECRET_KEY'Note: This is a GET request, so no request body is required. The reference is passed in the URL path.
Response
Success Response
JSON
{
"success": true,
"message": "Transaction retrieved successfully",
"data": {
"id": 12345,
"domain": "test",
"status": "success",
"reference": "TEST_TXN_REF_001",
"amount": "1012",
"gateway_response": "Transaction successful",
"paid_at": "2025-10-01T14:30:25.000000Z",
"created_at": "2025-10-01T14:30:15.000000Z",
"channel": "card",
"currency": "NGN",
"ip_address": "192.168.1.100",
"fees": "12",
"requested_amount": "1000"
},
"customer": {
"id": 456,
"customer_code": "CUS_test123456789",
"first_name": "John",
"last_name": "Doe",
"email": "test@example.com",
"phone": "08012345678",
"metadata": "{}"
},
"log": {
"time_spent": 15000,
"attempts": 1,
"authentication": "successful",
"errors": 0,
"success": true,
"channel": "card",
"history": [
{
"id": 1001,
"type": "TRANSACTION_INITIATED",
"message": "Transaction started",
"time": "2025-10-01T14:30:15.000000Z",
"reference": "TEST_TXN_REF_001",
"channel": "card"
},
{
"id": 1002,
"type": "PAYMENT_COMPLETED",
"message": "Payment successful",
"time": "2025-10-01T14:30:25.000000Z",
"reference": "TEST_TXN_REF_001",
"channel": "card"
}
]
},
"plan": null,
"authorization": {
"authorization_code": "AUTH_test_12345",
"bin": "411111",
"last4": "1111",
"exp_month": "12",
"exp_year": "28",
"card_type": "visa",
"bank": "Test Bank",
"country_code": "NG",
"brand": "visa",
"reusable": true
}
}Error Response
JSON
{
"success": false,
"message": "Transaction not found",
"error": "No transaction found with reference: INVALID_REF_001"
}Response Fields
Main Transaction Data
Customer Information
Transaction Log
Authorization Details (Card Payments)
Transaction Status Values
Error Handling
Common Error Responses
Best Practices
- Always check the
successfield before processing response data - Handle different transaction statuses appropriately in your application
- Implement retry logic for failed requests with exponential backoff
- Store transaction references securely for future verification
- Validate response data before using it in your application