Skip to main content

EDC Invoice/Receipt Inquiry (T167)

Query Electronic Dispensing Controller (EDC) invoices and receipts with filtering options for fuel type, date range, and modification status. This endpoint provides paginated results with detailed invoice information including pump, nozzle, and fuel type data for gas station operations. Request and response are encrypted.


Endpoint Overview

PropertyValue
Interface CodeT167
Request Encrypted✅ Yes
Response Encrypted✅ Yes
Request Body{ "fuelType": "...", "invoiceNo": "...", "startDate": "...", ... }
Response FormatJSON with pagination

Flow Description

  1. Client submits query with optional filters (fuel type, invoice number, buyer name, date range, branch ID) and pagination parameters.
  2. Server validates the request parameters and filters against EDC invoice records.
  3. Server queries invoices based on queryType (unmodified, modified, or all).
  4. Server returns paginated results with invoice details including EDC-specific fields (pump, nozzle, fuel type).
  5. Client displays records or uses data for reconciliation and reporting.

💡 Tip: Use T167 to query EDC-specific invoices that include pump/nozzle information not available in standard invoice queries (T106). Use queryType to filter by modification status.


try {
// Call T167: EDC Invoice/Receipt Inquiry
$filters = [
'fuelType' => 'Petrol', // Optional: Filter by fuel type
'invoiceNo' => '321000229045', // Optional: Specific invoice number
'buyerLegalName' => 'UGANDA REVENUE AUTHORITY', // Optional: Buyer name
'startDate' => '2025-02-19', // Optional: Start date
'endDate' => '2025-02-19', // Optional: End date
'pageNo' => 1,
'pageSize' => 10,
'queryType' => '1', // 1=Unmodified, 2=Modified, 3=All
'branchId' => '2020090132456' // Optional: Branch ID
];

$response = $client->edcInvoiceQuery($filters);
$content = $response['data']['content'] ?? $response;
$records = $content['records'] ?? [];
$page = $content['page'] ?? [];

if (!empty($records)) {
echo "✅ Retrieved " . count($records) . " EDC invoice(s)\n";
echo " Page: {$page['pageNo']}/{$page['pageCount']} (Total: {$page['totalSize']})\n";

foreach ($records as $invoice) {
echo " • Invoice: {$invoice['invoiceNo']}\n";
echo " Buyer: {$invoice['buyerLegalName']}\n";
echo " Fuel Type: {$invoice['fuelType']}\n";
echo " Pump: {$invoice['pumpNo']}, Nozzle: {$invoice['nozzleNo']}\n";
echo " Amount: {$invoice['grossAmount']} {$invoice['currency']}\n";
echo " Date: {$invoice['issuedDate']}\n";
echo " Update Times: {$invoice['updateTimes']}\n";
echo "\n";
}
} else {
echo "⚠️ No EDC invoices found for provided criteria\n";
}

} catch (\UraEfrisSdk\Exceptions\APIException $e) {
echo "❌ Query failed: " . $e->getMessage() . "\n";
echo " Return Code: " . $e->getReturnCode() . "\n";
}

Request Structure

{
"data": {
"content": "BASE64_ENCRYPTED_PAYLOAD",
"signature": "JKQWJK34K32JJEK2JQWJ5678",
"dataDescription": {
"codeType": "1",
"encryptCode": "2",
"zipCode": "0"
}
},
"globalInfo": {
"interfaceCode": "T167",
"appId": "AP04",
"version": "1.1.20191201",
"tin": "1000029771",
"deviceNo": "TCS9e0df01728335239",
"taxpayerID": "1"
}
}

Request Fields (Encrypted Payload)

FieldRequiredTypeLengthDescription
fuelType❌ NoString≤200Fuel type filter (e.g., "Petrol", "Diesel", "Naphtha")
invoiceNo❌ NoString≤20Specific invoice number to query
buyerLegalName❌ NoString≤256Buyer legal name filter
startDate❌ NoDate-Start date for filtering (yyyy-MM-dd HH:mm:ss)
endDate❌ NoDate-End date for filtering (yyyy-MM-dd HH:mm:ss)
pageNo✅ YesNumber≤10Current page number (starts from 1)
pageSize✅ YesNumber≤3Records per page; cannot exceed 100
queryType✅ YesString (1)11=Unmodified invoices, 2=Modified invoices, 3=All invoices
branchId❌ NoString≤18Branch identifier for filtering

💡 Tip: All filter fields are optional except pagination (pageNo, pageSize) and queryType. Use specific filters to narrow results for better performance.


Response Structure

{
"data": {
"content": {
"page": {
"pageNo": "1",
"pageSize": "10",
"totalSize": "50",
"pageCount": "5"
},
"records": [
{
"id": "159078217852531032",
"invoiceNo": "00000000001",
"oriInvoiceId": "00000000003",
"oriInvoiceNo": "00000000002",
"issuedDate": "19/02/2025 10:00:00",
"buyerTin": "1000029771",
"buyerLegalName": "UGANDA REVENUE AUTHORITY",
"buyerNinBrn": "00000000001",
"currency": "UGX",
"grossAmount": "2000.00",
"taxAmount": "2000.00",
"dataSource": "101",
"isInvalid": "1",
"isRefund": "1",
"invoiceType": "1",
"invoiceKind": "1",
"invoiceIndustryCode": "102",
"branchName": "Mr. RAJIV DINESH GANDHI",
"deviceNo": "121241304906446273",
"uploadingTime": "19/02/2025 10:00:00",
"referenceNo": "00000000012",
"operator": "administrator",
"userName": "Mr. ANDREW KIIZA",
"pumpNo": "000001",
"nozzleNo": "000002",
"fuelType": "Petrol",
"updateTimes": "1"
}
]
}
},
"globalInfo": {
"interfaceCode": "T167",
"returnStateInfo": {
"returnCode": "00",
"returnMessage": "SUCCESS"
}
}
}

