Hello,
Instead of using copyfrom, try adding each field individually.
"This function allows you to hydrate the mapper using an array (or the name of a hive variable containing an array)."
So, what I'm interpreting is that you're trying to hydrate the mapper with your "$invoice_management->load(array('record_id = ?', $f3->get('SESSION.invoice_id')));" call that loads the record that you wish to update.
But then you use copyfrom that will try to rehydrate the mapper with all variables from your request. As your $_POST array has no id field, it just creates a new record.
So, try doing something like:
if ($f3->get('SESSION.invoice_id')) {
$invoice_management->load(array('record_id = ?', $f3->get('SESSION.invoice_id')));
}
$invoice_management->transaction_id = $f3->get('SESSION.payment_id') ;
$invoice_management->transaction_total = $f3->get('SESSION.OrderSummary')['grandtotal'];
// (...etc)
$invoice_management->save();
Again, not absolutely sure this is the issue as I rarely used copyfrom, but is what I could deduce from the docs.
Cheers