Update Order Transaction custom fields

Hi guys.

In my payment plugin I want to update the order_transcation.custom_fields field on checkout-finish page. I want to put in it the provider Transaction ID. I read into the Dev guide how to update into the DB, but can not do it in real life. I inject in my class Order-Transaction repository the try update like this:

$resp = $this->orderTransactionRepo->update([
                'id' => $transaction->getOrderTransaction()->getId(),
                'customFields' => 'some_number_here'
        ], $context);

The first error was my first parameter must be an array so I change it like this:

'id' => [$transaction->getOrderTransaction()->getId()]

other errors start appear and I never made it.

Any ideas how to do it?

Can you provide the error message you got before you changed the id parameter?
I’m fairly certain id should be a string here.

Also customFields is an associative array, not a string.
It should be (e.g.)

'customFields' => [
    'some_number' => 10