ahlan hamad

Setup guide · Sage Accounting payroll journals · Coming soon

Set up Sage Accounting payroll journals: step by step

This guide is for Sage Accounting (Sage Business Cloud Accounting: Start, Standard or Plus) only. It is not for Sage 50, Sage 200, Sage 300 or Sage X3, which can't be connected. It is for two people working together: your Sage Accounting admin, who creates your company's Sage app and approves the connection, and the person who runs payroll in AhlanHamad, who connects Sage and maps the accounts with your accountant. Follow it in order. Every AhlanHamad label below is the one you will see on screen.

Updated 14 October 2026

1. Before you start

Coming soon. Posting payroll journals to Sage is switched off. You can do the Sage side (sections 2 and 3) now; the Sage Accounting page appears under Integrations once we switch it on for your company. Until posting is on, its Field Mapping tab says “Posting payroll journals to Sage isn't switched on for your workspace yet.”

CheckWhat you need
Where it standsBuilt against Sage's Accounting API v3.1 documentation, and tested only against a simulated Sage. It hasn't posted to a real Sage Accounting business yet, so start with a test business if you can (section 3) and check your first journals closely.
Which SageSage Accounting, Sage's cloud product (also called Sage Business Cloud Accounting): Start, Standard or Plus. Not Sage 50, Sage 200, Sage 300 or Sage X3: those are separate products and AhlanHamad does not connect to them.
Country and currencySage documents its journal API for Sage Accounting businesses in the United Kingdom, Ireland and Canada only, so use a business registered there; we don't claim it works for any other. Their books are in GBP, EUR or CAD. A payroll run in KWD, SAR, AED or another currency is held until you switch on Post runs in other currencies (section 5).
DecimalsSage books keep 2 decimals. A run converted from a 3-decimal currency (KWD, BHD, OMR) is rounded to 2 decimals per line, and any rounding difference is put on the largest line; the journal's description says so. The journal still balances.
Sage peopleSomeone who can create an app in Sage's developer portal (section 2), and a Sage Accounting user of the business with full access to journals, who signs in to approve the connection (section 3).
In AhlanHamadA company admin who can manage settings (to connect and save the mapping), and the person who finalizes and pays payroll. Your accountant should help with the mapping.

Only totals are sent to Sage: one line per account, never a line per employee. Names, IDs and individual salaries stay in AhlanHamad (the journal's description carries the number of employees in the run, nothing more).

2. In Sage Developer: create your own Sage app

AhlanHamad connects to Sage through an app your company creates in Sage's developer portal and uses only for itself. Sage's steps: set up the basics and authentication. Sage's developer pages could not be opened in full while we wrote this, so the screen may be named differently in your version; the linked pages have Sage's current wording.

  1. Open Sage's developer portal, Sage Developer Self Service (developerselfservice.sageone.com, linked from Sage's quick-start guide), and sign in or sign up. Sage lets you use a GitHub login or an email address.
  2. Click Create App. Give it a name you will recognise, for example AhlanHamad payroll. A contact email is optional.
  3. In the Callback URL field, enter https://ahlanhamad.com/auth/sage/callback exactly as written: https, same casing, no slash at the end. AhlanHamad shows the same address on the Connection tab under “Redirect URI to register on your app”, with a Copy button.
  4. Save the app. Sage then shows its Client ID and Client Secret. Copy both; keep the secret private. You paste them in section 4, and AhlanHamad stores them encrypted.
  5. There are no permissions to tick on the app. When you connect, AhlanHamad asks Sage for the full_access scope, which posting journals needs (Sage: authentication).

