How to get transaction id of an order in magento 2?Magento 2 - How to provide transaction?Magento 2 - Get order PayPal information programmaticallyMagento 2: unable to set payment Transaction Id after successful payment processing (solved by myself)How to send transaction email with transaction email id magento2How to attach transaction to magento 2 order?Magento 2 - How to get order id?Magento 2 get transaction status from BraintreeMagento2 how to get the payment method title instead of payment html in new order transaction email?Import Order/Invoice/Credit Memos/ Transaction/ Comment HistoryHow order save before payment in paypal express

Method to test if a number is a perfect power?

Gears on left are inverse to gears on right?

Was Spock the First Vulcan in Starfleet?

What Brexit proposals are on the table in the indicative votes on the 27th of March 2019?

India just shot down a satellite from the ground. At what altitude range is the resulting debris field?

Crossing the line between justified force and brutality

How long to clear the 'suck zone' of a turbofan after start is initiated?

Type int? vs type int

How do I find the solutions of the following equation?

Tiptoe or tiphoof? Adjusting words to better fit fantasy races

when is out of tune ok?

Would a high gravity rocky planet be guaranteed to have an atmosphere?

What is the intuitive meaning of having a linear relationship between the logs of two variables?

Anatomically Correct Strange Women In Ponds Distributing Swords

Is there a good way to store credentials outside of a password manager?

How to run a prison with the smallest amount of guards?

How do scammers retract money, while you can’t?

Sequence of Tenses: Translating the subjunctive

How easy is it to start Magic from scratch?

How do I extract a value from a time formatted value in excel?

Unreliable Magic - Is it worth it?

What can we do to stop prior company from asking us questions?

How can I get through very long and very dry, but also very useful technical documents when learning a new tool?

What does "I’d sit this one out, Cap," imply or mean in the context?



How to get transaction id of an order in magento 2?


Magento 2 - How to provide transaction?Magento 2 - Get order PayPal information programmaticallyMagento 2: unable to set payment Transaction Id after successful payment processing (solved by myself)How to send transaction email with transaction email id magento2How to attach transaction to magento 2 order?Magento 2 - How to get order id?Magento 2 get transaction status from BraintreeMagento2 how to get the payment method title instead of payment html in new order transaction email?Import Order/Invoice/Credit Memos/ Transaction/ Comment HistoryHow order save before payment in paypal express













2















How to get transaction id of order in Magento 2?










share|improve this question
























  • do you have any code that you have tried?

    – magefms
    yesterday











  • I have tried this $transactionFactory = $objectManager->get('MagentoSalesModelResourceModelOrderPaymentTransactionCollectionFactory'); $transactions = $transactionFactory->create()->addOrderIdFilter($_order->getId()); print_r($transactions->getItems()); but this is not working

    – Amatya Trivedi
    yesterday












  • payment transaction id or order id?

    – Muhammad Anas
    yesterday











  • I want payment transaction id

    – Amatya Trivedi
    yesterday











  • You shouldn't use objectManager directly in your code

    – Shawn Abramson
    21 hours ago















2















How to get transaction id of order in Magento 2?










share|improve this question
























  • do you have any code that you have tried?

    – magefms
    yesterday











  • I have tried this $transactionFactory = $objectManager->get('MagentoSalesModelResourceModelOrderPaymentTransactionCollectionFactory'); $transactions = $transactionFactory->create()->addOrderIdFilter($_order->getId()); print_r($transactions->getItems()); but this is not working

    – Amatya Trivedi
    yesterday












  • payment transaction id or order id?

    – Muhammad Anas
    yesterday











  • I want payment transaction id

    – Amatya Trivedi
    yesterday











  • You shouldn't use objectManager directly in your code

    – Shawn Abramson
    21 hours ago













2












2








2








How to get transaction id of order in Magento 2?










share|improve this question
















How to get transaction id of order in Magento 2?







magento2 magento2.2.4






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday







Amatya Trivedi

















asked yesterday









Amatya TrivediAmatya Trivedi

339




