Matching audit trail
Lists the matches and undone matches of the last 30 days (or since a date), from the REST API.
matching()->auditTrailSince($since)goes through the whole trail, oldest first;auditTrail($since, $limit)reads one page of at most 200 events.- Each event has the match number, the dimension, the user and the matched transaction lines with the matched amounts.
Unmatchedevents have no match date. - The match number is the one
matching()->undo()needs.
Needs the scope readBookkeepingMatches.
$twinfield = Example::twinfield();
$since = new DateTimeImmutable($argv[1] ?? '-30 days');
foreach ($twinfield->matching()->auditTrailSince($since) as $event) { echo sprintf( '%s %s match %d on %s by %s', $event->logTimestamp->format('Y-m-d H:i'), $event->eventType->value, $event->matchNumber, $event->dimensionCode, $event->userCode, ), PHP_EOL;
foreach ($event->lines as $line) { echo ' ', $line->dayBook, ' ', $line->number, ' line ', $line->lineId, ': ', $line->matchedAmount, PHP_EOL; }}php examples/matching/matching-audit-trail/example.phpphp examples/matching/matching-audit-trail/example.php 2026-11-01Add TWINFIELD_DEBUG=1 to see the requests and responses.
2026-11-04 10:48 Matched match 119 on 1000 by JDOE VRK 202600070 line 1: 121.00 BNK 202600014 line 2: -121.002026-11-04 10:52 Unmatched match 119 on 1000 by JDOE BNK 202600014 line 2: -121.00Source
Section titled “Source”View examples/matching/matching-audit-trail/example.php on GitHub.
Twinfield and Wolters Kluwer are trademarks of Wolters Kluwer. Their names and logos are used only to refer to their products.