1

I've created a custom payment method and want to see the information inside the admin order detail page.

The payment method is a custom instore payment method and working so far.

I'd like to know how to get the name of the used payment method or its additional information into the order detail page enter image description here

I already tried to follow the instructions from the official magento 2.3 docs . The examples are not working and containing deprecated functions.

The examples in the docs for the braintree module are not working for my use-case and some functions used for the offline-payments are deprecated: e.g bank transfer payment model using $this->getConfigData(..) from Magento\Payment\Model\Method\AbstractMethod indicates a deprection @deprecated 100.0.6 for the file. The function getConfigData() is deprecated in @deprecated 100.2.0

Unfortunately it doesn't give any clue how to replace the deprecated function and only points to the devdocs in version 2.1.

Since this payment method is offline I also tried to make my codes similar to the offline payment methods on github.

3
  • Use can use aditionalInformation property of payment entity to store all custom details, also you need to specify paymentInfoKeys and privateInfoKeys in the payment config.xml. What examples are not working from the documentation?
    – joni jones
    Feb 19, 2019 at 14:40
  • Sounds good, can you supply with an example for a config.xml using these types of information?
    – Florian
    Feb 19, 2019 at 15:26
  • As an example, you can look into Braintree, Cybersource, eWay, Worldpay integrations. Magento\Payment\Model\Method\AbstractMethod is deprecated and should not be used. The official documentation describes only recommended approach based on Payment Gateway - this approach applicable for offline and online payment solutions.
    – joni jones
    Feb 19, 2019 at 16:47

1 Answer 1

1

I finally fixed the problem.

In my paymentmethod I needed to create/update the file in the

namespace Vendor\ModuleName\Block\Info

file as follows:

use Magento\Payment\Block\ConfigurableInfo;

class LocalPayment extends ConfigurableInfo
{
    protected function getLabel($field)
    {
        return __($field);
    }
}

This will render the paymentMethod name into the orders. It will also do this for past created orders.

2
  • I'm having the same issue. Can you share how you implemented the new offline method? May 15, 2020 at 13:26
  • I found a open-source payment-method and adopted it for my needs. Unfortunately I don't have access to the code any more
    – Florian
    May 19, 2020 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.