Skip to content

Adminhtml sales order payment information section in magento 2.4.6

Adminhtml sales order payment information section add custom filed custom payment thorw how to do i try this way but it not working
enter image description here

code working but Payment information sction not show

sales_order_view.xml

<?xml version="1.0"?>
 <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="order_payment">
        <block class="VendornameModulenameBlockAdminhtmlOrderViewPaymentInfo" name="test_payment_info" template="Vendorname_Modulename::order/view/payment_info.phtml"/>
    </referenceBlock>
</body>
app/code/Vendorname/Modulename/Block/Adminhtml/Order/View/PaymentInfo.php

public function getOrder()
{
    return $this->getParentBlock()->getOrder();
}

public function getTransaction()
{
    $order = $this->getOrder();
    $collection = $this->transactionCollectionFactory->create()
        ->addFieldToFilter('order_id', $order->getIncrementId())
        ->getFirstItem();

    return $collection;
}