How to get transaction id of an order in magento 2? The Next CEO of Stack OverflowMagento 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 magento2Magento 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
My boss doesn't want me to have a side project
How to pronounce fünf in 45
Calculate the Mean mean of two numbers
How to unfasten electrical subpanel attached with ramset
Would a grinding machine be a simple and workable propulsion system for an interplanetary spacecraft?
Gauss' Posthumous Publications?
Compilation of a 2d array and a 1d array
Is it reasonable to ask other researchers to send me their previous grant applications?
Create custom note boxes
My ex-girlfriend uses my Apple ID to login to her iPad, do I have to give her my Apple ID password to reset it?
Why did early computer designers eschew integers?
Calculating discount not working
Free fall ellipse or parabola?
Is a distribution that is normal, but highly skewed, considered Gaussian?
Car headlights in a world without electricity
What did the word "leisure" mean in late 18th Century usage?
Avoiding the "not like other girls" trope?
What steps are necessary to read a Modern SSD in Medieval Europe?
Are British MPs missing the point, with these 'Indicative Votes'?
How exploitable/balanced is this homebrew spell: Spell Permanency?
Is this a new Fibonacci Identity?
Read/write a pipe-delimited file line by line with some simple text manipulation
How can I replace x-axis labels with pre-determined symbols?
How badly should I try to prevent a user from XSSing themselves?
How to get transaction id of an order in magento 2?
The Next CEO of Stack OverflowMagento 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 magento2Magento 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
How to get transaction id of order in Magento 2?
magento2 magento2.2.4
add a comment |
How to get transaction id of order in Magento 2?
magento2 magento2.2.4
do you have any code that you have tried?
– magefms
Mar 26 at 10:09
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
Mar 26 at 10:10
payment transaction id or order id?
– Muhammad Anas
Mar 26 at 11:04
I want payment transaction id
– Amatya Trivedi
Mar 26 at 11:06
You shouldn't use objectManager directly in your code
– Shawn Abramson
Mar 27 at 4:31
add a comment |
How to get transaction id of order in Magento 2?
magento2 magento2.2.4
How to get transaction id of order in Magento 2?
magento2 magento2.2.4
magento2 magento2.2.4
edited Mar 26 at 10:09
Amatya Trivedi
asked Mar 26 at 10:02
Amatya TrivediAmatya Trivedi
389
389
do you have any code that you have tried?
– magefms
Mar 26 at 10:09
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
Mar 26 at 10:10
payment transaction id or order id?
– Muhammad Anas
Mar 26 at 11:04
I want payment transaction id
– Amatya Trivedi
Mar 26 at 11:06
You shouldn't use objectManager directly in your code
– Shawn Abramson
Mar 27 at 4:31
add a comment |
do you have any code that you have tried?
– magefms
Mar 26 at 10:09
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
Mar 26 at 10:10
payment transaction id or order id?
– Muhammad Anas
Mar 26 at 11:04
I want payment transaction id
– Amatya Trivedi
Mar 26 at 11:06
You shouldn't use objectManager directly in your code
– Shawn Abramson
Mar 27 at 4:31
do you have any code that you have tried?
– magefms
Mar 26 at 10:09
do you have any code that you have tried?
– magefms
Mar 26 at 10:09
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
Mar 26 at 10:10
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
Mar 26 at 10:10
payment transaction id or order id?
– Muhammad Anas
Mar 26 at 11:04
payment transaction id or order id?
– Muhammad Anas
Mar 26 at 11:04
I want payment transaction id
– Amatya Trivedi
Mar 26 at 11:06
I want payment transaction id
– Amatya Trivedi
Mar 26 at 11:06
You shouldn't use objectManager directly in your code
– Shawn Abramson
Mar 27 at 4:31
You shouldn't use objectManager directly in your code
– Shawn Abramson
Mar 27 at 4:31
add a comment |
3 Answers
3
active
oldest
votes
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.
This is not working.
– Amatya Trivedi
Mar 26 at 11:02
add a comment |
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();
add a comment |
You can use MagentoSalesApiDataTransactionSearchResultInterface for transaction Id.
$transaction = $objectManager->create('MagentoSalesApiDataTransactionSearchResultInterfaceFactory')->create()->addOrderIdFilter($block->getOrderId())->getFirstItem();
$transactionId = $transaction->getData('txn_id');
The $transactionId is your required transaction Id.
New contributor
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
This is not working.
– Amatya Trivedi
Mar 26 at 11:02
add a comment |
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.
This is not working.
– Amatya Trivedi
Mar 26 at 11:02
add a comment |
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.
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.
edited Mar 26 at 13:13
answered Mar 26 at 10:14
Ronak RathodRonak Rathod
869112
869112
This is not working.
– Amatya Trivedi
Mar 26 at 11:02
add a comment |
This is not working.
– Amatya Trivedi
Mar 26 at 11:02
This is not working.
– Amatya Trivedi
Mar 26 at 11:02
This is not working.
– Amatya Trivedi
Mar 26 at 11:02
add a comment |
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();
add a comment |
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();
add a comment |
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();
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();
answered Mar 27 at 4:36
Shawn AbramsonShawn Abramson
2,4871915
2,4871915
add a comment |
add a comment |
You can use MagentoSalesApiDataTransactionSearchResultInterface for transaction Id.
$transaction = $objectManager->create('MagentoSalesApiDataTransactionSearchResultInterfaceFactory')->create()->addOrderIdFilter($block->getOrderId())->getFirstItem();
$transactionId = $transaction->getData('txn_id');
The $transactionId is your required transaction Id.
New contributor
add a comment |
You can use MagentoSalesApiDataTransactionSearchResultInterface for transaction Id.
$transaction = $objectManager->create('MagentoSalesApiDataTransactionSearchResultInterfaceFactory')->create()->addOrderIdFilter($block->getOrderId())->getFirstItem();
$transactionId = $transaction->getData('txn_id');
The $transactionId is your required transaction Id.
New contributor
add a comment |
You can use MagentoSalesApiDataTransactionSearchResultInterface for transaction Id.
$transaction = $objectManager->create('MagentoSalesApiDataTransactionSearchResultInterfaceFactory')->create()->addOrderIdFilter($block->getOrderId())->getFirstItem();
$transactionId = $transaction->getData('txn_id');
The $transactionId is your required transaction Id.
New contributor
You can use MagentoSalesApiDataTransactionSearchResultInterface for transaction Id.
$transaction = $objectManager->create('MagentoSalesApiDataTransactionSearchResultInterfaceFactory')->create()->addOrderIdFilter($block->getOrderId())->getFirstItem();
$transactionId = $transaction->getData('txn_id');
The $transactionId is your required transaction Id.
New contributor
New contributor
answered 13 hours ago
JazzJazz
262
262
New contributor
New contributor
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
do you have any code that you have tried?
– magefms
Mar 26 at 10:09
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
Mar 26 at 10:10
payment transaction id or order id?
– Muhammad Anas
Mar 26 at 11:04
I want payment transaction id
– Amatya Trivedi
Mar 26 at 11:06
You shouldn't use objectManager directly in your code
– Shawn Abramson
Mar 27 at 4:31