VAT Invoice
VAT Invoices are full tax invoices used for B2B transactions where the buyer needs tax deduction.
Overview
| Attribute | Value |
|---|---|
| Service | VATInvoiceService |
| Tax Deductible | Yes |
| Buyer Info | Required |
| CQT Submission | Required |
Required Fields
Seller Information
typescript
seller: {
taxCode: '0123456789', // Company tax code
name: 'Your Company Name', // Legal company name
address: '123 Street', // Registered address
bankAccount: '1234567890', // Bank account (optional)
bankName: 'Vietcombank', // Bank name (optional)
}Buyer Information
typescript
buyer: {
taxCode: '9876543210', // Required for VAT invoices
name: 'Customer Company',
address: '456 Avenue',
email: 'buyer@company.com', // Optional
}Invoice Items
typescript
items: [
{
itemName: 'Product A',
unitName: 'Piece',
quantity: 10,
unitPrice: 100000,
amount: 1000000, // quantity * unitPrice
vatRate: 10, // 0, 5, 8, or 10
vatAmount: 100000, // amount * vatRate / 100
},
]Create VAT Invoice
typescript
import { inject } from '@venizia/ignis';
import { VATInvoiceService } from '@nx-3rd/iiapi';
class InvoiceController {
constructor(
@inject({ key: 'services.VATInvoiceService' })
private vatService: VATInvoiceService,
) {}
async createInvoice(orderData: OrderData) {
const invoice = await this.vatService.create({
// Seller (your company)
seller: {
taxCode: process.env.COMPANY_TAX_CODE,
name: process.env.COMPANY_NAME,
address: process.env.COMPANY_ADDRESS,
},
// Buyer (customer)
buyer: {
taxCode: orderData.customerTaxCode,
name: orderData.customerName,
address: orderData.customerAddress,
},
// Invoice details
invoiceDate: new Date(),
currencyCode: 'VND',
exchangeRate: 1,
// Items
items: orderData.items.map(item => ({
itemName: item.name,
unitName: item.unit,
quantity: item.quantity,
unitPrice: item.price,
amount: item.quantity * item.price,
vatRate: 10,
vatAmount: item.quantity * item.price * 0.1,
})),
// Totals
totalAmount: orderData.subtotal,
totalVatAmount: orderData.tax,
totalPayment: orderData.total,
});
return invoice;
}
}VAT Rates
| Rate | Description | Examples |
|---|---|---|
| 0% | Export, international | Export goods |
| 5% | Essential goods | Healthcare, education |
| 8% | Reduced rate | Certain services |
| 10% | Standard rate | Most goods/services |
Invoice Lifecycle
Submit to T-VAN
typescript
const result = await this.invoiceManagementService.submit({
invoiceId: invoice.id,
clientName: 'default',
});
// Result contains:
// - Invoice number (auto-assigned)
// - Digital signature
// - T-VAN reference ID