Skip to content

Invoice Validation

Verify invoice authenticity and status directly with Vietnam's Tax Authority (CQT).

Overview

FeatureDescription
ServiceTVanService.validateInvoice()
Data SourceCQT (Tax Authority)
Use CaseVerify received invoices

Use Cases

  • Validate supplier invoices before payment
  • Verify invoice hasn't been cancelled
  • Check invoice replacement status
  • Audit compliance verification

Validate Invoice

typescript
import { TVanService } from '@nx-3rd/t-van';

async validateInvoice(invoiceNumber: string, sellerTaxCode: string) {
  const result = await this.tvanService.validateInvoice({
    invoiceNumber: invoiceNumber,
    sellerTaxCode: sellerTaxCode,
    invoiceDate: new Date('2024-01-15'),
  });

  return {
    isValid: result.isValid,
    invoiceStatus: result.status,
    totalAmount: result.totalAmount,
    buyerTaxCode: result.buyerTaxCode,
  };
}

Response Structure

json
{
  "isValid": true,
  "status": "VALID",
  "invoiceNumber": "AA/24E0001234",
  "sellerTaxCode": "0123456789",
  "sellerName": "Company ABC",
  "buyerTaxCode": "9876543210",
  "buyerName": "Your Company",
  "invoiceDate": "2024-01-15",
  "totalAmount": 1100000,
  "vatAmount": 100000
}

Invoice Status

StatusDescription
VALIDInvoice is valid and accepted
CANCELLEDInvoice has been cancelled
REPLACEDInvoice replaced by another
NOT_FOUNDInvoice not found in CQT

Validation Flow

REST API

http
POST /api/t-van/invoice/validate
Content-Type: application/json

{
  "invoiceNumber": "AA/24E0001234",
  "sellerTaxCode": "0123456789",
  "invoiceDate": "2024-01-15"
}

Error Handling

typescript
try {
  const result = await this.tvanService.validateInvoice(params);
  return result;
} catch (error) {
  if (error.code === 'INVOICE_NOT_FOUND') {
    return { isValid: false, status: 'NOT_FOUND' };
  }
  throw error;
}

Best Practices

PracticeDescription
Validate before paymentAlways check before paying supplier
Keep validation recordsLog all validation results
Re-validate periodicallyInvoices can be cancelled later
Alert on failuresNotify when validation fails

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.