Update Buyer Details (T166)
Update buyer information on an existing invoice after issuance. This endpoint allows modification of buyer details (TIN, name, contact information, etc.) for invoices that have already been uploaded to the EFRIS system. Request is encrypted; response is unencrypted.
Endpoint Overviewβ
| Property | Value |
|---|---|
| Interface Code | T166 |
| Request Encrypted | β Yes |
| Response Encrypted | β No |
| Request Body | { "invoiceNo": "...", "buyerTin": "...", ... } |
| Response Format | NULL (empty on success) |
Flow Descriptionβ
- Client identifies invoice requiring buyer detail updates (typically EDC invoices).
- Client submits updated buyer information with original
invoiceNoandcreateDateStr. - Server validates invoice exists and buyer modification is allowed within permitted timeframe.
- Server updates buyer details and returns NULL response on success.
- Client confirms update completion and logs change for audit trail.
π‘ Tip: Buyer details can only be modified within a limited period after invoice issuance (configurable via
buyerModificationPeriodfrom T103). Credit notes cannot have buyer details modified.
- PHP
- JavaScript / TypeScript
- Python
try {
// Call T166: Update Buyer Details
$updateData = [
'invoiceNo' => '321000229045',
'buyerTin' => '1000029771',
'buyerNinBrn' => '201905081705',
'buyerPassportNum' => '', // For foreigners only
'buyerLegalName' => 'UGANDA REVENUE AUTHORITY',
'buyerBusinessName' => 'UGANDA REVENUE AUTHORITY',
'buyerAddress' => '198 NIP BUILDING Nakawa KAMPALA',
'buyerEmailAddress' => 'services@ura.go.ug',
'buyerMobilePhone' => '0772140000',
'buyerLinePhone' => '0414123456',
'buyerPlaceOfBusi' => 'KAMPALA NAKAWA DIVISION',
'buyerType' => '0', // 0=B2B, 1=B2C, 2=Foreigner
'buyerCitizenship' => 'UG-Uganda',
'buyerSector' => 'Government',
'mvrn' => '', // Motor Vehicle Registration Number (optional)
'createDateStr' => '2025-02-19 10:21:00'
];
$response = $client->updateBuyerDetails($updateData);
// Response is NULL on success
echo "β
Buyer details updated successfully\n";
echo " Invoice: {$updateData['invoiceNo']}\n";
echo " Buyer TIN: {$updateData['buyerTin']}\n";
echo " Buyer Name: {$updateData['buyerLegalName']}\n";
} catch (\UraEfrisSdk\Exceptions\APIException $e) {
echo "β Update failed: " . $e->getMessage() . "\n";
echo " Return Code: " . $e->getReturnCode() . "\n";
}
try {
// Call T166: Update Buyer Details
const updateData = {
invoiceNo: '321000229045',
buyerTin: '1000029771',
buyerNinBrn: '201905081705',
buyerPassportNum: '', // For foreigners only
buyerLegalName: 'UGANDA REVENUE AUTHORITY',
buyerBusinessName: 'UGANDA REVENUE AUTHORITY',
buyerAddress: '198 NIP BUILDING Nakawa KAMPALA',
buyerEmailAddress: 'services@ura.go.ug',
buyerMobilePhone: '0772140000',
buyerLinePhone: '0414123456',
buyerPlaceOfBusi: 'KAMPALA NAKAWA DIVISION',
buyerType: '0', // 0=B2B, 1=B2C, 2=Foreigner
buyerCitizenship: 'UG-Uganda',
buyerSector: 'Government',
mvrn: '', // Motor Vehicle Registration Number (optional)
createDateStr: '2025-02-19 10:21:00'
};
const response = await client.updateBuyerDetails(updateData);
// Response is NULL on success
console.log('β
Buyer details updated successfully');
console.log(' Invoice:', updateData.invoiceNo);
console.log(' Buyer TIN:', updateData.buyerTin);
console.log(' Buyer Name:', updateData.buyerLegalName);
} catch (error: any) {
console.error(`β Update failed: ${error.message}`);
if (error.returnCode) {
console.error(` Return Code: ${error.returnCode}`);
}
throw error;
}
try:
# Call T166: Update Buyer Details
update_data = {
"invoiceNo": "321000229045",
"buyerTin": "1000029771",
"buyerNinBrn": "201905081705",
"buyerPassportNum": "", # For foreigners only
"buyerLegalName": "UGANDA REVENUE AUTHORITY",
"buyerBusinessName": "UGANDA REVENUE AUTHORITY",
"buyerAddress": "198 NIP BUILDING Nakawa KAMPALA",
"buyerEmailAddress": "services@ura.go.ug",
"buyerMobilePhone": "0772140000",
"buyerLinePhone": "0414123456",
"buyerPlaceOfBusi": "KAMPALA NAKAWA DIVISION",
"buyerType": "0", # 0=B2B, 1=B2C, 2=Foreigner
"buyerCitizenship": "UG-Uganda",
"buyerSector": "Government",
"mvrn": "", # Motor Vehicle Registration Number (optional)
"createDateStr": "2025-02-19 10:21:00"
}
response = client.update_buyer_details(update_data)
# Response is NULL on success
print("β
Buyer details updated successfully")
print(f" Invoice: {update_data['invoiceNo']}")
print(f" Buyer TIN: {update_data['buyerTin']}")
print(f" Buyer Name: {update_data['buyerLegalName']}")
except Exception as e:
print(f"β Update failed: {e}")
if hasattr(e, "return_code"):
print(f" Return Code: {e.return_code}")
raise
Request Structureβ
{
"data": {
"content": "BASE64_ENCRYPTED_PAYLOAD",
"signature": "JKQWJK34K32JJEK2JQWJ5678",
"dataDescription": {
"codeType": "1",
"encryptCode": "2",
"zipCode": "0"
}
},
"globalInfo": {
"interfaceCode": "T166",
"appId": "AP04",
"version": "1.1.20191201",
"tin": "1000029771",
"deviceNo": "TCS9e0df01728335239",
"taxpayerID": "1"
}
}
Request Fields (Encrypted Payload)β
| Field | Required | Type | Length | Description |
|---|---|---|---|---|
invoiceNo | β Yes | String | β€20 | Original invoice number to update |
buyerTin | β No | String | β€20 | Buyer TIN; required if buyerType=0 (B2B) |
buyerNinBrn | β No | String | β€100 | Buyer NIN/BRN |
buyerPassportNum | β No | String | β€20 | Passport number; required if buyerType=2 (Foreigner) |
buyerLegalName | β No | String | β€256 | Buyer legal name |
buyerBusinessName | β No | String | β€256 | Buyer business name |
buyerAddress | β No | String | β€500 | Buyer physical address |
buyerEmailAddress | β No | String | β€50 | Buyer email address (valid email format) |
buyerMobilePhone | β No | String | β€30 | Buyer mobile phone number |
buyerLinePhone | β No | String | β€30 | Buyer landline phone number |
buyerPlaceOfBusi | β No | String | β€500 | Buyer place of business |
buyerType | β Yes | String (1) | 1 | 0=B2B, 1=B2C, 2=Foreigner |
buyerCitizenship | β No | String | β€128 | Buyer citizenship (e.g., UG-Uganda) |
buyerSector | β No | String | β€200 | Buyer sector (e.g., Government, Private) |
buyerReferenceNo | β No | String | β€50 | Buyer reference number |
mvrn | β No | String | β€32 | Motor Vehicle Registration Number (for fuel invoices) |
createDateStr | β No | String | 20 | Invoice creation timestamp (yyyy-MM-dd HH:mm:ss) |
π‘ Tip: At minimum,
invoiceNoandbuyerTypeare required. For B2B (buyerType=0),buyerTincannot be empty. For Foreigners (buyerType=2),buyerPassportNumandbuyerCitizenshipare required.
Response Structureβ
{
"globalInfo": {
"interfaceCode": "T166",
"returnStateInfo": {
"returnCode": "00",
"returnMessage": "SUCCESS"
}
}
}
π Note: On success, the
data.contentis NULL or empty. Validation results are returned viaglobalInfo.returnStateInfoonly.
Response Fieldsβ
Global Infoβ
| Field | Required | Type | Description |
|---|---|---|---|
interfaceCode | β Yes | String (5) | Echoes T166 |
returnStateInfo | β Yes | Object | Contains returnCode and returnMessage |
Return State Infoβ
| Field | Required | Type | Description |
|---|---|---|---|
returnCode | β Yes | String | 00 = Success, otherwise error code |
returnMessage | β Yes | String | Human-readable status message |
Return Codesβ
| Code | Message | Description |
|---|---|---|
00 | SUCCESS | Buyer details updated successfully |
99 | Unknown error | Generic server error |
400 | Device does not exist | deviceNo not registered for this TIN |
402 | Device key expired | Device credentials expired; re-run T102 |
403 | Device status is abnormal | Device blocked or suspended |
2931 | invoiceNo: You can not modify buyer's information more than X times | Maximum modification limit exceeded |
2932 | invoiceNo: The buyer information cannot be modified because of the fiscal document was generated * hours ago | Modification period expired |
2973 | invoiceNo does not exist | Invoice number not found |
3053 | Credit note is not allowed to modify the buyer's information | Cannot modify credit note buyer details |
3054 | The invoice has been issued credit note, can not modify buyer's information | Original invoice has credit note |
3055 | The invoice has been applied for credit note, can not modify buyer's information | Credit note application in process |
2110 | tin cannot be empty! | Missing TIN when buyerType=0 |
2111 | tin: Byte length cannot be greater than 20! | TIN exceeds maximum length |
2244 | buyerDetails-->buyerType: cannot be empty! | Missing buyer type |
2245 | buyerDetails-->buyerType: Byte length cannot be greater than 3! | Buyer type format error |
3060 | The TIN is not registered in the ETAX system | Buyer TIN not found |
3063 | Your tin does not exist | Buyer TIN not found |
3064 | The status of TIN is abnormal | Buyer TIN suspended or inactive |
π‘ Tip: Error
2932is commonβbuyer details can only be modified within the configuredbuyerModificationPeriod(typically 48 hours from T103). Error3053-3055indicate credit note restrictions.
Common Use Casesβ
-
Invoice Buyer Correction
Update incorrect buyer information on fuel station invoices after customer provides correct details. -
B2B Customer TIN Update
Add or correct buyer TIN for business customers who initially purchased as B2C. -
Foreign Customer Documentation
Update passport number and citizenship for foreign buyers after verification. -
Contact Information Updates
Correct buyer email, phone numbers, or address for improved communication and record-keeping. -
Sector Classification Correction
Update buyer sector (Government, Private, etc.) for accurate reporting and compliance. -
Motor Vehicle Registration
Add MVRN for fuel invoices where vehicle registration is required for tracking.
Integration Checklistβ
β
Verify invoice exists via T108 before attempting buyer update
β
Confirm invoice is not a credit note (T166 not allowed for credit notes)
β
Check no credit note application is in process for the invoice
β
Validate buyerType matches provided identification (TIN for B2B, passport for Foreigner)
β
Ensure createDateStr is within allowed modification period from T103
β
Validate email format for buyerEmailAddress field
β
Verify buyer TIN exists in ETAX system via T119 before submission
β
Log all buyer detail updates for audit trail compliance
β
Handle NULL response gracefully (success = no content, check returnCode only)
β
Re-query invoice via T108 after update to confirm changes applied