339












  • do you have any code that you have tried?

    – magefms
    yesterday











  • I have tried this $transactionFactory = $objectManager->get('MagentoSalesModelResourceModelOrderPaymentTransactionCollectionFactory'); $transactions = $transactionFactory->create()->addOrderIdFilter($_order->getId()); print_r($transactions->getItems()); but this is not working

    – Amatya Trivedi
    yesterday












  • payment transaction id or order id?

    – Muhammad Anas
    yesterday











  • I want payment transaction id

    – Amatya Trivedi
    yesterday











  • You shouldn't use objectManager directly in your code

    – Shawn Abramson
    21 hours ago

















  • do you have any code that you have tried?

    – magefms
    yesterday











  • I have tried this $transactionFactory = $objectManager->get('MagentoSalesModelResourceModelOrderPaymentTransactionCollectionFactory'); $transactions = $transactionFactory->create()->addOrderIdFilter($_order->getId()); print_r($transactions->getItems()); but this is not working

    – Amatya Trivedi
    yesterday












  • payment transaction id or order id?

    – Muhammad Anas
    yesterday











  • I want payment transaction id

    – Amatya Trivedi
    yesterday











  • You shouldn't use objectManager directly in your code

    – Shawn Abramson
    21 hours ago
















do you have any code that you have tried?

– magefms
yesterday





do you have any code that you have tried?

– magefms
yesterday













I have tried this $transactionFactory = $objectManager->get('MagentoSalesModelResourceModelOrderPaymentTransactionCollectionFactory'); $transactions = $transactionFactory->create()->addOrderIdFilter($_order->getId()); print_r($transactions->getItems()); but this is not working

– Amatya Trivedi
yesterday






I have tried this $transactionFactory = $objectManager->get('MagentoSalesModelResourceModelOrderPaymentTransactionCollectionFactory'); $transactions = $transactionFactory->create()->addOrderIdFilter($_order->getId()); print_r($transactions->getItems()); but this is not working

– Amatya Trivedi
yesterday














payment transaction id or order id?

– Muhammad Anas
yesterday





payment transaction id or order id?

– Muhammad Anas
yesterday













I want payment transaction id

– Amatya Trivedi
yesterday





I want payment transaction id

– Amatya Trivedi
yesterday













You shouldn't use objectManager directly in your code

– Shawn Abramson
21 hours ago





You shouldn't use objectManager directly in your code

– Shawn Abramson
21 hours ago










2 Answers
2






active

oldest

votes


















0














Edit:



Try to inject MagentoSalesApiDataTransactionSearchResultInterfaceFactory into your constructor:



protected $transactions;

public function __constructor(
MagentoSalesApiDataTransactionSearchResultInterfaceFactory $transactions,
......
)

$this->transactions = $transactions;



In your method:



$transactions = $this->transactions->create()->addOrderIdFilter($orderId);
$transactions->getItems();


If MagentoSalesApiDataTransactionSearchResultInterfaceFactory doesn't work, try to use MagentoSalesModelResourceModelOrderPaymentTransactionCollectionFactory. I'm not test yet both of them.






share|improve this answer

























  • This is not working.

    – Amatya Trivedi
    yesterday


















0














This will work.



class MyClass

/**
* @var MagentoSalesApiTransactionRepositoryInterface
*/
private $repository;

/**
* @var MagentoFrameworkApiSearchCriteriaBuilder
*/
private $searchCriteriaBuilder;

/**
* MyClass constructor.
*
* @param MagentoSalesApiTransactionRepositoryInterface $repository
* @param MagentoFrameworkApiSearchCriteriaBuilder $searchCriteriaBuilder
*/
public function __construct(
MagentoSalesApiTransactionRepositoryInterface $repository,
MagentoFrameworkApiSearchCriteriaBuilder $searchCriteriaBuilder
)
$this->repository = $repository;
$this->searchCriteriaBuilder = $searchCriteriaBuilder;


/**
* @param int $id
*
* @return MagentoSalesApiDataTransactionInterface[]
*/
public function getTransactionByOrderId($id)

$this->searchCriteriaBuilder->addFilter('order_id', $id);
$list = $this->repository->getList(
$this->searchCriteriaBuilder->create()
);

