i could try to set the transaction id field to unique this should preventing at least to get the same transaction written in the database.
Ok put the field to unique and check with
if ($stmt->execute()) {
$stmt->close();
return true;
} else {
$stmt->close();
return false;
}
solved the problem with multiple windows from a single viewer for me