3. In Sage Accounting: check the business and the user

  1. Check the business's country and base currency. AhlanHamad reads them from Settings → Financial Settings in Sage. It should be a UK, Irish or Canadian business, in GBP, EUR or CAD.
  2. Choose the Sage user who will approve the connection. That user needs Full Access to Journals in Sage's user access, as AhlanHamad's error message says: “the Sage user who connected needs Full Access to Journals in Sage Accounting (Settings → Manage Users)”. Open Settings → Manage Users, open the user and check it; the screen may be named differently in your version. If you are not sure, use the business's administrator.
  3. If that user can reach more than one Sage business: AhlanHamad does not ask which one. It uses the business Sage opens first for that user (Sage's lead business), or else the first one Sage lists. Use a user who reaches only the business you keep payroll in, or check the business name AhlanHamad shows in section 5 before you save the mapping.
  4. Check your chart of accounts has the liability accounts payroll needs (salaries payable, social insurance payable, end-of-service provision). Sage's control accounts (such as Debtors Control, Creditors Control and VAT) can't take payroll journals.
  5. If you can, try everything first in a separate Sage Accounting trial business (Sage lists trial sign-ups for the UK, Ireland and Canada in set up the basics), then connect your real business.

4. In AhlanHamad: connect Sage

  1. Go to Integrations and open Sage Accounting. Stay on the Connection tab; the card is called Sage Connection. The note at the top, What this connection does, says what is switched on for your company.
  2. Client ID and Client Secret: paste the values from section 2. The box under them says “Use your own Sage Developer app. Create one in the Sage Developer portal, set its callback URL to the address shown below, then paste its credentials below. We encrypt and store the client secret server-side, then redirect you to Sage to authorize access.”
  3. Check the address under Redirect URI to register on your app is the callback URL you saved on your Sage app.
  4. Click Connect to Sage. AhlanHamad says “Sage OAuth initiated — complete sign-in in the redirect window” and opens Sage's sign-in. If Sage asks for your region first, choose the United Kingdom, Ireland or Canada.
  5. Sign in as the Sage user from section 3 and allow AhlanHamad access to your business.
  6. You come back to a page that says Connected to Sage Accounting, then to the Sage Accounting page. The card now shows Connected to Sage Accounting and the Business ID Sage gave the business.

Your app's Client ID and Secret stay saved. If you connect again later, the card says “Your app credentials are saved. Click Connect to sign in with them — no need to enter them again.” To use another app, click Replace credentials (or Keep saved credentials to go back). A reconnect keeps the same Sage business while the new sign-in still reaches it; if it reaches a different business, the saved mapping no longer applies and you map again (section 5).

Already sending payroll to another accounting system? If another one is connected and receiving payroll, AhlanHamad asks first: “Connect a second accounting system?” If you connect Sage too, every payroll run is posted to both and your payroll costs are booked twice. If you are moving to Sage, click Cancel, disconnect the other system first, then connect Sage.

5. Check the business, then map your accounts

  1. Open the Field Mapping tab. The card is called Post payroll journals to Sage.
  2. Click Load my accounts. This reads the business's name, base currency and the accounts Sage shows in journals. The card then shows Posting to the business's name and its Base currency. If it is not the business you expected, see section 3 before going on.
  3. Map each Ahlan Hamad account to a Sage account (table below). Some are pre-selected and marked Suggested when the match is clear; check every one with your accountant.
  4. Click Save mapping. Until every required account is mapped the card says “Runs that use an unmapped account are held until it is mapped.”
  5. If you pay payroll in KWD, SAR, AED or any currency other than the business's base currency, switch on Post runs in other currencies. Without it those runs are held (section 6).

Which Sage account for each payroll account

CodeAhlan Hamad accountNeededTypical Sage ledger account type
5100Salaries — basic, other allowances, overtime & additionsRequiredOverheads (expense)
5400Housing allowanceRequiredOverheads (expense)
5500Transport allowanceRequiredOverheads (expense)
5200Employer social-insurance contributionRequiredOverheads (expense)
5300End-of-service expenseRequiredOverheads (expense)
2100Net salaries payableRequiredCurrent Liabilities (not Creditors Control)
2200Social insurance payable (employee + employer)RequiredCurrent Liabilities
2300End-of-service provisionRequiredFuture (long-term) Liabilities
1101Bank account salaries are paid fromRequiredBank, or a clearing account (see below)
2700Deductions withheld (loans, penalties, unpaid leave)Only if usedCurrent Liabilities
5810Bank transfer charges on salariesOnly if usedOverheads (expense)
5310DIFC DEWS employer contributionOnly if usedOverheads (expense)
2310DIFC DEWS payableOnly if usedCurrent Liabilities
5900Foreign-exchange gain/loss on payroll (only if a run in another currency is paid at a different rate)Only if usedYour exchange gain or loss account

End-of-service is not on the payroll journal. It is its own journal each month (5300 End-of-service expense / 2300 End-of-service provision).

6. What gets posted, and when

When this happens in AhlanHamadSage receivesDated
A payroll run is finalized (Finalize)Payroll accrual: salaries and allowances, employer social insurance and the payables they create (debits 5100–5500, credits 2100, 2200 and, if used, 2700)The last day of the payroll month
The run is paid (Mark as Paid, or CEO Sign-off & Pay)Salary payment: debit 2100 Net salaries payable, credit 1101The day the run was signed off and paid
Bank transfer charges are recorded on a paid runBank charges: debit 5810, credit 1101The pay day
A month endsEnd-of-service accrual: debit 5300, credit 2300 — sent automatically on the 1st of the next month. You can also run it by hand for a finished month with Run Monthly Accrual on the Finance page.The last day of that month
A run is deleted, or a posted journal is correctedA reversal: a new journal with the same lines, debit and credit swapped, under its own marker. Sage does not link the two: the reversal's reference ends with “(reverses AH…)” naming the original's marker. A corrected run is then posted again as a new journal.The day of the change

Every journal's description starts with what it is and AhlanHamad's own reference for it: PAY-KW-2026-10 for the October 2026 Kuwait payroll accrual, PAY-KW-2026-10-PMT for its salary payment, PAY-KW-2026-10-FEES for its bank charges, IND-KW-2026-10 for that month's end-of-service accrual (the country code is the run's own). A reversal's description starts with “Reversal of” and the reference it reverses. Each journal also carries a marker: AH followed by 12 letters and digits.

