# Update Order Transaction custom fields

**URL:** <https://forum.shopware.com/t/update-order-transaction-custom-fields/98047>\
**Category:** Programming (EN)\
**Created:** [17. Januar 2023 um 11:51 UTC](https://forum.shopware.com/t/update-order-transaction-custom-fields/98047 "2023-01-17T11:51:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![miro](https://avatars.discourse-cdn.com/v4/letter/m/f08c70/32.png) [@miro](https://forum.shopware.com/u/miro)\
**Post date:** [17. Januar 2023 um 11:51 UTC](https://forum.shopware.com/t/update-order-transaction-custom-fields/98047/1 "2023-01-17T11:51:19Z")

</div>

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:

```auto
$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:

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

```

other errors start appear and I never made it.

Any ideas how to do it?  
Regards!

---

<div class="post-metadata">

**Author:** ![Ni\_Bo](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/ni_bo/32/18912_2.png) [@Ni\_Bo](https://forum.shopware.com/u/Ni_Bo)\
**Post date:** [27. Januar 2023 um 15:25 UTC](https://forum.shopware.com/t/update-order-transaction-custom-fields/98047/2 "2023-01-27T15:25:30Z")

</div>

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.)

```auto
'customFields' => [
    'some_number' => 10
]

```
