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,
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); ?>
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!
E-commerce has transformed the way consumers shop for products and services and interact with businesses.…
The e-commerce world is constantly in flux. New tech and strategies emerge daily to help…
Hello Magento Friends, In today’s blog, we will discuss adding a header and footer to…
Hello React Native Friends, Building a visually appealing and responsive mobile app is crucial in…
We're thrilled to announce the release of Hyvä Themes 1.3.6 and 1.3.7! These latest updates…
Your e-commerce platform is surging - orders are rolling in, traffic spikes are becoming the…