ml-connector
Sage 50GoCardless

Sage 50 and GoCardless integration

Sage 50 runs accounting on the desktop. GoCardless handles recurring and one-off bank debit collections from customers globally. When you collect customer payments through GoCardless, those settlements flow back into your Sage 50 bank account and customer receivables, reconciling collections against invoices without manual data entry. ml-connector bridges the two systems and handles the very different integration models each requires.

How Sage 50 works

Sage 50 is a Windows-installed desktop application available in US (formerly Peachtree) and UK editions, with no cloud REST API. Integration uses the local Windows SDK (Sage 50 .NET SDK for US edition, Sage Data Objects COM/ActiveX for UK edition) which requires a Windows process with direct access to company data files on the same machine or LAN. Authentication is Windows-local username and password against Sage 50's internal user database, with no OAuth or bearer tokens. Key entities include customers, vendors, invoices, orders, payments, accounts, and general ledger entries. Because Sage 50 has no webhook system, records are read by polling modified transactions by date range or audit trail, with a minimum poll interval of 5 to 15 minutes recommended for near-real-time sync.

How GoCardless works

GoCardless is a global bank debit payment processor handling recurring and one-off collections in 30+ countries, exposing customers, mandates, payments, subscriptions, payouts, and refunds through a REST JSON API at api.gocardless.com. Authentication uses a bearer token (direct access token from the merchant dashboard) in the Authorization header, with an optional OAuth 2.0 authorization-code flow for partner platforms. GoCardless posts real-time events to a registered HTTPS webhook endpoint with HMAC-SHA256 signature verification; polling via GET /events is supported but webhooks are primary. Every webhook must be verified by computing HMAC-SHA256(secret, raw_body) and comparing to the Webhook-Signature header, and the endpoint must return 2xx only on valid signatures. Payouts are read-only and created automatically by GoCardless.

What moves between them

The main data flow is from GoCardless into Sage 50. When a customer payment settles through GoCardless, the payout notification arrives via webhook, triggers a lookup of the matching Sage 50 customer invoice, and creates a customer receipt in Sage 50 applied to that invoice. Bank account reconciliation entries flow simultaneously, mapping the payout amount to Sage 50's bank account and linking it to the underlying customer mandate. Customer master data such as bank account and payment mandate status may flow from Sage 50 into GoCardless during setup, but the primary continuous sync is settlement and receipt. The frequency depends on your payment schedule and GoCardless settlement cadence, typically daily or weekly.

How ml-connector handles it

ml-connector stores the Sage 50 SDK credentials (Windows username and password, plus the application ID and company data path for US edition or data path for UK edition) encrypted and initiates a local Windows SDK session when it needs to read or write data. It also stores the GoCardless bearer token encrypted and handles webhook signature verification by computing HMAC-SHA256 on the raw request body and comparing it to the Webhook-Signature header, rejecting any unsigned or mismatched webhook. When a GoCardless payout webhook arrives, ml-connector looks up the customer in Sage 50 by bank account number or mandate reference, reads the open invoices for that customer via the SDK, matches the payout amount against the oldest or highest-priority invoice, and writes a customer receipt into Sage 50's receivables module. If no exact match exists, it creates a suspense or unapplied payment record for manual review. Sage 50's exclusive-access constraint means ml-connector must not hold an SDK session open while an interactive user is logged in; the solution is to hold sessions only for the duration of each read or write operation and release them immediately. Webhook retry logic in GoCardless is handled by verifying signatures and returning 2xx only on success; a mismatch returns 4xx and GoCardless will retry up to a configured limit. Every customer receipt and suspense payment carries the GoCardless payout ID and mandate ID in memo or reference fields for full audit traceability.

A real-world example

A mid-sized subscription software company in the UK runs Sage 50 Accounts for invoicing and accounts receivable. The company uses GoCardless to collect recurring subscription fees from its customer base across multiple countries. Before the integration, when a customer payment settled through GoCardless, the finance team logged into GoCardless, exported a transaction list, and manually keyed each payout and its corresponding customer receipt into Sage 50, a process prone to timing mismatches and duplicate entry errors. With Sage 50 and GoCardless connected, each daily settlement batch arrives as a webhook, ml-connector automatically matches payouts to invoices and posts customer receipts into Sage 50's receivables, and the bank account reconciliation is pre-populated with settlement detail. Month-end close no longer requires manual cash application, and the AR aging report in Sage 50 stays current with the actual GoCardless collections.

What you can do

  • Receive GoCardless payout events via webhook and verify HMAC-SHA256 signatures automatically.
  • Match GoCardless customer payments to Sage 50 invoices and post customer receipts without manual data entry.
  • Reconcile GoCardless payouts against Sage 50 bank accounts using payout settlement data.
  • Handle Sage 50 SDK exclusive-access constraints by releasing sessions immediately after each operation.
  • Maintain a full audit trail linking each Sage 50 receipt to the GoCardless payout ID and mandate reference.

Questions

How does ml-connector handle Sage 50's exclusive-access constraint, where the SDK requires exclusive access to company data?
ml-connector acquires an SDK session only when it needs to read or write data, completes the operation immediately, and releases the session at once. This allows interactive users to log into Sage 50 at any other time without conflict. The tradeoff is that each Sage 50 operation incurs the overhead of opening and closing an SDK connection, but correctness and usability are prioritized over raw speed.
What happens if a GoCardless payout does not match any open invoice in Sage 50?
ml-connector creates a suspense or unapplied payment record in Sage 50's receivables module, tagged with the GoCardless payout ID and customer reference. This record appears on the finance team's review list and can be manually applied once the customer or sales team clarifies which invoice the payment covers.
Does ml-connector support both Sage 50 US and UK editions?
Yes. ml-connector detects the edition by the credential format provided (ApplicationID and CompanyPath for US .NET SDK, or DataPath for UK Sage Data Objects). The SDK interaction layer is abstracted so the same ml-connector flow works for both, though the underlying data structures and field names differ slightly between editions.

Related integrations

Connect Sage 50 and GoCardless

Free to use. Add your credentials, ping your real systems, and see if we fit.

Get started