Integration Best Practices
Startup Check
Always run initialize at startup. If it returns online: false, alert the user that they are operating in offline mode.
Calculation Precision
Ensure all total and totalVAT fields are rounded to 2 decimal places.
$Total = (UnitPrice \times Quantity) - Discount$
Config Updates
If a sale response includes shouldDownloadLatestConfig: true, trigger a background call to refresh tax rates.
Unique Invoices
Never reuse a posInvoiceNumber, even for failed attempts, unless explicitly retrying the exact same payload.
Troubleshooting
| Symptom | Cause | Resolution |
|---|---|---|
| Connection Refused | Service not running | Check if the Windows Service or Kestrel console is active. |
| 401 Unauthorized | Expired Token | Use /set-token or re-run the activation sequence. |
| Validation Errors | Data Mismatch | Verify taxRateId matches MRA global configurati |