7. Check your first payroll in Sage

  1. In AhlanHamad, open the payroll run. The Sage journals card lists each journal (Payroll accrual, Salary payment, …) with its status. Posted means Sage has it.
  2. In Sage Accounting, open your journals list (in many versions under Accounting → Journals; the screen may be named differently in your version) and find the journal whose reference starts with the marker the run card shows (AH…).
  3. Check: the date (the last day of the payroll month for the accrual), one line per mapped account, totals that match the payroll run in AhlanHamad (converted, if the run was in another currency), and that it is not on your VAT return.
  4. After the run is paid, check the Salary payment journal the same way, and match it to your bank as described in section 5.

Statuses on the run card: Queued and Sending (on its way), Waiting (another journal must reach Sage first), Retrying (Sage or the network was busy; we try again automatically), Posted, On hold (needs you; the reason is shown), Failed (Sage refused it; the reason is shown), Not needed (nothing to send; the reason is shown).

8. Troubleshooting

Company admins who can manage settings, and finance managers, also get an in-app notice and an email when Sage journals are held or fail: one per problem, a reminder after three days, and a short note when it clears. No amounts, names or Sage errors are put in the email; open the payroll run to see the reason.

When connecting (Connection tab and the return page)

What you seeWhat to do
Enter your app's Client ID and Client Secret to connect.Paste both values from your app (own-app connection only), then click Connect.
Enter both the Client ID and the Client Secret to replace the saved credentials.You started replacing the saved credentials: fill in both fields, or click Keep saved credentials.
Connecting isn't available yet: this workspace's app address isn't configured. Contact support and we'll set it up.Contact us. Nothing on your side is wrong.
Couldn't connect Sage Accounting — with “No authorization code was returned. The connection was cancelled or the link is invalid.”You cancelled or declined on the Sage Accounting screen, or the link was opened twice. Start again from the Connection tab.
You were signed out before the connection finished. Sign in again, then reconnect from the integration settings.Sign in to AhlanHamad, then click Connect again. Use the same browser for the whole flow.
This connection link is invalid, expired or already used. Start the connection again from the integration's settings page.Each connect link works once and for a short time. Click Connect again on the Connection tab.
Token exchange failed: …Sage Accounting refused to hand over the connection: usually the Client Secret is wrong, or the redirect URI on your app does not match exactly. Check both (own-app connection), then connect again.
No stored Sage credentials for this company. Run Connect first.Your app's keys were not saved. On the Connection tab, paste the Client ID and Client Secret again and click Connect to Sage.
Sage shows an error page instead of the sign-in, mentioning the callback or redirect addressThe callback URL on your Sage app does not match. Set it to https://ahlanhamad.com/auth/sage/callback exactly as written, save the app, then connect again.
Status Error, with “Sage no longer accepts this connection (refresh …). Reconnect Sage.” or “Sage no longer accepts this connection (daily connection check: …). Reconnect Sage from Integrations.”Sage stopped accepting the saved connection (see “On hold” below). Click Connect to Sage and sign in again; the saved app credentials are used.

When loading your accounts (Field Mapping tab)

What you seeWhat to do
Could not read the Sage company (…). Sage did not report the business's base currency (Settings → Financial Settings). Check it in Sage, then load your accounts again.In Sage, open Settings → Financial Settings and check the base currency is set, then click Reload accounts.
Could not read the Sage company (…). The Sage connection does not say which business it reaches. Reconnect Sage.Sage didn't tell us which business the sign-in reaches. On the Connection tab, disconnect, then connect again with a Sage user of the business.
Could not read the Sage chart of accounts (…).Check the Sage user can open the chart of accounts, then click Reload accounts. If it keeps happening, send us the whole message.
Posting to shows the wrong businessAhlanHamad posts to the business the sign-in reaches (section 3). Disconnect, then connect again with a Sage user who reaches only the right business. The mapping is then made again for that business.

