How To

How to Get Invoice Information Using SOAP API in Magento 2

Hello Magento Friends,

In our Magento 2 SOAP API Tutorial series, today I am going to illustrate How to Get Invoice Information Using SOAP API in Magento 2.

When you need Invoice information outside of the Magento platform, you can get it using SOAP API. Sometimes you are in a need to create a mobile app for your website then also there is a requirement of order information outside of your Magento store.

 Hence, you need to call SOAP API. Let’s learn further,

Steps to Get Invoice Information Using SOAP API in Magento 2:

Step 1: Create call_soap.php file anywhere and add the following code

<?php

$request = new SoapClient("http://yourdomain/index.php/soap/?wsdl&services=integrationAdminTokenServiceV1", array("soap_version" => SOAP_1_2));
$token = $request->integrationAdminTokenServiceV1CreateAdminAccessToken(array("username"=>"admin2", "password"=>"admin123"));

$request = new SoapClient(
    'http://yourdomain/index.php/soap/default?wsdl&services=salesInvoiceRepositoryV1',
    array(
        'soap_version' => SOAP_1_2,
        'stream_context' => stream_context_create(array(
            'http'=> array('header' => 'Authorization: Bearer '.$token->result)
        ))
    )
);
$response = $request->SalesInvoiceRepositoryV1Get(array('id' => 2));

var_dump($response);

?>

Conclusion:

In this manner, you can Get Invoice Information using SOAP API in Magento 2.

Also, take a look – Get various other Information Using SOAP API in Magento 2.

If you have any doubts, get in touch with me through the comment section. Share the tutorial with your friends and check back soon for more instructive guides on SOAP API.

Happy Coding!

Click to rate this post!
[Total: 3 Average: 5]
Dhiren Vasoya

Dhiren Vasoya is a Director and Co-founder at MageComp, Passionate ?️ Certified Magento Developer?‍?. He has more than 9 years of experience in Magento Development and completed 850+ projects to solve the most important E-commerce challenges. He is fond❤️ of coding and if he is not busy developing then you can find him at the cricket ground, hitting boundaries.?

Recent Posts

Improving Error Handling and Transition Management in Remix with useRouteError and useViewTransitionState

In modern web development, seamless navigation and state management are crucial for delivering a smooth…

6 days ago

Magento Open Source 2.4.8-Beta Release Notes

Magento Open Source 2.4.8 beta version released on October  8, 2024. The latest release of…

1 week ago

How to Create Catalog Price Rule in Magento 2 Programmatically?

Hello Magento Friends, Creating catalog price rules programmatically in Magento 2 can be a valuable…

1 week ago

Top 10 Tips to Hire Shopify Developers

As the world of eCommerce continues to thrive, Shopify has become one of the most…

2 weeks ago

Managing Browser Events and Navigation in Shopify Remix: useBeforeUnload, useHref, and useLocation Hooks

Shopify Remix is an innovative framework that provides a streamlined experience for building fast, dynamic,…

2 weeks ago

Ultimate Guide to Hiring a Top Shopify Development Agency

Building a successful eCommerce store requires expertise, and for many businesses, Shopify has become the…

2 weeks ago