return $list->getItems();







share|improve this answer






















    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f267408%2fhow-to-get-transaction-id-of-an-order-in-magento-2%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Edit:



    Try to inject MagentoSalesApiDataTransactionSearchResultInterfaceFactory into your constructor:



    protected $transactions;

    public function __constructor(
    MagentoSalesApiDataTransactionSearchResultInterfaceFactory $transactions,
    ......
    )

    $this->transactions = $transactions;



    In your method:



    $transactions = $this->transactions->create()->addOrderIdFilter($orderId);
    $transactions->getItems();


    If MagentoSalesApiDataTransactionSearchResultInterfaceFactory doesn't work, try to use MagentoSalesModelResourceModelOrderPaymentTransactionCollectionFactory. I'm not test yet both of them.






    share|improve this answer

























    • This is not working.

      – Amatya Trivedi
      yesterday















    0














    Edit:



    Try to inject MagentoSalesApiDataTransactionSearchResultInterfaceFactory into your constructor:



    protected $transactions;

    public function __constructor(
    MagentoSalesApiDataTransactionSearchResultInterfaceFactory $transactions,
    ......
    )

    $this->transactions = $transactions;



    In your method:



    $transactions = $this->transactions->create()->addOrderIdFilter($orderId);
    $transactions->getItems();


    If MagentoSalesApiDataTransactionSearchResultInterfaceFactory doesn't work, try to use MagentoSalesModelResourceModelOrderPaymentTransactionCollectionFactory. I'm not test yet both of them.






    share|improve this answer

























    • This is not working.

      – Amatya Trivedi
      yesterday













    0












    0








    0







    Edit:



    Try to inject MagentoSalesApiDataTransactionSearchResultInterfaceFactory into your constructor:



    protected $transactions;

    public function __constructor(
    MagentoSalesApiDataTransactionSearchResultInterfaceFactory $transactions,
    ......
    )

    $this->transactions = $transactions;



    In your method:



    $transactions = $this->transactions->create()->addOrderIdFilter($orderId);
    $transactions->getItems();


    If MagentoSalesApiDataTransactionSearchResultInterfaceFactory doesn't work, try to use MagentoSalesModelResourceModelOrderPaymentTransactionCollectionFactory. I'm not test yet both of them.






    share|improve this answer















    Edit:



    Try to inject MagentoSalesApiDataTransactionSearchResultInterfaceFactory into your constructor:



    protected $transactions;

    public function __constructor(
    MagentoSalesApiDataTransactionSearchResultInterfaceFactory $transactions,
    ......
    )

    $this->transactions = $transactions;



    In your method:



    $transactions = $this->transactions->create()->addOrderIdFilter($orderId);
    $transactions->getItems();


    If MagentoSalesApiDataTransactionSearchResultInterfaceFactory doesn't work, try to use MagentoSalesModelResourceModelOrderPaymentTransactionCollectionFactory. I'm not test yet both of them.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited yesterday

























    answered yesterday









    Ronak RathodRonak Rathod

    697112




    697112












    • This is not working.

      – Amatya Trivedi
      yesterday

















    • This is not working.

      – Amatya Trivedi
      yesterday
















    This is not working.

    – Amatya Trivedi
    yesterday





    This is not working.

    – Amatya Trivedi
    yesterday













    0














    This will work.



    class MyClass

    /**
    * @var MagentoSalesApiTransactionRepositoryInterface
    */
    private $repository;

    /**
    * @var MagentoFrameworkApiSearchCriteriaBuilder
    */
    private $searchCriteriaBuilder;

    /**
    * MyClass constructor.
    *
    * @param MagentoSalesApiTransactionRepositoryInterface $repository
    * @param MagentoFrameworkApiSearchCriteriaBuilder $searchCriteriaBuilder
    */
    public function __construct(
    MagentoSalesApiTransactionRepositoryInterface $repository,
    MagentoFrameworkApiSearchCriteriaBuilder $searchCriteriaBuilder
    )
    $this->repository = $repository;
    $this->searchCriteriaBuilder = $searchCriteriaBuilder;


    /**
    * @param int $id
    *
    * @return MagentoSalesApiDataTransactionInterface[]
    */
    public function getTransactionByOrderId($id)

    $this->searchCriteriaBuilder->addFilter('order_id', $id);
    $list = $this->repository->getList(
    $this->searchCriteriaBuilder->create()
    );

    return $list->getItems();







    share|improve this answer



























      0














      This will work.



      class MyClass

      /**
      * @var MagentoSalesApiTransactionRepositoryInterface
      */
      private $repository;

      /**
      * @var MagentoFrameworkApiSearchCriteriaBuilder
      */
      private $searchCriteriaBuilder;

      /**
      * MyClass constructor.
      *
      * @param MagentoSalesApiTransactionRepositoryInterface $repository
      * @param MagentoFrameworkApiSearchCriteriaBuilder $searchCriteriaBuilder
      */
      public function __construct(
      MagentoSalesApiTransactionRepositoryInterface $repository,
      MagentoFrameworkApiSearchCriteriaBuilder $searchCriteriaBuilder
      )
      $this->repository = $repository;
      $this->searchCriteriaBuilder = $searchCriteriaBuilder;


      /**
      * @param int $id
      *
      * @return MagentoSalesApiDataTransactionInterface[]
      */
      public function getTransactionByOrderId($id)

      $this->searchCriteriaBuilder->addFilter('order_id', $id);
      $list = $this->repository->getList(
      $this->searchCriteriaBuilder->create()
      );

      return $list->getItems();







      share|improve this answer

























        0












        0








        0







        This will work.



        class MyClass

        /**
        * @var MagentoSalesApiTransactionRepositoryInterface
        */
        private $repository;

        /**
        * @var MagentoFrameworkApiSearchCriteriaBuilder
        */
        private $searchCriteriaBuilder;

        /**
        * MyClass constructor.
        *
        * @param MagentoSalesApiTransactionRepositoryInterface $repository
        * @param MagentoFrameworkApiSearchCriteriaBuilder $searchCriteriaBuilder
        */
        public function __construct(
        MagentoSalesApiTransactionRepositoryInterface $repository,
        MagentoFrameworkApiSearchCriteriaBuilder $searchCriteriaBuilder
        )
        $this->repository = $repository;
        $this->searchCriteriaBuilder = $searchCriteriaBuilder;


        /**
        * @param int $id
        *
        * @return MagentoSalesApiDataTransactionInterface[]
        */
        public function getTransactionByOrderId($id)

        $this->searchCriteriaBuilder->addFilter('order_id', $id);
        $list = $this->repository->getList(
        $this->searchCriteriaBuilder->create()
        );

        return $list->getItems();







        share|improve this answer













        This will work.



        class MyClass

        /**
        * @var MagentoSalesApiTransactionRepositoryInterface
        */
        private $repository;

        /**
        * @var MagentoFrameworkApiSearchCriteriaBuilder
        */
        private $searchCriteriaBuilder;

        /**
        * MyClass constructor.
        *
        * @param MagentoSalesApiTransactionRepositoryInterface $repository
        * @param MagentoFrameworkApiSearchCriteriaBuilder $searchCriteriaBuilder
        */
        public function __construct(
        MagentoSalesApiTransactionRepositoryInterface $repository,
        MagentoFrameworkApiSearchCriteriaBuilder $searchCriteriaBuilder
        )
        $this->repository = $repository;
        $this->searchCriteriaBuilder = $searchCriteriaBuilder;


        /**
        * @param int $id
        *
        * @return MagentoSalesApiDataTransactionInterface[]
        */
        public function getTransactionByOrderId($id)

        $this->searchCriteriaBuilder->addFilter('order_id', $id);
        $list = $this->repository->getList(
        $this->searchCriteriaBuilder->create()
        );

        return $list->getItems();








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 21 hours ago









        Shawn AbramsonShawn Abramson

        2,4871915




        2,4871915



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f267408%2fhow-to-get-transaction-id-of-an-order-in-magento-2%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Sum ergo cogito? 1 nng

            三茅街道4182Guuntc Dn precexpngmageondP