
Accounting Software: E-Invoicing and VAT Compliance
The UK and EU are in the midst of a fundamental shift in tax compliance โ from paper-based processes to mandatory digital reporting. The UK's Making Tax Digital (MTD) programme has already mandated digital VAT submission for all VAT-registered businesses. The EU's ViDA (VAT in the Digital Age) initiative will require near-real-time e-invoicing across all member states by 2028. For developers building accounting software, understanding these requirements is not optional โ it is the foundation of the product.
This article covers the technical pillars: MTD HMRC integration, EU e-invoicing standards, VAT calculation complexity, and contingency strategies when government systems are unavailable.
Making Tax Digital: HMRC API Integration
Making Tax Digital for VAT (MTD VAT) has been mandatory for all UK VAT-registered businesses since April 2022. The key requirement: businesses must use functional compatible software that connects digitally to HMRC's API โ manual data entry on HMRC's portal is not permitted for most businesses.
The HMRC API for MTD VAT is a REST API with OAuth 2.0 authentication (Authorization Code Flow for businesses authorizing your software):
// MTD VAT API - Retrieve obligations and submit VAT return
class HMRCMTDClient {
private baseUrl = 'https://api.service.hmrc.gov.uk';
async getVATObligations(vrn: string, accessToken: string, params: {
from: string; // YYYY-MM-DD
to: string;
status?: 'O' | 'F'; // Open or Fulfilled
}): Promise<VATObligation[]> {
const url = new URL(`${this.baseUrl}/organisations/vat/${vrn}/obligations`);
url.searchParams.set('from', params.from);
url.searchParams.set('to', params.to);
if (params.status) url.searchParams.set('status', params.status);
const response = await fetch(url.toString(), {
headers: {
Authorization: `Bearer ${accessToken}`,
Accept: 'application/vnd.hmrc.1.0+json',
'Gov-Test-Scenario': process.env.NODE_ENV !== 'production' ? 'QUARTERLY_PERIODS_OPEN' : '',
},
});
const data = await response.json();
return data.obligations;
}
async submitVATReturn(vrn: string, accessToken: string, vatReturn: VATReturn): Promise<VATSubmissionResult> {
const response = await fetch(`${this.baseUrl}/organisations/vat/${vrn}/returns`, {
method: 'POST',
headers: {
Authorization: `Bearer ${accessToken}`,
Accept: 'application/vnd.hmrc.1.0+json',
'Content-Type': 'application/json',
'Gov-Client-Connection-Method': 'WEB_APP_VIA_SERVER',
// Fraud prevention headers โ MANDATORY for MTD
'Gov-Client-Public-IP': req.ip,
'Gov-Client-Browser-JS-User-Agent': req.headers['user-agent'] ?? '',
'Gov-Vendor-Version': `${process.env.npm_package_name}=${process.env.npm_package_version}`,
},
body: JSON.stringify({
periodKey: vatReturn.periodKey, // e.g., '#001'
vatDueSales: vatReturn.vatDueSales,
vatDueAcquisitions: vatReturn.vatDueAcquisitions,
totalVatDue: vatReturn.totalVatDue,
vatReclaimedCurrPeriod: vatReturn.vatReclaimedCurrPeriod,
netVatDue: vatReturn.netVatDue,
totalValueSalesExVAT: vatReturn.totalValueSalesExVAT,
totalValuePurchasesExVAT: vatReturn.totalValuePurchasesExVAT,
totalValueGoodsSuppliedExVAT: vatReturn.totalValueGoodsSuppliedExVAT,
totalAcquisitionsExVAT: vatReturn.totalAcquisitionsExVAT,
finalised: true,
}),
});
if (!response.ok) {
const error = await response.json();
throw new Error(`HMRC submission failed: ${error.message}`);
}
return response.json();
}
}
Critical MTD requirement: Fraud Prevention Headers. HMRC requires a set of HTTP headers providing information about the originating device and connection. Missing or incorrect fraud prevention headers will result in submission rejection. The headers include client IP, device ID, browser user-agent, and software version information.
EU VAT: ViDA and Country-Specific Mandates
While MTD covers the UK, the EU picture is more complex โ each member state has its own timeline and system for e-invoicing, though the ViDA regulation is harmonizing requirements:
| Country | System | B2B Mandatory Since |
|---|---|---|
| Italy | Sistema di Interscambio (SDI) | January 2019 |
| France | Portail Public de Facturation (PPF) | September 2026 (rolling) |
| Germany | Zentraler Rechnungseingang (ZRE) | January 2025 (B2G) |
| Spain | FACeB2B / VeriFactu | 2025 (rolling) |
| Romania | e-Factura (ANAF) | January 2024 |
| EU-wide | ViDA | 2028 target |
For software serving multiple EU markets, the recommended approach is using an e-invoicing service provider that handles country-specific format generation and submission:
- Pagero: European market leader, handles 50+ country formats
- Basware: Strong enterprise focus
- Tradeshift: Network approach with supplier connectivity
- Avalara e-Invoicing: Good for US companies expanding to EU
VAT Calculation Complexity
VAT in the UK and EU is deceptively complex. A few areas that catch developers off guard:
Multiple rates: UK has 20% standard, 5% reduced (domestic energy, children's car seats), and 0% zero-rated (food, children's clothing, books). Zero-rated is not exempt โ the distinction matters for input tax recovery.
Reverse charge mechanism: For B2B cross-border services within the EU (and in many UK B2B scenarios post-Brexit), the buyer accounts for VAT via the reverse charge. Your invoice must show the correct legal reference (e.g., "Reverse charge โ Article 196 of the EU VAT Directive").
OSS (One-Stop Shop): For B2C digital services sold across EU, the OSS registration allows filing a single EU-wide VAT return instead of registering in each country.
// VAT rate determination โ simplified UK example
function determineUKVATRate(
productCategory: string,
customerType: 'B2C' | 'B2B_UK' | 'B2B_EU' | 'B2B_ROW',
customerCountry: string
): VATTreatment {
// B2B outside UK โ potential reverse charge
if (customerType === 'B2B_EU' || customerType === 'B2B_ROW') {
return {
rate: 0,
type: 'zero',
vatCode: 'Z',
note: 'Outside scope of UK VAT โ customer accounts for any applicable local VAT',
};
}
// UK B2C rates by category
const rateMap: Record<string, VATTreatment> = {
'standard_goods': { rate: 0.20, type: 'standard', vatCode: 'S' },
'food_basic': { rate: 0, type: 'zero', vatCode: 'Z' },
'children_clothing': { rate: 0, type: 'zero', vatCode: 'Z' },
'domestic_energy': { rate: 0.05, type: 'reduced', vatCode: 'R' },
'financial_services': { rate: 0, type: 'exempt', vatCode: 'E' },
};
return rateMap[productCategory] ?? { rate: 0.20, type: 'standard', vatCode: 'S' };
}
Integrating with Xero and QuickBooks for Compliance
Most UK accounting software integrates with Xero or QuickBooks Online to leverage their MTD-compliant VAT filing. Both platforms have APIs for pushing transactions:
// Xero API โ creating an invoice with VAT
async function createXeroInvoice(invoice: InvoiceData, accessToken: string, tenantId: string) {
const response = await fetch('https://api.xero.com/api.xro/2.0/Invoices', {
method: 'POST',
headers: {
Authorization: `Bearer ${accessToken}`,
'Xero-Tenant-Id': tenantId,
'Content-Type': 'application/json',
},
body: JSON.stringify({
Type: 'ACCREC',
Contact: { ContactID: invoice.xeroContactId },
InvoiceNumber: invoice.number,
Date: invoice.date,
DueDate: invoice.dueDate,
LineAmountTypes: 'Exclusive', // Amounts exclude VAT
LineItems: invoice.lines.map(line => ({
Description: line.description,
Quantity: line.quantity,
UnitAmount: line.unitPrice,
TaxType: line.vatCode, // 'OUTPUT2' for 20% standard UK VAT
AccountCode: line.nominalCode,
})),
}),
});
return response.json();
}
Contingency: When HMRC Is Unavailable
HMRC's API has scheduled maintenance windows (usually early morning UK time) and occasional unplanned outages. The MTD system does not have a formal contingency protocol โ instead:
- Queue submissions: create a submission queue and retry with exponential backoff
- Monitor HMRC status: HMRC publishes service status at status.tax.service.gov.uk
- Deadline awareness: submissions due on the last day of the month are high-risk โ recommend clients submit 2-3 days early
- Obligation tracking: always check open obligations first to avoid submitting for the wrong period
Conclusion
Accounting and tax software for UK and EU markets requires a level of technical and regulatory specialization that goes well beyond conventional web development. Each HMRC API update, each new ViDA regulation, and each country-specific e-invoicing mandate is a point of ongoing attention.
For companies building systems with tax compliance requirements, the critical decision is where to invest in own implementation and where to use third-party services to abstract the complexity. There is no universal answer โ it depends on the volume of transactions, the variety of jurisdictions served, and the criticality of tax compliance to the business.
At SystemForge, we have experience building systems with complete fiscal integrations. Contact us before starting your technical scope if your product involves tax compliance requirements.
Need Industry Management Software?
We build custom management systems for your industry.
Learn more โNeed help?

