How to set order payment transaction id and transaction data for an order?

Payment order payment transaction id and transaction data update to order payment

How to set order payment transaction id and transaction data for the order ?.like magento 1X transaction raw data adding… ?

Any idea ?

Use the \Magento\Sales\Model\Order\Payment::setTransactionId() method to set an ID for a transaction and the \Magento\Sales\Model\Order\Payment::setTransactionAdditionalInfo() method to set an additional information to a transaction.

Thank you.

could you pls elabrote in detail