Read journal transaction
Reads one journal transaction: the header with the regime, and the detail and VAT lines with their own side.
Twinfield documentation: Journal transactions.
get($dayBook, $number) returns a JournalTransaction, or throws a TransactionNotFoundException when the transaction (or the day book) does not exist or was deleted ($exception->deleted). Use find() to get null instead.
$transaction->header: company, day book, number, status (ProvisionalorFinal), period, date, currency, origin, user and dates.$transaction->regime:Generic(visible in all regimes),Fiscal,CommercialorEconomic.$transaction->details: the lines with account (dim1), customer, supplier or cost center (dim2), project (dim3), side, amount, and VAT code and amount.$transaction->vat: the VAT Twinfield booked for the detail lines with a VAT code, with the amount it was calculated on (vatTurnover).
A journal transaction has no total line: debit() and credit() are the sums of both sides, and they are always equal. Amounts are Amount objects: exact numeric strings such as 435.55, which you can echo directly.
There is no search that gives transaction numbers: pass a day book and number you know, e.g. from the Twinfield user interface.
$twinfield = Example::twinfield();
if (!isset($argv[1], $argv[2])) { echo 'Pass a journal day book and transaction number, e.g. MEMO 202600003.', PHP_EOL;
exit(0);}
try { $transaction = $twinfield->journalTransactions()->get($argv[1], (int) $argv[2]);} catch (TransactionNotFoundException $exception) { echo $exception->deleted ? 'Deleted' : 'Not found: ' . $exception->reason, PHP_EOL;
exit(1);}
$header = $transaction->header;
echo 'Transaction: ', $header->dayBook, ' ', $header->number, ' (', $header->status->name, ')', PHP_EOL;echo 'Date: ', $header->date->format('Y-m-d'), ', period ', $header->period, ', regime ', $transaction->regime->value, PHP_EOL;echo 'Total: ', $transaction->debit(), ' debit = ', $transaction->credit(), ' credit ', $header->currency, PHP_EOL;
foreach ($transaction->details as $line) { echo sprintf( ' %-6s %-6s %-6s %10s %-7s %8s %s', $line->debitCredit->value, $line->dim1->code, $line->dim2->code ?? '', $line->value, $line->vatCode ?? '', $line->vatValue ?? '', $line->description ?? '', ), PHP_EOL;}
foreach ($transaction->vat as $line) { echo sprintf( ' %-6s %-6s %-6s %10s VAT %s on %s', $line->debitCredit->value, $line->dim1->code, '', $line->value, $line->vatCode, $line->vatTurnover ?? '-', ), PHP_EOL;}php examples/journal-transactions/read-journal-transaction/example.php MEMO 202600003Transaction: MEMO 202600003 (Provisional)Date: 2026-11-30, period 2026/11, regime GenericTotal: 1210.00 debit = 1210.00 credit EUR credit 8199 1000.00 PRIVE-H 210.00 Private use car debit 8199 1000.00 Private use car debit 4406 00100 210.00 credit 1618 210.00 VAT PRIVE-H on 1000.00What the SDK sends to Twinfield and what Twinfield sends back, for a call like the one in this example. The responses come from the tests, with example data.
Twinfield documentation: Journal transactions: Read.
$twinfield->journalTransactions()->get('MEMO', 202600003);The SDK sends this XML as xmlRequest of ProcessXmlString to processxml.asmx:
<read> <type>transaction</type> <office>1000</office> <code>MEMO</code> <number>202600003</number></read>Twinfield answers with this XML in ProcessXmlStringResult:
<transaction location="temporary" result="1"> <header> <office name="Example Holding B.V." shortname="">1000</office> <code name="Memoriaal" shortname="Memo">MEMO</code> <number>202600003</number> <period>2026/11</period> <currency name="Euro" shortname="Euro">EUR</currency> <regime>Generic</regime> <date>20261130</date> <origin>manual</origin> <originreference/> <modificationdate>20261201091200</modificationdate> <user name="Example user" shortname="User">EXAMPLE</user> <inputdate>20261130101530</inputdate> <freetext1>Private use November</freetext1> <freetext3/> </header> <lines> <line type="detail" id="1"> <dim1 name="Omzet privégebruik" shortname="" dimensiontype="PNL">8199</dim1> <debitcredit>credit</debitcredit> <basevalue>1000.00</basevalue> <rate>1</rate> <value>1000.00</value> <invoicenumber/> <description>Private use car</description> <vatcode name="Privégebruik 21%" shortname="Privé" type="sales">PRIVE-H</vatcode> <vatbasevalue>210.00</vatbasevalue> <vatvalue>210.00</vatvalue> <matchstatus>notmatchable</matchstatus> </line> <line type="detail" id="2"> <dim1 name="Omzet privégebruik" shortname="" dimensiontype="PNL">8199</dim1> <debitcredit>debit</debitcredit> <basevalue>1000.00</basevalue> <rate>1</rate> <value>1000.00</value> <invoicenumber/> <description>Private use car</description> <matchstatus>notmatchable</matchstatus> </line> <line type="detail" id="3"> <dim1 name="Btw privégebruik auto" shortname="" dimensiontype="PNL">4406</dim1> <dim2 name="Algemeen" shortname="" dimensiontype="KPL">00100</dim2> <dim3 name="Example project" shortname="" dimensiontype="PRJ">P0001</dim3> <debitcredit>debit</debitcredit> <basevalue>210.00</basevalue> <rate>1</rate> <value>210.00</value> <invoicenumber/> <description/> <comment>VAT on private use</comment> <matchstatus>notmatchable</matchstatus> </line> <line type="vat" id="4"> <dim1 name="Btw inzake privégebruik" shortname="" dimensiontype="BAS">1618</dim1> <debitcredit>credit</debitcredit> <basevalue>210.00</basevalue> <rate>1</rate> <value>210.00</value> <invoicenumber/> <description/> <vatbaseturnover>1000.00</vatbaseturnover> <vatturnover>1000.00</vatturnover> <vatcode name="Privégebruik 21%" shortname="Privé" type="sales">PRIVE-H</vatcode> <vatbasevalue>0.00</vatbasevalue> <vatvalue>0.00</vatvalue> <baseline>1</baseline> <matchstatus>available</matchstatus> <matchlevel>1</matchlevel> <relation>0</relation> <basevalueopen>-210.00</basevalueopen> </line> </lines></transaction>Source
Section titled “Source”View examples/journal-transactions/read-journal-transaction/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.