This guide explains how to configure and use the HMRC (Her Majesty's Revenue and Customs) integration for Making Tax Digital (MTD) submissions including VAT, PAYE RTI, and Corporation Tax.
- Overview
- Configuration
- Features
- Getting Started
- VAT Returns
- PAYE RTI Submissions
- Corporation Tax
- API Reference
The HMRC integration provides support for:
- Making Tax Digital for VAT: Submit VAT returns electronically
- PAYE Real Time Information (RTI): Submit Full Payment Submissions (FPS), Employer Payment Summaries (EPS), and Earlier Year Updates (EYU)
- Making Tax Digital for Corporation Tax: Submit corporation tax computations
Add the following environment variables to your .env file:
HMRC_ENABLED=true
HMRC_ENVIRONMENT=sandbox
HMRC_CLIENT_ID=your_client_id
HMRC_CLIENT_SECRET=your_client_secret
HMRC_SERVER_TOKEN=your_server_token
HMRC_CALLBACK_URL=https://your-app.com/hmrc/callback
# Enable specific features
HMRC_VAT_ENABLED=true
HMRC_PAYE_ENABLED=true
HMRC_RTI_ENABLED=true
HMRC_CT_ENABLED=true- Register for a developer account at HMRC Developer Hub
- Create an application
- Subscribe to the required APIs:
- VAT (MTD) API
- PAYE RTI API
- Corporation Tax API
- Note your client ID and client secret
Before submitting returns, you must authorize the application:
- Navigate to HMRC Settings in the admin panel
- Click "Authorize with HMRC"
- Sign in with your Government Gateway credentials
- Grant the requested permissions
- You will be redirected back to the application
Supported Operations:
- Create and manage VAT returns
- Automatic calculation from invoices and expenses
- Submit returns to HMRC
- Retrieve obligations and liabilities
- View submission history
9-Box VAT Return:
- Box 1: VAT due on sales
- Box 2: VAT due on EC acquisitions
- Box 3: Total VAT due (Box 1 + Box 2)
- Box 4: VAT reclaimed on purchases
- Box 5: Net VAT due (Box 3 - Box 4)
- Box 6: Total value of sales (excluding VAT)
- Box 7: Total value of purchases (excluding VAT)
- Box 8: Total value of EC goods supplied
- Box 9: Total value of EC acquisitions
Full Payment Submission (FPS):
- Submit payroll information in real-time
- Employee-level details including gross pay, PAYE, and NI contributions
- Student loan deductions
- Late submission reasons
Employer Payment Summary (EPS):
- Report non-payment periods
- Claim employment allowance
- Recover statutory payments
Earlier Year Update (EYU):
- Correct previous year submissions
- Update employee records
Features:
- Calculate corporation tax liability
- Submit computations to HMRC
- Retrieve obligations and liabilities
- Track payment due dates
- Navigate to Settings > Company Profile
- Fill in HMRC registration details:
- VAT Number: Your VAT registration number
- PAYE Reference: Format: 123/AB12345
- Corporation Tax UTR: 10-digit Unique Taxpayer Reference
- Accounts Office Reference: For PAYE payments
For each employee, ensure the following fields are completed:
- National Insurance Number
- Starter Declaration (A, B, or C)
- Student Loan Plan (if applicable)
- Navigate to HMRC > VAT Returns
- Click "New VAT Return"
- Enter the period key (e.g., 23A1 for first quarter of 2023/24)
- Set period dates and due date
- Click "Calculate" to auto-populate from transactions
- Review all boxes
- Mark as "Finalised"
- Click "Submit to HMRC"
All submissions are tracked in the HMRC Submissions table with:
- Submission reference
- Status (draft, pending, submitted, accepted, rejected)
- Response data from HMRC
- Error messages (if any)
- Navigate to HMRC > PAYE Submissions
- Click "New PAYE Submission"
- Select tax year and month
- Enter payment date
- Click "Calculate from Payroll"
- Review employee data
- Click "Submit to HMRC"
If submitting late:
- Check "Late Reason Provided"
- Enter the reason for late submission
- HMRC may still apply penalties
- Navigate to HMRC > Corporation Tax
- Click "New Submission"
- Enter accounting period dates
- Click "Calculate from Financials"
- Review:
- Turnover
- Total profits
- Taxable profits
- Tax rate applied
- Marginal relief (if applicable)
- Click "Submit to HMRC"
getAuthorizationUrl(string $scope): Get OAuth authorization URLexchangeCodeForToken(string $code): Exchange authorization code for access tokenrefreshAccessToken(): Refresh expired access tokengetAccessToken(): Get current valid access token
submitVatReturn(HmrcVatReturn $vatReturn): Submit VAT returngetObligations(string $vrn, string $from, string $to): Get VAT obligationsgetLiabilities(string $vrn, string $from, string $to): Get VAT liabilitiesgetPayments(string $vrn, string $from, string $to): Get VAT payments
submitFps(HmrcPayeSubmission $submission): Submit Full Payment SubmissionsubmitEps(array $data, string $payeRef): Submit Employer Payment SummarysubmitEyu(array $data, string $payeRef): Submit Earlier Year Update
submitComputation(HmrcCorporationTaxSubmission $submission): Submit computationgetObligations(string $utr, string $from, string $to): Get obligationsgetLiabilities(string $utr, string $from, string $to): Get liabilitiesgetPayments(string $utr, string $from, string $to): Get payments
The application uses HMRC's sandbox environment for testing. Set HMRC_ENVIRONMENT=sandbox in your .env file.
HMRC provides test scenarios and data in their sandbox:
- Test VAT numbers
- Test PAYE references
- Test UTRs
See HMRC Developer Documentation for details.
Authorization Failed:
- Verify client ID and secret are correct
- Check callback URL matches exactly
- Ensure you're using the correct Government Gateway credentials
Submission Failed:
- Check all required fields are filled
- Verify VAT number/PAYE reference/UTR format
- Ensure return is marked as finalised
- Review error message from HMRC
Token Expired:
- The system automatically refreshes tokens
- If issues persist, re-authorize the application
All HMRC API calls are logged. Check storage/logs/laravel.log for:
- Request details
- Response codes
- Error messages
Enable debug logging:
HMRC_LOGGING_ENABLED=true
HMRC_LOG_CHANNEL=stackFor issues with:
- HMRC API: Contact HMRC Developer Support
- Application: Open an issue on GitHub
- MTD Requirements: See HMRC Making Tax Digital
This integration is designed to meet HMRC Making Tax Digital requirements. However:
- You are responsible for ensuring data accuracy
- Always review submissions before sending
- Keep records of all submissions
- Maintain backups of submission data
MIT License - See LICENSE file for details.