Response Fields

Pagination Object

FieldRequiredTypeDescription
pageNo✅ YesNumberCurrent page number
pageSize✅ YesNumberRecords per page
totalSize✅ YesNumberTotal number of matching records
pageCount✅ YesNumberTotal number of pages

Invoice Records Array Items

FieldRequiredTypeLengthDescription
id✅ YesString≤32Unique invoice identifier
invoiceNo✅ YesString≤30Invoice number (FDN)
oriInvoiceId❌ NoString≤32Original invoice ID (for credit/debit notes)
oriInvoiceNo❌ NoString≤30Original invoice number (for credit/debit notes)
issuedDate✅ YesDate-Invoice issue date (dd/MM/yyyy HH:mm:ss)
buyerTin❌ NoString10-20Buyer's Taxpayer Identification Number
buyerLegalName✅ YesString≤256Buyer legal name
buyerNinBrn❌ NoString≤100Buyer NIN/BRN
currency✅ YesString≤10Currency code (e.g., UGX)
grossAmount✅ YesNumber-Total invoice amount
taxAmount✅ YesNumber-Total tax amount
dataSource✅ YesString (3)3101=EFD, 102=Windows Client, 103=WebService API, 104=Mis, 105=Webportal, 106=Offline Mode Enabler
isInvalid✅ YesString (1)11=Obsolete, 0=Not obsolete
isRefund❌ NoString (1)10=No credit/debit, 1=Credit issued, 2=Debit issued
invoiceType✅ YesString (1)11=Invoice/Receipt, 2=Credit Note With FDN, 3=Credit Note Without FDN, 4=Debit Note
invoiceKind✅ YesString (1)11=Invoice, 2=Receipt
invoiceIndustryCode❌ NoString (3)3Industry code (e.g., 110=EDC)
branchName❌ NoString≤500Branch name
deviceNo✅ YesString≤50Device serial number
uploadingTime✅ YesDate-Server upload timestamp
referenceNo❌ NoString≤50Seller's reference number
operator❌ NoString≤100Operator name
userName❌ NoString≤500User name
pumpNo❌ NoString≤50Fuel pump number (EDC-specific)
nozzleNo❌ NoString≤50Fuel nozzle number (EDC-specific)
fuelType❌ NoString≤200Fuel type dispensed (EDC-specific)
updateTimes❌ NoNumber-Number of times invoice was modified

💡 Tip: EDC-specific fields (pumpNo, nozzleNo, fuelType, updateTimes) distinguish T167 results from standard invoice queries (T106). Use updateTimes to track buyer detail modifications (T166).


Return Codes

CodeMessageDescription
00SUCCESSEDC invoices retrieved successfully
99Unknown errorGeneric server error
400Device does not existdeviceNo not registered for this TIN
402Device key expiredDevice credentials expired; re-run T102
403Device status is abnormalDevice blocked or suspended
1521pageNo:cannot be empty!Missing page number in request
1522pageNo:The byte length cannot be less than 0 and cannot be greater than 20!Page number format error
1523pageNo:Cannot be greater than -1!Page number must be positive
1524pageSize:cannot be empty!Missing page size in request
1525pageSize:The byte length cannot be less than 0 and cannot be greater than 3!Page size format error
1526pageSize:Cannot be greater than 100!Page size exceeds maximum (100)
2916fuelType: cannot be empty!Fuel type required in some contexts
2917fuelType: Byte length cannot be greater than 200!Fuel type exceeds length limit

💡 Tip: Error codes 1521-1526 are the most common pagination-related errors. Ensure pageNo ≥ 1 and pageSize ≤ 100.


Common Use Cases

  1. EDC Sales Reconciliation
    Query EDC invoices to reconcile pump meter readings with issued invoices for shift closing (T163).

  2. Fuel Type Sales Analysis
    Filter by fuelType to analyze sales performance by product (Petrol, Diesel, Naphtha, etc.).

  3. Pump/Nozzle Performance Tracking
    Use pumpNo and nozzleNo to track sales per dispensing point for maintenance scheduling.

  4. Modified Invoice Audit
    Use queryType=2 to query invoices where buyer details were modified (T166) for audit trails.

  5. Branch Sales Reporting
    Filter by branchId to generate branch-specific EDC sales reports for multi-station operators.

  6. Date-Range Sales Queries
    Generate daily, weekly, or monthly EDC sales reports using startDate and endDate filters.

  7. Buyer Transaction History
    Filter by buyerLegalName or buyerTin to track specific customer fuel purchase history.


Integration Checklist

✅ Ensure pageNo ≥ 1 and pageSize ≤ 100 before submitting request
✅ Handle empty records array gracefully (no matching invoices found)
✅ Implement pagination logic using pageCount and totalSize from response
✅ Validate date format is yyyy-MM-dd HH:mm:ss for startDate and endDate
✅ Use queryType appropriately (1=unmodified, 2=modified, 3=all) based on use case
✅ Cache frequently-queried EDC invoices to reduce API calls
✅ Log query parameters for audit trail compliance
✅ Cross-reference pumpNo/nozzleNo with T169 pump configuration data
✅ Use updateTimes to identify invoices with buyer detail modifications
✅ Filter by invoiceIndustryCode=110 (EDC) to ensure EDC-specific invoices only