Read cash transaction
Reads one cash transaction. Cash transactions work like bank transactions: one statement, with a total line on the cash account and detail and VAT lines.
Twinfield documentation: Cash transactions.
get($dayBook, $number) returns a CashTransaction, or throws a TransactionNotFoundException when it does not exist.
$twinfield = Example::twinfield();
if (!isset($argv[1], $argv[2])) { echo 'Pass a cash book and transaction number, e.g. KAS 202600046.', PHP_EOL;
exit(0);}
try { $transaction = $twinfield->cashTransactions()->get($argv[1], (int) $argv[2]);} catch (TransactionNotFoundException $exception) { echo '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, PHP_EOL;echo 'Statement: ', $transaction->statementNumber ?? '-', PHP_EOL;echo 'Balance: ', $transaction->startValue, ' → ', $transaction->closeValue, ' ', $header->currency, PHP_EOL;echo 'Total: ', $transaction->total->debitCredit->value, ' ', $transaction->total->value, ' on ', $transaction->total->dim1->code, PHP_EOL;
foreach ($transaction->details as $line) { echo sprintf( ' %-6s %-6s %-8s %10s %-12s %s', $line->debitCredit->value, $line->dim1->code, $line->dim2->code ?? '', $line->value, $line->matchStatus->value, $line->dim2->name ?? $line->description ?? '', ), PHP_EOL;
foreach ($line->matches as $set) { foreach ($set->lines as $match) { echo ' matched with ', $match->dayBook, ' ', $match->number, ' line ', $match->line, ': ', $match->matchValue, PHP_EOL; } }}
foreach ($transaction->vat as $line) { echo sprintf( ' %-6s %-6s VAT %-4s %10s', $line->debitCredit->value, $line->dim1->code, $line->vatCode, $line->value, ), PHP_EOL;}php examples/cash-transactions/read-cash-transaction/example.php KAS 202600046Transaction: KAS 202600046 (Provisional)Date: 2026-11-03, period 2026/11Statement: 246Balance: 1397.46 → 1518.46 EURTotal: debit 121.00 on 1000 credit 1300 1000 121.00 available Example customerWhat 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: Cash transactions: Read.
$twinfield->cashTransactions()->get('KAS', 202600046);The SDK sends this XML as xmlRequest of ProcessXmlString to processxml.asmx:
<read> <type>transaction</type> <office>1000</office> <code>KAS</code> <number>202600046</number></read>Twinfield answers with this XML in ProcessXmlStringResult:
<transaction result="1" location="temporary"> <header> <office name="Example Holding B.V." shortname="Holding">1000</office> <code name="Kas" shortname="Kas">KAS</code> <currency name="Euro" shortname="Euro">EUR</currency> <date>20261103</date> <statementnumber>246</statementnumber> <startvalue>1397.46</startvalue> <closevalue>1518.46</closevalue> <origin>webservice</origin> <user name="Example user" shortname="User">EXAMPLE</user> <period>2026/11</period> <number>202600046</number> </header> <lines> <line type="total" id="1"> <dim1 name="Kas" shortname="" type="BAS" inuse="true" vatcode="" vatobligatory="false">1000</dim1> <debitcredit>debit</debitcredit> <value>121.00</value> <rate>1</rate> <basevalue>121.00</basevalue> <matchstatus>notmatchable</matchstatus> </line> <line type="detail" id="2"> <dim1 name="Debiteuren" shortname="Debiteuren" type="BAS" inuse="true" vatcode="" vatobligatory="false">1300</dim1> <dim2 name="Example customer" shortname="" type="DEB" inuse="true" vatcode="" vatobligatory="false">1000</dim2> <debitcredit>credit</debitcredit> <value>121.00</value> <invoicenumber>2026-0043</invoicenumber> <description>Invoice 2026-0043</description> <rate>1</rate> <basevalue>121.00</basevalue> <matchlevel>2</matchlevel> <openvalue>121.00</openvalue> <openbasevalue>121.00</openbasevalue> <matchstatus>available</matchstatus> </line> </lines></transaction>Source
Section titled “Source”View examples/cash-transactions/read-cash-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.