On the payroll run: On hold

A held journal is waiting, not lost. Fix the reason and it goes, either by itself or when you press Retry on the run card.

What you seeWhat to do
Map these accounts first: 5400, 5500.Map the listed account codes on the Field Mapping tab and click Save mapping, then Retry.
Load your accounts and save the mapping on the integration page first.On the Field Mapping tab, click Load my accounts, save the mapping, then Retry. This also shows when the connection now reaches a different Sage business than the saved setup.
… mapped to an account that can't be used in a journal (Accounts Payable or Receivable, a system or bank account, or an account with no code). Pick another account on the integration page.In Sage terms: a control account (such as Debtors Control, Creditors Control or VAT). Map those codes to an ordinary liability or clearing account, save, then Retry.
This run's currency differs from your books. Allow other-currency posting to send it.Switch on Post runs in other currencies on the Field Mapping tab, then Retry. Or keep that run out of Sage.
The connection needs to be renewed. Reconnect and try again.Sage stopped accepting the saved connection: someone removed AhlanHamad's access, the Sage user who approved it lost access, or the connection went unused for longer than Sage allows (we haven't confirmed Sage's limit). While posting is on, AhlanHamad checks the connection once a day, which also renews it; even so, you may sometimes need to reconnect. Click Connect to Sage on the Connection tab and sign in again. Journals held for this reason are sent automatically once you reconnect.
Not connected, or posting is switched off.Connect Sage again on the Connection tab. Held journals are sent automatically once you reconnect. If Sage is connected and you still see this, ask us: posting may have been switched off for your company.

On the payroll run: Failed

These come back from Sage, in English, with Sage's own words added after ours. Fix the cause in Sage or in the mapping, then press Retry. A retry never creates a second journal.

What you seeWhat to do
Sage rejected the journal (400). followed by Sage's own messageRead Sage's message after ours (each error starts with Sage's code in brackets). Fix the cause in Sage or in the mapping, then Retry.
Sage refused access (403). The connection may lack permission to post journals, or the organisation was disconnected — reconnect Sage.Sage refused for a reason other than journal access. Check the Sage user who connected can still open the business, reconnect on the Connection tab, then Retry.
Sage could not find the company or an account this journal points at (404). Check the account mapping belongs to the connected company.A mapped account was deleted or archived in Sage. Click Reload accounts, fix the mapping, save, then Retry.
This run's payroll accrual journal did not reach Sage. Retry the accrual first, then retry this payment, so it clears exactly the salaries payable the accrual booked.Retry the Payroll accrual line first, then the Salary payment line.
No exchange rate from … to … is available.Try again later, or contact us.
… — gave up after 6 attempts.Sage or the network kept failing. Check Sage opens normally, then press Retry.
Sage rejected the journal (422).Sage found the journal's data invalid. Read Sage's message after ours: for example the date may fall in a period your business has closed, or an account may no longer take journals. Fix it, then Retry.
Sage refused the journal (403): the Sage user who connected needs Full Access to Journals in Sage Accounting (Settings → Manage Users).Give that user Full Access to Journals in Settings → Manage Users (section 3), or reconnect as a user who has it. Then Retry.
Sage refused the journal: the Sage Accounting business has no active subscription.The business's Sage subscription has ended. Renew it with Sage, then Retry. Reconnecting won't help.

Sage failures end with a Sage Request-Id in brackets when Sage sent one. Send us the whole message with it: Sage support uses that number to find the call.

On the payroll run: Not needed

What you seeWhat it means
Reversed in Ahlan Hamad before it reached Sage; the pair nets to zero.Nothing to do: the journal and its reversal cancel out, so neither is sent to Sage.
Reverses an entry that never reached Sage, so there is nothing to reverse there.Nothing to do.

Two accounting systems

If the Sage page or the payroll run says “Payroll is being posted to …” with more than one system, every run is booked in each of them. If you keep your books only in Sage, disconnect the others so payroll costs aren't counted twice.

9. Disconnecting

  1. In AhlanHamad, go to Integrations → Sage Accounting → Connection and click Disconnect Sage. AhlanHamad deletes the stored credentials and asks Sage to revoke the saved connection.
  2. If you won't use your Sage app again, delete it (or its secret) in Sage Developer Self Service too; the screen may be named differently in your version.

Sage sources used in this guide

About AhlanHamad × Sage· All integrations