Edit Multiple Customer Address With Magento 2 REST API

In this post, I am going to explain to you how to edit or update customer multiple addresses by customer address id using rest api in magento 2.

You just have to use the address id in order to edit the customer address.

So in the first step, we have to get the customer address id, and then we can use that id to edit the address.

 

Step 1: Get Customer Address ID API

By using this rest api we will get the customer address details that will help us to edit the customer address.

If a customer has five shipping addresses then each address will have an id.

Whenever we need to change the customer address then we have to edit by its address id.

Endpoint:

<host>/rest/default/V1/customers/customersID

Example:

https://wishusucess.com/rest/default/V1/customers/111

Method: GET

Headers:

  • Authorization: Bearer <admin_token>
  • Content-Type: application/json

Payload:

Not required

Edit Multiple customer address api
Customer Information

Response:

{
"id": 111,
"group_id": 4,
"default_billing": "281",
"default_shipping": "281",
"created_at": "2021-12-24 12:03:06",
"updated_at": "2022-02-24 08:57:48",
"created_in": "Default Store View",
"email": "cs.hemantsingh@gmail.com",
"firstname": "Hemant",
"lastname": "Singh",
"middlename": "Singh",
"gender": 0,
"store_id": 1,
"website_id": 1,
"addresses": [
{
"id": 217,
"customer_id": 111,
"region": {
"region_code": "NY",
"region": "New York",
"region_id": 43
},
"region_id": 43,
"country_id": "US",
"street": [
"Add",
"Add2"
],
"telephone": "1234567890",
"postcode": "98761",
"city": "New York",
"firstname": "Hemant",
"lastname": "Singh"
},
{
"id": 226,
"customer_id": 111,
"region": {
"region_code": null,
"region": null,
"region_id": 0
},
"region_id": 0,
"country_id": "IN",
"street": [
"201301, Noida"
],
"telephone": "01710676441",
"postcode": "203301",
"city": "Noida",
"firstname": "Hemant",
"lastname": "Singh"
},
{
"id": 230,
"customer_id": 111,
"region": {
"region_code": null,
"region": null,
"region_id": 0
},
"region_id": 0,
"country_id": "IN",
"street": [
"201302, Noida"
],
"telephone": "777777777",
"postcode": "203302",
"city": "Noida",
"firstname": "Hemant",
"lastname": "Singh"
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"is_subscribed": false
},
"custom_attributes": [
{
"attribute_code": "customer_account_status",
"value": "1"
},
{
"attribute_code": "payment_status",
"value": "1"
}
]
}

 

Step 2: Edit Customer Shipping Address By Address ID

Now by sending the payload with customer address details we can edit/update customers' multiple addresses.

I am telling you about the Rest API on you, using which you can now change the address information of the customer.

One of the drawbacks of Magento's default customer edit API is that if you edit an address, all the rest of the addresses at once are removed and converted into a single address.

So you will need to do some customization which I have given in the link below.

Endpoint:

https://wishusucess.com/rest/V1/customers/111

Method: PUT

Headers:

  • Authorization: Bearer <admin_token>
  • Content-Type: application/json

Payload:

{
"customer": {
"firstname": "Hemant",
"lastname": "Singh",
"store_id": 1,
"website_id": 1,
"addresses": [{
"id": 217,
"customerId": 111,
"region": {
"region_code": "UP",
"region": "UttarPradesh"
},
"region_id": 566,
"countryId": "IN",
"street": [
"Saradarpur Colony"
],
"telephone": "8197565002",
"postcode": "201301",
"city": "Noida",
"defaultShipping": false,
"defaultBilling": true
}]
}
}

Edit Customer Multiple Address API

Response:

{
"id": 111,
"group_id": 4,
"default_billing": "217",
"created_at": "2021-12-24 12:03:06",
"updated_at": "2022-02-26 20:01:34",
"created_in": "Default Store View",
"email": "cs.hemantsingh@gmail.com",
"firstname": "Hemant8",
"lastname": "Singh",
"middlename": "Singh",
"gender": 0,
"store_id": 1,
"website_id": 1,
"addresses": [
{
"id": 217,
"customer_id": 111,
"region": {
"region_code": "UP",
"region": "Uttar Pradesh",
"region_id": 566
},
"region_id": 566,
"country_id": "IN",
"street": [
"Sardarpur Colony"
],
"telephone": "8197565002",
"postcode": "201301",
"city": "Noida",
"firstname": "Hemant",
"lastname": "Singh",
"default_billing": true
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"is_subscribed": false
},
"custom_attributes": [
{
"attribute_code": "customer_account_status",
"value": "1"
},
{
"attribute_code": "payment_status",
"value": "1"
}
]
}

 

Update Address API by Address ID

Using this REST API in Magento 2, you can edit multiple addresses at once.

If there are 5 addresses added to a customer account, then all five customers' addresses can update the shipping address simultaneously with respect to the address ID.

This API can be used to change the shipping address information address of any customer.

Edit Customer Address Api

First, you have to download the customer edit address by address id rest api from Wishusucess GitHub repository then install it into your store, and then follow the below endpoint.

Endpoint:

https://wishusucess.com/rest/V1/addresses

Method: POST

Headers:

  • Authorization: Bearer <admin_token>
  • Content-Type: application/json

Payload:

{
"address": {
"id": "7",
"customer_id": "3",
"firstname": "Hemant",
"lastname": "Singh",
"street": [
"Street 1"
],
"telephone": "01234 56789",
"postcode": "201301",
"city": "Noida",
"defaultBilling": true,
"country_id": "IN"
}
}

Save Customer Address REST API
Update Customer Address

Response:

{
"id": 302,
"customer_id": 111,
"region": {
"region_code": "UP",
"region": "Uttar Pradesh",
"region_id": 566
},
"region_id": 566,
"country_id": "IN",
"street": [
"Street 1"
],
"telephone": "01234 56789",
"postcode": "201301",
"city": "Noida",
"firstname": "Hemant",
"lastname": "Singh"
}

 

Conclusion:

We can edit or update customer address information by using the above rest api in Magento 2.

Firstly we have to get the address id then we can use that id to edit/update customer addresses by address id.

 

Read more: Magento 2.4 Installation Guide: How to Install Magento 2.4.2

Magento 2 Customer REST API: All Customer API Details

Here I am explaining to you the most commonly used Magento 2 customer rest API lists in detail.

If you want to know in detail then links are given on which you can click on that particular API to know in detail.

This Customer API list describes how to create a customer account, log in and update the customer account data.

If you want to activate a customer account then how will you will activate and if the password has to be changed then how you will be changing the password.

 

Most Used Magento 2 Customer REST API List

By using the below list of customer rest API in Magento 2 you can get the all details, save the details and update the information.

Magento 2 Customer API List

1. Create Customer REST API

This rest api helps you to create a new customer by using this customer creation rest api in magento2.

Endpoint:

POST <host>/rest/<store_code>/V1/customers

Example:

https://wishusucess.com/rest/V1/customers

Method: POST

Headers:

  • Content-Type: application/json

Body:

{
"customer": {
"email": "cs.hemantsingh@gmail.com",
"firstname": "Hemant",
"lastname": "Singh"
},
"password": "A$#in@#13"
}

 

2. Login Customer REST API

Create customer access token rest api that helps customers to login into Magento 2 store.

Endpoint:

POST <host>/rest/<store_code>/V1/integration/customer/token

Example:

https://wishusucess.com/rest/V1/integration/customer/token

Method: POST

Headers:

  • Content-Type: application/json

Payload:

{
"username": "cs.hemantsingh@gmail.com",
"password": "A$#in@#13"
}

 

3. Get Customer Information REST API

This is the Magento 2 customer rest api that is used to get the customer information by id.

GET <host>/<rest>/<store_code>/V1/customers/:customerId

Example:

https://wishusucess.com/rest/default/V1/customers/111

Method: GET

Headers:

  • Content-Type: application/json

Payload:

Not required

 

4. Update Customer Name REST API

Customer information can be updated by the customer id in Magento 2 rest api by using the following endpoint.

Endpoint:

PUT <host>/<rest>/V1/customers/:customerId

Example:

https://wishusucess.com/rest/V1/customers/111

Method: PUT

Headers:

  • Content-Type: application/json

Payload:

{ "customer": { "firstname": "Hemant", "lastname": "Singh"}}

 

5. Update Customer Custom Attribute Value By API

The custom attribute of customer value can be updated by the following endpoint by customer id.

Endpoint:

PUT <host>/<rest>/V1/customers/:customerId

Example:

https://wishusucess.com/rest/V1/customers/111

Method: PUT

Headers:

  • Content-Type: application/json

Payload:

{ "customer": {
"custom_attributes": [
{
"attribute_code": "customer_account_status",
"value": "1"
},
{
"attribute_code": "payment_status",
"value": "1"
}
]
}
}

 

6. Get Customer Information REST API

If all the details of the customer are to be received, then the Customer Me rest API is used in Magento 2 for that.

As mentioned below, in this you have to send by adding the customer token in the header as authorization.

Endpoint:

GET <host>/<rest>/V1/customers/me

Example:

https://wishusucess.com/rest/default/V1/customers/me

Method: GET

Headers:

  • Authorization: Bearer <customer_token>

Payload:

Not required

 

7. Save Customer Information REST API

To save the information of the Magento 2 customer, we use the Customer Rest API, for this we send the parameter to be saved in the payload.

Customer ID, Customer Group ID, Website ID, and Customer Store ID have to be sent compulsorily while sending the information in the payload.

And the information that has to be saved is to be sent along with the details.

Endpoint:

PUT <host>/<rest>/V1/customers/me

Example:

https://wishusucess.com/rest/default/V1/customers/me

Method: PUT

Headers:

  • Authorization: Bearer <customer_token>

Payload:

{
"customer": {
"email": "cs.hemantsingh@gmail.com",
"firstname":"Hemant",
"lastname":"Singh",
"website_id": 1,
"addresses": [
{
"region": {
"region_code": "UP",
"region": "Uttar Pradesh",
"region_id": 566
},
"country_id": "IN",
"street": [
"Noida",
"Noida gauttam Budh Nagar"
],
"firstname": "Hemant",
"lastname": "Singh"
"default_shipping": true,
"default_billing": true,
"telephone": "8197565002",
"postcode": "201301",
"city": "Noida",
},
{
"region": {
"region_code": "UP",
"region": "uttar Pradesh",
"region_id": 566
},
"country_id": "IN",
"street": [
"Noida",
"Noida"
],
"firstname": "Hemant",
"lastname": "Singh",
"defaultShipping": false,
"defaultBilling": false,
"telephone": "8197565002",
"postcode": "201301",
"city": "Noida",
}
]
}
}

 

8. Activate Customer Account REST API

If we want to activate Magento 2 customer account through rest api, then for that we use the rest api given below.

In payload, we have to send customer id details and in authorization, we have to send customer access tokens by entering.

Endpoint:

PUT <host>/<rest>/V1/customers/me/activate

Example:

https://wishusucess.com/rest/default/V1/customers/me/activate

Method: PUT

Headers:

  • Authorization: Bearer <customer_token>

Payload:

{"confirmationKey":customer_id}

Example: {"confirmationKey":111}

 

9. Activate Customer Email REST API

You can activate customer email by hitting the customer email active rest API in Magento 2.

Endpoint:

PUT <host>/<rest>/V1/customers/:email/activate

Example:

https://wishusucess.com/rest/default/V1/customers/:email/activate

Method: PUT

Headers:

  • Authorization: Bearer <admin_token>
  • Content-Type: application/json

Payload:

{"confirmationKey":customer_id}

Param:

email: cs.hemantsingh@gmail.com

 

10. Change Password Magento 2 API

To change the current password of the customer's account, we use the REST API which is given below.

We can change the password of any customer account using this Change Password API in Magento 2.

Endpoint:

PUT <host>/<rest>/V1/customers/me/password

Example:

https://wishusucess.com/rest/default/V1/customers/me/password

Method: PUT

Headers:

  • Authorization: Bearer <admin_token>
  • Content-Type: application/json

Payload:

{"customer_id": 111, "currentPassword": "HK@#123", "newPassword": "HK@#$123"}

 

Recommended Posts:

Update Customer Attributes Value via Magento 2 REST API

Add/Update Many Customer Address REST API in Magento 2

Update Customer Attributes Value via Magento 2 REST API

I am explaining to you to update customer attributes value based on the customer id through rest API in Magento 2.

When a customer orders a product in the Magento store, then payment status get changes, and if the customer has come after registering, then his account status also changes.

So to change the value of the attributes of the customer through Magento 2 REST API it is necessary to hit its correct endpoint.

The customer needs to send their payload details to update the custom attribute value.

The status is updated only by the correct value in the body which is given below.

The same API is also used to add or change the data of the attribute of the customer based on the customer id.

Admin > Customer > Customer Account > Account Information

Update Customer Attributes Value
Customer Attributes Change Status

 

 

Change Customer Account Status in Magento 2

If you want to change any value of a customer's account information like want to change the name, want to change the last name, change email id, change the date of birth, change gender or change address, change order status.

To change all these data through Magento 2 default rest api you can get detailed information by add/update customer data by rest api.

 

Update Customer Attributes Value REST API

The customer attribute whose value is to be changed can be changed by the endpoint given below.

First of all, by entering that attribute in the body, you have to hit it. Then you will get the changed value in the response.

store_url://domin_name/rest/V1/customers/customerID

Endpoint:

https://wishusucess.com/rest/V1/customers/111

Method: PUT

Header:

  • Authorization: Bearer admin_token
  • Content-Type: Application/Json

Body:

{ "customer": {
"custom_attributes": [
{
"attribute_code": "customer_account_status",
"value": "1"
},
{
"attribute_code": "payment_status",
"value": "1"
}
]
}
}

Update Attributes API
Update Attributes on Postman

 

Response:

{
"id": 111,
"group_id": 4,
"default_billing": "281",
"default_shipping": "281",
"created_at": "2021-12-24 12:03:06",
"updated_at": "2022-02-22 13:19:30",
"created_in": "Default Store View",
"email": "cs.hemantsingh@gmail.com",
"firstname": "Hemant",
"lastname": "Singh",
"middlename": "Singh",
"gender": 0,
"store_id": 1,
"website_id": 1,
"addresses": [
{
"id": 217,
"customer_id": 111,
"region": {
"region_code": "UP",
"region": "Uttar Pradesh",
"region_id": 566
},
"region_id": 56,
"country_id": "IN",
"street": [
"Noida",
"Noida"
],
"telephone": "1234567890",
"postcode": "201301",
"city": "Noida",
"firstname": "Hemant",
"lastname": "Singh"
},
{
"id": 281,
"customer_id": 111,
"region": {
"region_code": "UP",
"region": "Uttar Pradesh",
"region_id": 566
},
"region_id": 566,
"country_id": "IN",
"street": [
"PMO Apartment"
],
"telephone": "08197565002",
"postcode": "201301",
"city": "Noida",
"firstname": "Hemant",
"lastname": "Singh",
"default_shipping": true,
"default_billing": true
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"is_subscribed": false
},
"custom_attributes": [
{
"attribute_code": "customer_account_status",
"value": "1"
},
{
"attribute_code": "payment_status",
"value": "1"
}
]
}

 

Read more: Magento 2.4 Installation Guide: How to Install Magento 2.4.2

 

Conclusion:

You can use this magento 2 rest api to update any kind of customer-related details or value of the custom attributes.

Through this, you can change the payment status, if you want, you can change the account status for the customer.

To update its name, email id, etc. details, by this you can update the value of any customer parameter.

 

Recommended Posts:

Add/Update Many Customer Address REST API in Magento 2

Add Multiple Customer Address via Magento 2 REST API

 

Add/Update Many Customer Address REST API in Magento 2

In this post, I am explaining to you to add/update many customer addresses via Magento 2 customer address rest api.

When we have to add multiple addresses at once through REST API, we cannot add the customer address through the default API of Magento 2.

For how to add a new customer address using api in Magento 2 we have to use the endpoint URL {store_url}/rest/V1/address and POST Action method.

 

Magento 2 REST API Add/Update Many Customer Address

Magento 2 Add a New Customer Address API help you to add as many addresses for a single customer without updating the old address.

I'm explaining to you by web API module to add a new customer address using Magento 2 REST API.

Endpoint:

https://wishusucess.com/rest/V1/addresses/

Method: POST

Header:

 

Step 1: Registration of Customer API

In the first step of adding/updating the customer address via Magento 2 rest API, we have to register the module via the registration.php file.

Wishusucess/AddAddress/registration.php
<?php
/*
* Developer: Magento 2x Developer Hemant Kumar Singh
* Category: Customer REST API
*/
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Wishusucess_AddAddress',
__DIR__
);

 

Step 2: Create Module File

In this step, we have to give the basic information of our edit information of customer using api.

Wishusucess/AddAddress/etc/module.xml
<?xml version="1.0"?>
<!--
/*
* Developer: Magento 2x Developer Hemant Kumar Singh
* Category: Customer REST API
*/ 
--> 
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Wishusucess_AddAddress" setup_version="1.0.0" schema_version="1.0.0">
</module>
</config>

 

Step 3: Routing of Add/Update Customer API

Now in this step, we have to define the route id via a web API XML file. This file has all the details of routing and the method that we have to select while hitting the endpoint.

Wishusucess/AddAddress/etc/webapi.xml
<?xml version="1.0"?>
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
<!-- Routing define -->
<route url="/V1/addresses" method="POST">
<service class="Magento\Customer\Api\AddressRepositoryInterface" method="save"/>
<resources>
<resource ref="Magento_Customer::manage"/>
</resources>
</route>
</routes>

 

Check-in body and response detail about Add Multiple Customer Address via Magento 2 REST API

 

Edit Customer Address REST API in Magento 2

Now in order to update the customer address, you have to create a rest API.

Add/Update Many Customer Address
Edit Customer Address

Below are the details of editing customer addresses using rest API for a magento 2 store.

You can get the body details

Endpoint:

https://wishusucess.com/rest/V1/addresses/

Method: POST

Header:

  • Authorization: Bearer Admin_Token
  • Content-Type: application/json

 

Step 1: Register Update Address API

Wishusucess/UpdateAddress/registration.php
<?php
/*
* Developer: Magento 2x Developer Hemant Kumar Singh
* Category: Customer REST API
*/
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Wishusucess_UpdateAddress',
__DIR__
);

 

Step 2: Create Module File for API

Wishusucess/UpdateAddress/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="Wishusucess_UpdateAddress" setup_version="1.0.0" schema_version="1.0.0">
</module>
</config>

 

Step 3: Create Web API XML File

Wishusucess/UpdateAddress/webapi.xml
<?xml version="1.0"?>
<routes
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
<route url="/V1/addresses" method="POST">
<service class="Magento\Customer\Api\AddressRepositoryInterface" method="save"/>
<resources>
<resource ref="Magento_Customer::manage"/>
</resources>
</route>
</routes>

 

Read more: What should be the body details to Update Customer address with REST API in Magento 2.

 

Conclusion:

To add or update the customer address of Magento 2 you need to create a custom web api as mentioned above.

Using this module you can add any number of addresses for the customer or you can use the rest api to edit it.

Add Multiple Customer Address via Magento 2 REST API

You have to implement a module to add multiple customer address for customers in Magento 2 store through rest api

This feature is not available in Magento 2 default REST API which can be used to add multiple customer addresses at once.

For this, I will explain to you to step by step method how you can save more than one customer address through API by implementing an extension.

 

Add Multiple Customer Address via REST API

As you can see on the screen below, this is the customer dashboard of the Magento 2.4 store.

Here the customer can save many addresses for himself, but the API for this is not available by default.

For this you will have to add some code, then by using it, you can save the data through API or

Add Multiple Customer Address

 

 

Step 1: Get Admin Token

First of all, you have to get an admin token then add that token as a header in Next API and send it along with.

Endpoint:

https://wishusucess.com/rest/V1/integration/admin/token

Method: POST

Body:

{
"username":"admin45",
"password":"Ainy@#13"
}

Response:

eiv9xouqxyxrasuz344k2azf2w6jtjsw

 

Step 2: Get Customer ID Using Customer Email

In the second step, we have to get the customer id detail by using email id via rest api.

In order to get the customer id via email id, you have to create a webapi route so you have to create a module also.

Endpoint:

https://wishusucess.com/rest/V1/getcustomerloginidusingemail

Method: POST

Header:

  • Content-Type: application/json
  • Authorization = Bearer admin_token

Body:

{"email":"cs.hemantsinghtech9@gmail.com"}

Response:

111

 

Step 3: Add Multiple Customer Address Using REST API

Now you can save the multiple customer addresses by using the below customer add address rest api in Magento 2.

So you have to send the address detail in the body along with the customer id.

You can get this below rest api extension via following the link of add/update many customer addresses via REST API in Magento 2.

Endpoint:

https://wishusucess.com/rest/V1/addresses

Method: POST

Header:

  • Authorization: Bearer <Admin Token>
  • Content-Type: Application/json

Body:

{
"address": { 
"customer_id": "111",
"defaultShipping": true,
"defaultBilling": true,
"region": "India",
"country_id": "IN",
"street": [ "201302, Noida" ],
"postcode": "203302",
"city": "Noida",
"firstname": "Hemant23",
"lastname": "Singh34", 
"telephone": "77777777777",
"countryId": "IN"
}
}

Save Customer Address via API
Save Customer Address via API

 

Response:

{
"id": 230,
"customer_id": 111,
"region": {
"region_code": null,
"region": null,
"region_id": 0
},
"region_id": 0,
"country_id": "IN",
"street": [
"201302, Noida"
],
"telephone": "77777777777",
"postcode": "203302",
"city": "Noida",
"firstname": "Hemant23",
"lastname": "Singh34"
}

 

Read more: Elasticsearch: How to Install Elasticsearch in Ubuntu 18.04

 

Conclusion:

As you can see in the details, we can do whatever address is to be saved through Rest API.

For that, we will need to write some custom code which we have told you in this post.

Using the above-mentioned details, you can save any number of addresses for the customer through Test API.

Magento 2 Payment API: Make Payment Using REST API

In this post, I will explain to you step-by-step methods to pay for any product through Magento 2 Payment API.

While making payment you can select the payment method like if you want to make cash on delivery (COD) payment then which API will be hit or if you want to make cash memo payment then which rest API will be used for that.

Through this post, we will also know that if you want to make a PayPal payment, then which API will be used for that.

I am explaining below the details of the steps to use all these payment APIs.

 

Create Order from Admin Dashboard via REST API

If you want to create an order through rest API from Magento 2 Admin Dashboard, then you will also have to complete payment for that.

When your payment is complete, the newly created order will appear in this dashboard.

Create Order From Admin via REST API

You can create an order directly from the sales admin dashboard using this rest api.

Admin > Sales > Order > Create New Order

 

Magento 2 Payment API for Guest Customer

You have to execute the below-mentioned four REST APIs step by step then only you will be able to complete the payment for the guest customers.

Guest customers can select and pay through the available payment options.

You can make payment based on whatever payment method available in your store like cash on delivery case money order paper payment etc.

Step 1

http://m243p1s.com/index.php/rest/V1/guest-carts/

Step 2

http://m243p1s.com/index.php/rest/V1/guest-carts/quote_id/items

Step 3

http://m243p1s.com/index.php/rest/V1/guest-carts/quote_id

Step 4

http://m243p1s.com/index.php/rest/V1/guest-carts/quote_id/shipping-information

If you want to know the above four steps in detail, then you can see our separate post for guest cart PayPal payment steps.

 

Step 5: Check Money Order Payment REST API

Payload:

http://m243p1s.com/index.php/rest/V1/guest-carts/quote_id/order

Method: PUT

Header:

  • Content-type = application/json

Body:

{ "paymentMethod": { "method": "checkmo" } }
Magento 2 Payment API
Now if you will go into the admin dashboard section then you can see the order has been created.
Created order Via API in dashboard

Cash On Delivery Payment REST API in Magento 2

Now if you want to make cash on delivery payment, then for that you have to follow the above-mentioned four states similarly.

If the guest wants to checkout, the steps will remain the same.

If you want to check out for Login Customer, then you can check the add to cart for login customer rest API to see other steps of Login Customer.

This is a final step that can be used to make payment by making payment through Cas on Delivery payment option via API in Magento 2.

Endpoint:

https://wishusucess.com/index.php/rest/V1/guest-carts/DUaFoHjVIQtfRk4W2xanZcVYTRhy4xav/shipping-information

Method: POST

Header:

  • Content-type = application/json

Now if you hit the above rest API Magento 2 gives you the response as a list of available payment methods, along with the total cart and details.

Magento 2 Payment API

 

Endpoint:

https://wishusucess.com/index.php/rest/V1/guest-carts/DUaFoHjVIQtfRk4W2xanZcVYTRhy4xav/order

Method: PUT

Body:

{ "paymentMethod": { "method": "cashondelivery" } }

Cash on delivery payment via REST API

 

 

Conclusion:

You can order the product for the guest customer and also complete the payment.

For this, you will need to hit at least four REST APIs, and based on the quote id, you can place the order of the product.

 

Read more: Magento 2.4 Installation Guide: How to Install Magento 2.4.2

 

Magento 2 Get Shipping Information Details Via REST API

I am going to explain to you in detail to get the Shipping Information Details available in the Magento 2 store through rest api.

Through this API you can easily get the shipping information details available on any Magento 2 website.

You can also get the idea about what would be the endpoint of that API, What methods will we use when we hit the API and what should be its body details and what payloads should be sent.

You will get all these details through the rest API post in detail.

 

Magento 2 Get Shipping Information Details API

By using the following endpoint you can get the shipping information details through this rest API in Magento 2 store.

Before reaching this step we need to add some items inside our cart then after that, we will process our order toward the checkout.

  1. Estimate shipping costs
  2. Set shipping and billing information
  3. Estimate shipping costs

There is a separate cost for each shipping method which is calculated at the time of checkout of the order.

When we move towards check out, adding this cost inside the subtotal gives us the final price.

Through this post, we will get those steps with detailed information.

 

Endpoint:

https://www.your_domain_name.com/V1/guest-carts/<cartId>/estimate-shipping-methods

Headers:

  • Content-Type: application/json
  • Authorization: Bearer <customer token>

Payload:

{
"address": {
"region": "Uttar Pradesh",
"region_id": 566,
"region_code": "UP",
"country_id": "IN",
"street": [
"Noida"
],
"postcode": "302022",
"city": "Noida",
"firstname": "Hemant",
"lastname": "Singh",
"customer_id": 111,
"email": "cs.hemantsingh@gmail.com",
"telephone": "(512) 555-1111",
"same_as_billing": 1
}
}

 

Response:

When we calculate the price at the checkout step of a product order, some other charges like shipping method charges flat-rate shipping, fixed price, etc. are also included.

But this charge is not applicable for downloadable products as the customer downloads the same.

Because this product does not need to be delivered, due to that shipping charges are not levied.

[
{
"carrier_code": "flatrate",
"method_code": "flatrate",
"carrier_title": "Flat Rate",
"method_title": "Fixed",
"amount": 15,
"base_amount": 15,
"available": true,
"error_message": "",
"price_excl_tax": 15,
"price_incl_tax": 15
},
{
"carrier_code": "tablerate",
"method_code": "bestway",
"carrier_title": "Best Way",
"method_title": "Table Rate",
"amount": 5,
"base_amount": 5,
"available": true,
"error_message": "",
"price_excl_tax": 5,
"price_incl_tax": 5
}
]

 

Steps to Save Shipping And Billing Information Via API

Now you can save both shipping address and billing address by using the following endpoint.

For this, you have to hit on the below endpoint and send a payload.

Inside that payload, you will mention both your shipping address and billing address and also send the customer token as authorization inside the header.

You have to also select carrier_code and method_code along with shipping and billing details in the payload.

Now the pricing will be calculated as a total and sent you the response of the order along with the payment method.

 

Read more: Magento 2.4 Installation Guide: How to Install Magento 2.4.2

 

Guest Carts Endpoint:

https://www.your_domin_name.com/V1/guest-carts/<cartId>/shipping-information

This guest cart endpoint will help you to set the billing and shipping information on behalf of a guest.

Login Customer Endpoint:

https://www.your_domin_name.com/<host>/rest/<store_code>/V1/carts/mine/shipping-information

Method: POST

Headers:

  • Content-Type: application/json
  • Authorization: Bearer <customer token>

Body Payload:

{
"addressInformation": {
"shipping_address": {
"region": "Uttar Pradesh",
"region_id": 566,
"region_code": "UP",
"country_id": "566",
"street": [
"Noida"
],
"postcode": "201301",
"city": "Noida",
"firstname": "Hemant",
"lastname": "Singh",
"email": "cs.hemantsingh@gmail.com",
"telephone": "7992293862"
},
"billing_address": {
"region": "Uttar Pradesh",
"region_id": 566,
"region_code": "UP",
"country_id": "IN",
"street": [
"Noida"
],
"postcode": "201301",
"city": "Noida",
"firstname": "Hemant",
"lastname": "Singh",
"email": "cs.hemantsingh@gmail.com",
"telephone": "7992293862"
},
"shipping_carrier_code": "tablerate",
"shipping_method_code": "bestway"
}
}

Response:

Now Magento store will send you the subtotal of the order, including shipping charges. Now the grand total will be subtotal+shipping charge.

The available payment method enabled inside the Magento 2 website will be shown to you as a response, you can make the payment using that payment method.

Shipping Information Detail

{
"payment_methods": [
{
"code": "cashondelivery",
"title": "Cash On Delivery"
},
{
"code": "banktransfer",
"title": "Bank Transfer Payment"
},
{
"code": "purchaseorder",
"title": "Purchase Order"
},
{
"code": "checkmo",
"title": "Check / Money order"
}
],
"totals": {
"grand_total": 165,
"base_grand_total": 165,
"subtotal": 160,
"base_subtotal": 160,
"discount_amount": 0,
"base_discount_amount": 0,
"subtotal_with_discount": 160,
"base_subtotal_with_discount": 160,
"shipping_amount": 5,
"base_shipping_amount": 5,
"shipping_discount_amount": 0,
"base_shipping_discount_amount": 0,
"tax_amount": 0,
"base_tax_amount": 0,
"weee_tax_applied_amount": null,
"shipping_tax_amount": 0,
"base_shipping_tax_amount": 0,
"subtotal_incl_tax": 160,
"shipping_incl_tax": 5,
"base_shipping_incl_tax": 5,
"base_currency_code": "USD",
"quote_currency_code": "USD",
"items_qty": 4,
"items": [
{
"item_id": 6,
"price": 22,
"base_price": 22,
"qty": 1,
"row_total": 22,
"base_row_total": 22,
"row_total_with_discount": 0,
"tax_amount": 0,
"base_tax_amount": 0,
"tax_percent": 0,
"discount_amount": 0,
"base_discount_amount": 0,
"discount_percent": 0,
"price_incl_tax": 22,
"base_price_incl_tax": 22,
"row_total_incl_tax": 22,
"base_row_total_incl_tax": 22,
"options": "[]",
"weee_tax_applied_amount": null,
"weee_tax_applied": null,
"name": "Radiant Tee-M-Orange"
},
{
"item_id": 7,
"price": 18,
"base_price": 18,
"qty": 1,
"row_total": 18,
"base_row_total": 18,
"row_total_with_discount": 0,
"tax_amount": 0,
"base_tax_amount": 0,
"tax_percent": 0,
"discount_amount": 0,
"base_discount_amount": 0,
"discount_percent": 0,
"price_incl_tax": 18,
"base_price_incl_tax": 18,
"row_total_incl_tax": 18,
"base_row_total_incl_tax": 18,
"options": "[{\"value\":\"Advanced Pilates & Yoga (Strength)\",\"label\":\"Downloads\"}]",
"weee_tax_applied_amount": null,
"weee_tax_applied": null,
"name": "Advanced Pilates & Yoga (Strength)"
},
{
"item_id": 8,
"price": 68,
"base_price": 68,
"qty": 1,
"row_total": 68,
"base_row_total": 68,
"row_total_with_discount": 0,
"tax_amount": 0,
"base_tax_amount": 0,
"discount_amount": 0,
"base_discount_amount": 0,
"discount_percent": 0,
"price_incl_tax": 68,
"base_price_incl_tax": 68,
"row_total_incl_tax": 68,
"base_row_total_incl_tax": 68,
"options": "[{\"value\":\"1 x Sprite Stasis Ball 65 cm <span class=\\\"price\\\">$27.00<\\/span>\",\"label\":\"Sprite Stasis Ball\"},{\"value\":\"1 x Sprite Foam Yoga Brick <span class=\\\"price\\\">$5.00<\\/span>\",\"label\":\"Sprite Foam Yoga Brick\"},{\"value\":\"1 x Sprite Yoga Strap 8 foot <span class=\\\"price\\\">$17.00<\\/span>\",\"label\":\"Sprite Yoga Strap\"},{\"value\":\"1 x Sprite Foam Roller <span class=\\\"price\\\">$19.00<\\/span>\",\"label\":\"Sprite Foam Roller\"}]",
"weee_tax_applied_amount": null,
"weee_tax_applied": null,
"name": "Sprite Yoga Companion Kit"
},
{
"item_id": 13,
"price": 52,
"base_price": 52,
"qty": 1,
"row_total": 52,
"base_row_total": 52,
"row_total_with_discount": 0,
"tax_amount": 0,
"base_tax_amount": 0,
"tax_percent": 0,
"discount_amount": 0,
"base_discount_amount": 0,
"discount_percent": 0,
"price_incl_tax": 52,
"base_price_incl_tax": 52,
"row_total_incl_tax": 52,
"base_row_total_incl_tax": 52,
"options": "[{\"value\":\"Gray\",\"label\":\"Color\"},{\"value\":\"S\",\"label\":\"Size\"}]",
"weee_tax_applied_amount": null,
"weee_tax_applied": null,
"name": "Chaz Kangeroo Hoodie"
}
],
"total_segments": [
{
"code": "subtotal",
"title": "Subtotal",
"value": 160
},
{
"code": "shipping",
"title": "Shipping & Handling (Best Way - Table Rate)",
"value": 5
},
{
"code": "tax",
"title": "Tax",
"value": 0,
"extension_attributes": {
"tax_grandtotal_details": []
}
},
{
"code": "grand_total",
"title": "Grand Total",
"value": 165,
"area": "footer"
}
]
}
}

 

Verify This Steps

Now, in order to verify this is to get the details you have to log in as a customer of the Magento 2 store and then go to the checkout page.

You can see that the payment method and other details in which you have saved the data through REST API are showing.

 

Conclusion:

It is possible to save shipping information or gate payment information through REST API.

You can get the shipping method details of any customer through the above-mentioned API and save shipping details.

 

Recommended Posts:

Guest Cart Paypal Payment Steps: Magento 2 REST API

Get Customer Detail Using Email ID in Magento 2 REST API

Guest Cart Paypal Payment Steps: Magento 2 REST API

In this post, I am going to explain how to perform guest cart Paypal payment steps in Magento 2 application.

Paying an amount in the Magento 2 store through a guest customer account is essential or improves your customer experience.

Paying via PayPal Payments inside the Magento store is also an important part for guest customers.

Through this post, we will go to know how to add items inside cutout for any guest customer and save shipping information and how to do any payment.

 

Magento 2 Guest Cart PayPal Payment Steps

Checking out guest customers for the Magento website is required for mobile applications.

Through this post, we will tell the guest customer the steps to add an item cart through rest api then save shipping information inside it using rest API.

In the last step, the guest customer will make the payment via PayPal payment at the checkout page to make the payment using the REST API.

Then after the PayPal payment is completed, it will also show the massage of its response on the success page.

 

Read more: Configure PayPal in Magento 2 : How to Integrate PayPal

 

Step 1: Get Admin Access Token

In the first step, the admin will get the access token of the login, then in the second step, the access token will be used.

To get the access token we will send admin details of the Magento store ie admin user and password inside the body and in return, we will get an access token.

Endpoint:

https://wishusucess.com/rest/V1/integration/admin/token

Method: POST

Header: Not required

Get Admin Access Token

Response:

rw1y20up27hrzcu1l6lp4t6uitsnczag

 

Step 2: Create Empty Cart for The Guest Customer

Now using the admin access token we will create an empty card for the guest customer.

Then we will get a quote id for a guest card through this API as a response.

Endpoint:

https://wishusucess.com/index.php/rest/V1/guest-carts/

Method: POST

Header: Not required

Guest Cart PayPal Payment Steps

Response:

hQDMOwbCqcub25qSfQccL3bFLTsDGSaC

 

Step 3: Add or Update Items in Cart

The REST API we hit in the second step yielded a quote ID.

Quote ID will be used for Add to Cart Items or Update Items of Guest Cart of Guest Customer.

To add cart item, inside the body will send the quote id as well as product details like SKU item quantity, etc.

In the header, the admin token will also be sent for authorization.

Now we will hit the guest customer add to cart Rest API, after that, we will get the response and in that response, the item which we mentioned in the body will be added.

Endpoint:

https://wishusucess.com/index.php/rest/V1/guest-carts/w2CFwWlzAkhnym999IBdQl8LBp9r6sdE/items

Method: POST

Header:

  • Content-Type: application/json
  • Authorization: Bearer Admin_Token

Body: 

{ "cartItem": { "quote_id": "w2CFwWlzAkhnym999IBdQl8LBp9r6sdE", "sku": "accessories1231", "qty": 1 } }

Add Update Cart Item REST API

 

Step 4: Get The Cart Details

Now we will hit by adding the quote id to the end of the rest API. We will get the cart detail of the guest customer using this api.

In this detail, you will get the product name, price, item ID, product type, etc. by using this cart detail Magento 2 rest API.

Endpoint

https://wishusucess.com/index.php/rest/V1/guest-carts/ewWBDaATec0fKEo15lZkGzEiaoZ1p6sh

Method: GET

Header:

  • Content-Type: application/json
  • Authorization: Bearer Admin_Token

Body: 

Not required

Get the Cart Details REST API

Response:

{
"id": 2271,
"created_at": "2022-02-11 06:22:24",
"updated_at": "2022-02-11 06:24:47",
"is_active": true,
"is_virtual": false,
"items": [
{
"item_id": 1009,
"sku": "accessories1231",
"qty": 1,
"name": "accessories mono c",
"price": 133,
"product_type": "simple",
"quote_id": "2271",
"extension_attributes": {
"image_url": "https://wishusucess.com/pub/media/catalog/product/cache/54139b022fb7bb8c324a752eac907829/b/a/bags_9.png"
}
}
],
"items_count": 1,
"items_qty": 1,
"customer": {
"email": null,
"firstname": null,
"lastname": null
},
"billing_address": {
"id": 4706,
"region": null,
"region_id": null,
"region_code": null,
"country_id": null,
"street": [
""
],
"telephone": null,
"postcode": null,
"city": null,
"firstname": null,
"lastname": null,
"email": null,
"same_as_billing": 0,
"save_in_address_book": 0
},
"orig_order_id": 0,
"currency": {
"global_currency_code": "USD",
"base_currency_code": "USD",
"store_currency_code": "USD",
"quote_currency_code": "USD",
"store_to_base_rate": 0,
"store_to_quote_rate": 0,
"base_to_global_rate": 1,
"base_to_quote_rate": 1
},
"customer_is_guest": false,
"customer_note_notify": true,
"customer_tax_class_id": 3,
"store_id": 1,
"extension_attributes": {
"shipping_assignments": [
{
"shipping": {
"address": {
"id": 4707,
"region": null,
"region_id": null,
"region_code": null,
"country_id": null,
"street": [
""
],
"telephone": null,
"postcode": null,
"city": null,
"firstname": null,
"lastname": null,
"email": null,
"same_as_billing": 1,
"save_in_address_book": 0
},
"method": null
},
"items": [
{
"item_id": 1009,
"sku": "accessories1231",
"qty": 1,
"name": "accessories mono c",
"price": 133,
"product_type": "simple",
"quote_id": "2271",
"extension_attributes": {
"image_url": "https://wishusucess.com/pub/media/catalog/product/cache/54139b022fb7bb8c324a752eac907829/b/a/bags_9.png"
}
}
]
}
]
}
}

 

Step 5: Add Shipping Information to The Cart

Through this REST API, we will save the shipping address to which the product is to be delivered to the customer i.e. use this rectify to save the shipping address.

This REST API will serve to save the shipping address for the guest customer on the store.

When we will get the response, the payment methods available in the store will be shown in that response.

The kind of payment method that Magento store is providing will be visible as an available payment method response.

Now payment can be done by selecting that payment method in the next step.

Endpoint:

https://wishusucess.com/index.php/rest/V1/guest-carts/ewWBDaATec0fKEo15lZkGzEiaoZ1p6sh/shipping-information

Method: POST

Header:

  • Content-Type: application/json
  • Authorization: Bearer Admin_Token

Body: 

{
"addressInformation": {
"billingAddress": {
"region": "UP",
"region_id": 566,
"country_id": "IN",
"street": [
"Botanical Garden Metro, Noida"
],
"company": "Wishusucess",
"telephone": "1111111",
"postcode": "201301",
"city": "Noida",
"firstname": "Hemamt",
"lastname": "Singh",
"email": "cs.hemantsingh@gmail.com",
"prefix": "address_",
"region_code": "UP"
},
"shippingAddress": {
"region": "UP",
"region_id": 566,
"country_id": "IN",
"street": [
"Botanical Garden Metro, Noida"
],
"company": "Wishusucess",
"telephone": "1111111",
"postcode": "201301",
"city": "Noida",
"firstname": "Hemant",
"lastname": "Singh",
"email": "cs.hemantsingh@gmail.com",
"prefix": "address_",
"region_code": "UP",
"sameAsBilling": 1
},
"shippingCarrierCode": "flatrate",
"shippingMethodCode": "flatrate"
}
}

Add Shipping Information for Guest Cart PayPal Payment Steps

Response:

{
"payment_methods": [
{
"code": "paypal_express",
"title": "PayPal Credit (Paypal Express)"
},
{
"code": "paypal_express",
"title": "PayPal Express Checkout"
}
],
"totals": {
"grand_total": 133,
"base_grand_total": 133,
"subtotal": 133,
"base_subtotal": 133,
"discount_amount": 0,
"base_discount_amount": 0,
"subtotal_with_discount": 133,
"base_subtotal_with_discount": 133,
"shipping_amount": 0,
"base_shipping_amount": 0,
"shipping_discount_amount": 0,
"base_shipping_discount_amount": 0,
"tax_amount": 0,
"base_tax_amount": 0,
"weee_tax_applied_amount": null,
"shipping_tax_amount": 0,
"base_shipping_tax_amount": 0,
"subtotal_incl_tax": 133,
"shipping_incl_tax": 0,
"base_shipping_incl_tax": 0,
"base_currency_code": "USD",
"quote_currency_code": "USD",
"items_qty": 1,
"items": [
{
"item_id": 1009,
"price": 133,
"base_price": 133,
"qty": 1,
"row_total": 133,
"base_row_total": 133,
"row_total_with_discount": 0,
"tax_amount": 0,
"base_tax_amount": 0,
"tax_percent": 0,
"discount_amount": 0,
"base_discount_amount": 0,
"discount_percent": 0,
"price_incl_tax": 133,
"base_price_incl_tax": 133,
"row_total_incl_tax": 133,
"base_row_total_incl_tax": 133,
"options": "[]",
"weee_tax_applied_amount": null,
"weee_tax_applied": null,
"name": "accessories mono c"
}
],
"total_segments": [
{
"code": "subtotal",
"title": "Subtotal",
"value": 133
},
{
"code": "shipping",
"title": "Shipping & Handling (By DEN - By DEN)",
"value": 0
},
{
"code": "tax",
"title": "Tax",
"value": 0,
"extension_attributes": {
"tax_grandtotal_details": []
}
},
{
"code": "grand_total",
"title": "Grand Total",
"value": 133,
"area": "footer"
}
]
}
}

 

Step 6: Add Payment Information And Place The Order

Now add the payment option in the body and hit the rest api.

You will get a response.

Endpoint:

https://wishusucess.com/index.php/rest/V1/guest-carts/ewWBDaATec0fKEo15lZkGzEiaoZ1p6sh/order

Method: PUT

Header:

  • Content-Type: application/json
  • Authorization: Bearer Admin_Token

Body: 

{ "paymentMethod": { "method": "paypal_express" } }

Payment Information API Magento 2

Response:

1

 

Step 7: Complete PayPal Payment - Guest Cart Paypal payment Steps

Now follow the below step to complete the transaction.

Now click on the link given below to complete your PayPal payment.

Then in the next step follow the step by step PayPal payment mentioned in the post

How to Make Payment Using PayPal REST API in Magento 2

 

 

Similar Posts:

Get Customer Detail Using Email ID in Magento 2 REST API

Get Customer Detail Using Email ID in Magento 2 REST API

When we make a mobile application, then we need many types of API at that time. In order to develop a mobile application, there is a Magento 2 Customer Detail REST API named order detail generation using email.

Whatever product is ordered on the magento2 eCommerce platform, if you want to extract that product order details using email id, then you can use the rest API given below.

If we want to get customer order details through email id, then you can easily get the detail via email id rest API.

Under the order details, all the payment details will be shown and the status of the order will show how many products you have ordered so far.

What is the status of your every order i.e. if ever your status has been successful then it will appear as successful and if your order was pending or you have canceled your order then that order will also show you in the response?

 

Get Order Detail REST API Magento 2

There are two ways to get the Magento 2 customer order details via rest API while developing the mobile application.

  • Get customer order detail via Email ID
  • Get customer detail via Order ID

Here, We will try to get the order details in both ways and check both the APIs alternately on postman.com to see what response we are getting.

 

Magento 2 Get Customer Detail REST API Via Email ID

As you can see in the response below I have entered the customer email parameter id inside of REST API Prams and all the products ordered from this email id are easily visible in the response.

Total count is also showing via using this resp API, Payment information is also visible by whom the payment has been made and billing address shipping address is also visible.

You can also get the method used while ordering the product using order detail rest api.

Endpoint:

http://wishusucess.com/rest/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=customer_email&searchCriteria[filter_groups][0][filters][0][value]=cs.hemantsingh@gmail.com

Method: GET

Header:

  • Authorization: bearer <admin_token>
  • content-type: application/json

Body:

Not Required

Customer Detail Using Email ID in Magento 2

 

Response:

{
"items": [
{
"base_currency_code": "USD",
"base_discount_amount": 0,
"base_discount_invoiced": 0,
"base_grand_total": 200,
"base_discount_tax_compensation_amount": 0,
"base_discount_tax_compensation_invoiced": 0,
"base_shipping_amount": 0,
"base_shipping_discount_amount": 0,
"base_shipping_discount_tax_compensation_amnt": 0,
"base_shipping_incl_tax": 0,
"base_shipping_invoiced": 0,
"base_shipping_tax_amount": 0,
"base_subtotal": 200,
"base_subtotal_incl_tax": 200,
"base_subtotal_invoiced": 200,
"base_tax_amount": 0,
"base_tax_invoiced": 0,
"base_total_due": 0,
"base_total_invoiced": 200,
"base_total_invoiced_cost": 0,
"base_total_paid": 200,
"base_to_global_rate": 1,
"base_to_order_rate": 1,
"billing_address_id": 198,
"created_at": "2022-01-13 06:46:19",
"customer_email": "cs.hemantsingh@gmail.com",
"customer_group_id": 0,
"customer_is_guest": 1,
"customer_note_notify": 1,
"discount_amount": 0,
"discount_invoiced": 0,
"email_sent": 1,
"entity_id": 99,
"global_currency_code": "USD",
"grand_total": 200,
"discount_tax_compensation_amount": 0,
"discount_tax_compensation_invoiced": 0,
"increment_id": "000000138",
"is_virtual": 0,
"order_currency_code": "USD",
"protect_code": "a04608837596c6736a143b98497134a1",
"quote_id": 1110,
"remote_ip": "14.102.51.229",
"shipping_amount": 0,
"shipping_description": "By DEN - By DEN",
"shipping_discount_amount": 0,
"shipping_discount_tax_compensation_amount": 0,
"shipping_incl_tax": 0,
"shipping_invoiced": 0,
"shipping_tax_amount": 0,
"state": "processing",
"status": "processing",
"store_currency_code": "USD",
"store_id": 1,
"store_name": "Main Website\nMain Website Store\nDefault Store View",
"store_to_base_rate": 0,
"store_to_order_rate": 0,
"subtotal": 200,
"subtotal_incl_tax": 200,
"subtotal_invoiced": 200,
"tax_amount": 0,
"tax_invoiced": 0,
"total_due": 0,
"total_invoiced": 200,
"total_item_count": 1,
"total_paid": 200,
"total_qty_ordered": 2,
"updated_at": "2022-01-13 06:47:13",
"weight": 200,
"x_forwarded_for": "14.102.51.229",
"items": [
{
"amount_refunded": 0,
"base_amount_refunded": 0,
"base_discount_amount": 0,
"base_discount_invoiced": 0,
"base_discount_tax_compensation_amount": 0,
"base_discount_tax_compensation_invoiced": 0,
"base_original_price": 100,
"base_price": 100,
"base_price_incl_tax": 100,
"base_row_invoiced": 200,
"base_row_total": 200,
"base_row_total_incl_tax": 200,
"base_tax_amount": 0,
"base_tax_invoiced": 0,
"created_at": "2022-01-13 06:46:19",
"discount_amount": 0,
"discount_invoiced": 0,
"discount_percent": 0,
"free_shipping": 0,
"discount_tax_compensation_amount": 0,
"discount_tax_compensation_invoiced": 0,
"is_qty_decimal": 0,
"is_virtual": 0,
"item_id": 144,
"name": "Accessories monogram D",
"no_discount": 0,
"order_id": 99,
"original_price": 100,
"price": 100,
"price_incl_tax": 100,
"product_id": 17,
"product_type": "simple",
"qty_canceled": 0,
"qty_invoiced": 2,
"qty_ordered": 2,
"qty_refunded": 0,
"qty_shipped": 0,
"quote_item_id": 568,
"row_invoiced": 200,
"row_total": 200,
"row_total_incl_tax": 200,
"row_weight": 200,
"sku": "Accessories monogram D",
"store_id": 1,
"tax_amount": 0,
"tax_invoiced": 0,
"tax_percent": 0,
"updated_at": "2022-01-13 06:46:19",
"weee_tax_applied": "[]",
"weight": 100
}
],
"billing_address": {
"address_type": "billing",
"city": "Noida",
"country_id": "IN",
"email": "cs.hemantsingh@gmail.com",
"entity_id": 198,
"firstname": "Hemant",
"lastname": "Singh",
"parent_id": 99,
"postcode": "95070",
"region": "Uttar Pradesh",
"region_code": "UP",
"region_id": 566,
"street": [
"New test"
],
"telephone": null
},
"payment": {
"account_status": null,
"additional_information": [
"0",
"1",
"",
"TUZYUGM3ERY3Q",
"cs.hemantsingh@gmail.com",
"unverified",
"confirmed",
"133ea25fc4520",
"TUZYUGM3ERY3Q",
"EC-98T36492VK521913U",
"PayPal Express Checkout",
null,
"Eligible",
"completed",
"None"
],
"amount_authorized": 200,
"amount_ordered": 200,
"amount_paid": 200,
"base_amount_authorized": 200,
"base_amount_ordered": 200,
"base_amount_paid": 200,
"base_amount_paid_online": 200,
"base_shipping_amount": 0,
"base_shipping_captured": 0,
"cc_exp_year": "0",
"cc_last4": null,
"cc_ss_start_month": "0",
"cc_ss_start_year": "0",
"entity_id": 99,
"last_trans_id": "9LN125666F286773U",
"method": "paypal_express",
"parent_id": 99,
"shipping_amount": 0,
"shipping_captured": 0
},
"status_histories": [
{
"comment": "IPN \"Completed\" Registered notification about captured amount of $200.00. Transaction ID: \"<a target=\"_blank\" href=\"https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=9LN125666F286773U\">9LN125666F286773U</a>\"",
"created_at": "2022-01-13 06:46:37",
"entity_id": 44,
"entity_name": "order",
"is_customer_notified": null,
"is_visible_on_front": 0,
"parent_id": 99,
"status": "processing"
},
{
"comment": "Captured amount of $200.00 online. Transaction ID: \"<a target=\"_blank\" href=\"https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=9LN125666F286773U\">9LN125666F286773U</a>\"",
"created_at": "2022-01-13 06:46:19",
"entity_id": 43,
"entity_name": "invoice",
"is_customer_notified": null,
"is_visible_on_front": 0,
"parent_id": 99,
"status": "processing"
}
],
"extension_attributes": {
"shipping_assignments": [
{
"shipping": {
"address": {
"address_type": "shipping",
"city": "Noida",
"country_id": "IN",
"email": "cs.hemantsingh@gmail.com",
"entity_id": 197,
"firstname": "Hemant",
"lastname": "Singh",
"parent_id": 99,
"postcode": "302021",
"region": "Uttar Pradesh",
"region_code": "UP",
"region_id": 566,
"street": [
"New test"
],
"telephone": null
},
"method": "flatrate_flatrate",
"total": {
"base_shipping_amount": 0,
"base_shipping_discount_amount": 0,
"base_shipping_discount_tax_compensation_amnt": 0,
"base_shipping_incl_tax": 0,
"base_shipping_invoiced": 0,
"base_shipping_tax_amount": 0,
"shipping_amount": 0,
"shipping_discount_amount": 0,
"shipping_discount_tax_compensation_amount": 0,
"shipping_incl_tax": 0,
"shipping_invoiced": 0,
"shipping_tax_amount": 0
}
},
"items": [
{
"amount_refunded": 0,
"base_amount_refunded": 0,
"base_discount_amount": 0,
"base_discount_invoiced": 0,
"base_discount_tax_compensation_amount": 0,
"base_discount_tax_compensation_invoiced": 0,
"base_original_price": 100,
"base_price": 100,
"base_price_incl_tax": 100,
"base_row_invoiced": 200,
"base_row_total": 200,
"base_row_total_incl_tax": 200,
"base_tax_amount": 0,
"base_tax_invoiced": 0,
"created_at": "2022-01-13 06:46:19",
"discount_amount": 0,
"discount_invoiced": 0,
"discount_percent": 0,
"free_shipping": 0,
"discount_tax_compensation_amount": 0,
"discount_tax_compensation_invoiced": 0,
"is_qty_decimal": 0,
"is_virtual": 0,
"item_id": 144,
"name": "Accessories monogram D",
"no_discount": 0,
"order_id": 99,
"original_price": 100,
"price": 100,
"price_incl_tax": 100,
"product_id": 17,
"product_type": "simple",
"qty_canceled": 0,
"qty_invoiced": 2,
"qty_ordered": 2,
"qty_refunded": 0,
"qty_shipped": 0,
"quote_item_id": 568,
"row_invoiced": 200,
"row_total": 200,
"row_total_incl_tax": 200,
"row_weight": 200,
"sku": "Accessories monogram D",
"store_id": 1,
"tax_amount": 0,
"tax_invoiced": 0,
"tax_percent": 0,
"updated_at": "2022-01-13 06:46:19",
"weee_tax_applied": "[]",
"weight": 100
}
]
}
],
"payment_additional_info": [
{
"key": "paypal_express_checkout_shipping_overridden",
"value": "0"
},
{
"key": "button",
"value": "1"
},
{
"key": "paypal_express_checkout_shipping_method",
"value": ""
},
{
"key": "paypal_payer_id",
"value": "TUZYUGM3ERY3Q"
},
{
"key": "paypal_payer_email",
"value": "cs.hemantsingh@gmail.com"
},
{
"key": "paypal_payer_status",
"value": "unverified"
},
{
"key": "paypal_address_status",
"value": "confirmed"
},
{
"key": "paypal_correlation_id",
"value": "133ea25fc4520"
},
{
"key": "paypal_express_checkout_payer_id",
"value": "TUZYUGM3ERY3Q"
},
{
"key": "paypal_express_checkout_token",
"value": "EC-98T36492VK521913U"
},
{
"key": "method_title",
"value": "PayPal Express Checkout"
},
{
"key": "paypal_express_checkout_redirect_required",
"value": "null"
},
{
"key": "paypal_protection_eligibility",
"value": "Eligible"
},
{
"key": "paypal_payment_status",
"value": "completed"
},
{
"key": "paypal_pending_reason",
"value": "None"
}
],
"applied_taxes": [],
"item_applied_taxes": []
}
}
],
"search_criteria": {
"filter_groups": [
{
"filters": [
{
"field": "customer_email",
"value": "cs.hemantsingh@gmail.com",
"condition_type": "eq"
}
]
}
]
},
"total_count": 1
}

 

 

View Order By Order Id via Magento 2 REST API

Magento 2 provides a REST API to get the order detail like payment information, payment status, payment method, shipping address, billing address, etc. using order id.

If order detail information is to be retrieved on the basis of order id, then we will use order view via order id API for that.

Lastly, we will enter the order id and hit the API, then we will get all the details of the order as our response

Endpoint:

http://wishusucess.com/rest/V1/orders/99

Method: GET

  • Authorization: Bearer admin_token
  • Content-Type: application/json

Body:

Not required

Customer Detail REST API

Response:

{
"base_currency_code": "USD",
"base_discount_amount": 0,
"base_discount_invoiced": 0,
"base_grand_total": 200,
"base_discount_tax_compensation_amount": 0,
"base_discount_tax_compensation_invoiced": 0,
"base_shipping_amount": 0,
"base_shipping_discount_amount": 0,
"base_shipping_discount_tax_compensation_amnt": 0,
"base_shipping_incl_tax": 0,
"base_shipping_invoiced": 0,
"base_shipping_tax_amount": 0,
"base_subtotal": 200,
"base_subtotal_incl_tax": 200,
"base_subtotal_invoiced": 200,
"base_tax_amount": 0,
"base_tax_invoiced": 0,
"base_total_due": 0,
"base_total_invoiced": 200,
"base_total_invoiced_cost": 0,
"base_total_paid": 200,
"base_to_global_rate": 1,
"base_to_order_rate": 1,
"billing_address_id": 198,
"created_at": "2022-01-13 06:46:19",
"customer_email": "test456@tech9logy.in",
"customer_group_id": 0,
"customer_is_guest": 1,
"customer_note_notify": 1,
"discount_amount": 0,
"discount_invoiced": 0,
"email_sent": 1,
"entity_id": 99,
"global_currency_code": "USD",
"grand_total": 200,
"discount_tax_compensation_amount": 0,
"discount_tax_compensation_invoiced": 0,
"increment_id": "000000138",
"is_virtual": 0,
"order_currency_code": "USD",
"protect_code": "a04608837596c6736a143b98497134a1",
"quote_id": 1110,
"remote_ip": "14.102.51.229",
"shipping_amount": 0,
"shipping_description": "By DEN - By DEN",
"shipping_discount_amount": 0,
"shipping_discount_tax_compensation_amount": 0,
"shipping_incl_tax": 0,
"shipping_invoiced": 0,
"shipping_tax_amount": 0,
"state": "processing",
"status": "processing",
"store_currency_code": "USD",
"store_id": 1,
"store_name": "Main Website\nMain Website Store\nDefault Store View",
"store_to_base_rate": 0,
"store_to_order_rate": 0,
"subtotal": 200,
"subtotal_incl_tax": 200,
"subtotal_invoiced": 200,
"tax_amount": 0,
"tax_invoiced": 0,
"total_due": 0,
"total_invoiced": 200,
"total_item_count": 1,
"total_paid": 200,
"total_qty_ordered": 2,
"updated_at": "2022-01-13 06:47:13",
"weight": 200,
"x_forwarded_for": "14.102.51.229",
"items": [
{
"amount_refunded": 0,
"base_amount_refunded": 0,
"base_discount_amount": 0,
"base_discount_invoiced": 0,
"base_discount_tax_compensation_amount": 0,
"base_discount_tax_compensation_invoiced": 0,
"base_original_price": 100,
"base_price": 100,
"base_price_incl_tax": 100,
"base_row_invoiced": 200,
"base_row_total": 200,
"base_row_total_incl_tax": 200,
"base_tax_amount": 0,
"base_tax_invoiced": 0,
"created_at": "2022-01-13 06:46:19",
"discount_amount": 0,
"discount_invoiced": 0,
"discount_percent": 0,
"free_shipping": 0,
"discount_tax_compensation_amount": 0,
"discount_tax_compensation_invoiced": 0,
"is_qty_decimal": 0,
"is_virtual": 0,
"item_id": 144,
"name": "Accessories monogram D",
"no_discount": 0,
"order_id": 99,
"original_price": 100,
"price": 100,
"price_incl_tax": 100,
"product_id": 17,
"product_type": "simple",
"qty_canceled": 0,
"qty_invoiced": 2,
"qty_ordered": 2,
"qty_refunded": 0,
"qty_shipped": 0,
"quote_item_id": 568,
"row_invoiced": 200,
"row_total": 200,
"row_total_incl_tax": 200,
"row_weight": 200,
"sku": "Accessories monogram D",
"store_id": 1,
"tax_amount": 0,
"tax_invoiced": 0,
"tax_percent": 0,
"updated_at": "2022-01-13 06:46:19",
"weee_tax_applied": "[]",
"weight": 100
}
],
"billing_address": {
"address_type": "billing",
"city": "Noida",
"country_id": "US",
"email": "cs.hemantsingh@gmail.com",
"entity_id": 198,
"firstname": "Hemant",
"lastname": "Singh",
"parent_id": 99,
"postcode": "302021",
"region": "Uttar Pradesh",
"region_code": "UP",
"region_id": 566,
"street": [
"New test"
],
"telephone": null
},
"payment": {
"account_status": null,
"additional_information": [
"0",
"1",
"",
"TUZYUGM3ERY3Q",
"cs.hemantsingh@gmail.com",
"unverified",
"confirmed",
"133ea25fc4520",
"TUZYUGM3ERY3Q",
"EC-98T36492VK521913U",
"PayPal Express Checkout",
null,
"Eligible",
"completed",
"None"
],
"amount_authorized": 200,
"amount_ordered": 200,
"amount_paid": 200,
"base_amount_authorized": 200,
"base_amount_ordered": 200,
"base_amount_paid": 200,
"base_amount_paid_online": 200,
"base_shipping_amount": 0,
"base_shipping_captured": 0,
"cc_exp_year": "0",
"cc_last4": null,
"cc_ss_start_month": "0",
"cc_ss_start_year": "0",
"entity_id": 99,
"last_trans_id": "9LN125666F286773U",
"method": "paypal_express",
"parent_id": 99,
"shipping_amount": 0,
"shipping_captured": 0
},
"status_histories": [
{
"comment": "IPN \"Completed\" Registered notification about captured amount of $200.00. Transaction ID: \"<a target=\"_blank\" href=\"https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=9LN125666F286773U\">9LN125666F286773U</a>\"",
"created_at": "2022-01-13 06:46:37",
"entity_id": 44,
"entity_name": "order",
"is_customer_notified": null,
"is_visible_on_front": 0,
"parent_id": 99,
"status": "processing"
},
{
"comment": "Captured amount of $200.00 online. Transaction ID: \"<a target=\"_blank\" href=\"https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=9LN125666F286773U\">9LN125666F286773U</a>\"",
"created_at": "2022-01-13 06:46:19",
"entity_id": 43,
"entity_name": "invoice",
"is_customer_notified": null,
"is_visible_on_front": 0,
"parent_id": 99,
"status": "processing"
}
],
"extension_attributes": {
"shipping_assignments": [
{
"shipping": {
"address": {
"address_type": "shipping",
"city": "Noida",
"country_id": "IN",
"email": "cs.hemantsingh@gmail.com",
"entity_id": 197,
"firstname": "Hemant",
"lastname": "Singh",
"parent_id": 99,
"postcode": "302021",
"region": "Uttar Pradesh",
"region_code": "UP",
"region_id": 566,
"street": [
"New test"
],
"telephone": null
},
"method": "flatrate_flatrate",
"total": {
"base_shipping_amount": 0,
"base_shipping_discount_amount": 0,
"base_shipping_discount_tax_compensation_amnt": 0,
"base_shipping_incl_tax": 0,
"base_shipping_invoiced": 0,
"base_shipping_tax_amount": 0,
"shipping_amount": 0,
"shipping_discount_amount": 0,
"shipping_discount_tax_compensation_amount": 0,
"shipping_incl_tax": 0,
"shipping_invoiced": 0,
"shipping_tax_amount": 0
}
},
"items": [
{
"amount_refunded": 0,
"base_amount_refunded": 0,
"base_discount_amount": 0,
"base_discount_invoiced": 0,
"base_discount_tax_compensation_amount": 0,
"base_discount_tax_compensation_invoiced": 0,
"base_original_price": 100,
"base_price": 100,
"base_price_incl_tax": 100,
"base_row_invoiced": 200,
"base_row_total": 200,
"base_row_total_incl_tax": 200,
"base_tax_amount": 0,
"base_tax_invoiced": 0,
"created_at": "2022-01-13 06:46:19",
"discount_amount": 0,
"discount_invoiced": 0,
"discount_percent": 0,
"free_shipping": 0,
"discount_tax_compensation_amount": 0,
"discount_tax_compensation_invoiced": 0,
"is_qty_decimal": 0,
"is_virtual": 0,
"item_id": 144,
"name": "Accessories monogram D",
"no_discount": 0,
"order_id": 99,
"original_price": 100,
"price": 100,
"price_incl_tax": 100,
"product_id": 17,
"product_type": "simple",
"qty_canceled": 0,
"qty_invoiced": 2,
"qty_ordered": 2,
"qty_refunded": 0,
"qty_shipped": 0,
"quote_item_id": 568,
"row_invoiced": 200,
"row_total": 200,
"row_total_incl_tax": 200,
"row_weight": 200,
"sku": "Accessories monogram D",
"store_id": 1,
"tax_amount": 0,
"tax_invoiced": 0,
"tax_percent": 0,
"updated_at": "2022-01-13 06:46:19",
"weee_tax_applied": "[]",
"weight": 100
}
]
}
],
"payment_additional_info": [
{
"key": "paypal_express_checkout_shipping_overridden",
"value": "0"
},
{
"key": "button",
"value": "1"
},
{
"key": "paypal_express_checkout_shipping_method",
"value": ""
},
{
"key": "paypal_payer_id",
"value": "TUZYUGM3ERY3Q"
},
{
"key": "paypal_payer_email",
"value": "cs.hemantsingh@gmail.com"
},
{
"key": "paypal_payer_status",
"value": "unverified"
},
{
"key": "paypal_address_status",
"value": "confirmed"
},
{
"key": "paypal_correlation_id",
"value": "133ea25fc4520"
},
{
"key": "paypal_express_checkout_payer_id",
"value": "TUZYUGM3ERY3Q"
},
{
"key": "paypal_express_checkout_token",
"value": "EC-98T36492VK521913U"
},
{
"key": "method_title",
"value": "PayPal Express Checkout"
},
{
"key": "paypal_express_checkout_redirect_required",
"value": "null"
},
{
"key": "paypal_protection_eligibility",
"value": "Eligible"
},
{
"key": "paypal_payment_status",
"value": "completed"
},
{
"key": "paypal_pending_reason",
"value": "None"
}
],
"applied_taxes": [],
"item_applied_taxes": []
}
}

 

Conclusion:

If you want to get order information of customers then you can use the default rest API of Magento 2 for that.

We can get the order details in two ways one is on the basis of email id and the other on the basis of order id.

 

 

Related Posts:

Product Search REST API: List of REST APIs in Magento 2

How to Create REST API in Magento 2, For Beginners Guide

Magento 2.4.3 Installation: Steps By Step Guide for XAMPP

The latest version of Magento is out again, so in this post, we will know the Magento 2.4.3 installation steps on the windows operating system.

Will install Magento on XAMPP server as well as install elastic search first in order to complete the setup of installation.

 

Steps By Step Guide of Magento 2.4.3 Installation

I am telling you the steps of Magento installation, following which you can install jump server on your windows operating system and how to use Magento 2.4.3.

Elasticsearch is mandatory in all the onwards versions of Magento 2.4, so first, we have to configure elastic search.

As we know that Magento 2.4 version can be installed only through composer installation.

GUI installations have been removed from all versions of Magento 2.4, so we have to install composer as well.

Let us know how many steps are followed by which you can install agents on your local system.

 

Step 1: Install XAMPP Server

In the first step, you have to set up the XAMPP server on your windows. You can use the below link to download the xampp.

Download XAMM Server for the Magento 2.4.3

After the download, you have to install this software and then start Apache and MySQL.

Xampp Server Instllation on Window for Magento 2.4.3 Installation

Step 2: Install Composer

Composer is required for all versions of Magento 24.

Installation without composer is not provided in upcoming versions of 2.4.

To install composer you can download composer from the given link.

Install Composer on Window

After your composer is successfully installed, the screen will show something like this.

Now after this you have to go to the next stage by clicking on it.

Finish Composer Installation

If you want to verify whether the composer is installed correctly or not or whether the composer is running in your system.

For this, you go to the root directory of Magento and type composer version there, then your screen will look something like this.

 composer --version

Check composer version for Magento 2.4.3 Installation

 

Step 3: Install Elastic Search on Window

Elasticsearch is required for catalog product search in Magento 2.4 and onwards version.

The core development team of Magento 2.4 does not provide you with the installation facility without Elasticsearch.

To install Elasticsearch you can download it from the given link.

 

Put the apps file in the htdocs folder of the jump server and then extract it there.

Elastic Search Start on XAMPP for Magento 2.4.3 Installation

Then go to the bin folder of elastic search and right-click on the second file and run as administrator, your elastic search will start.

Start Elasticsearch

Verify Running Status of Elastic Search

If you want to confirm whether your elastic search is running successfully in your jump server or not.

For this, you have to open the browser and enter the localhost and port number in the URL of that browser, then you will see the screen something like the image below.

localhost:9200

Check Running Elasticsearch Status

System Requirements for Elasticsearch

Elasticsearch consumes a lot of RAM. For this you must have at least 8GB RAM, otherwise, it will not run properly and your system will hang.

Therefore, the recommended advice to you is that if your computer or laptop has less than 8GB of RAM, then do not install Elasticsearch.

Elasticsearch RAM Consumption

 

 

Step 4: Configure php.ini in XAMPP

There are some important extensions that we need to keep enabled for Magento 2.4.3 p1 to run properly.

In the XAMPP server some extensions are enabled by default but some we have to enable, for that we have to go to the php.ini file and remove the semicolon

Required PHP extensions

We need the following extension for the Magento 2.4.3 p1 version.

bcmath, ctype, curl, dom, gd, hash, iconv, intl

mbstring, openssl, pdo_mysql, simplexml, soap, xsl, zip, ext-sockets

Go to C:\xampp\php\php.ini

Quick Tip: If you want to open the php.ini file quickly, then for this you go to XAMPP Control Panel.

Then there you will see the config option on the right side of Apache, click on it.

On clicking, the option of php.ini file will appear, open it

;extension=intl
;extension=soap
;extension=xsl
;extension=sockets
;extension=sodium

Now Remove ; from the above lines of php.ini file.

Save the file.

 

Configure php settings

Now change the value for following parameter In php.ini file,

max_execution_time=18000
max_input_time=1800
memory_limit=4G

After making these many configuration changes, there will be no interruption in your Magento 2.4.3 installation and the installation process will run smoothly.

  • Now restart apache from the XAMPP control panel.

 

Step 5: Create Database for Magento 2.4.3 Installation

Now you have to type localhost PHPMyAdmin in your browser and create a database there then we will use that database while installing magento.

localhost/phpmyadmin

The default username of MySql for the jump server is root and the password is blank, so we need to reset the password.

For this, by going to the jump control panel, click on the cell command there, then run the command below, your screen will look something like this.

mysqladmin.exe -u root password yourpassword

change mysql password

The default password of the database was blank, which we have reset, so our database will not open automatically and will ask you for the password.

So if you want to log in automatically, then for this you have to enter the password by going to the config file of MySQL, then as soon as you open the admin of PHPMyAdmin, you will open the database, then automatically login will be done.

D:\xampp3\phpMyAdmin

File Name: config.inc.php

Password Changes of PHPMyadmin

Step 6: Run Magento 2.4.3 Installation Command

In this step, you have to go to the Magento official website (https://magento.com/tech-resources/download) and download the 2.4.3

Download Magento 2.4

When downloaded, put it in the htdocs folder of XAMPP then unzip it.

 

Required Server Configuration

The Magento app is served from /var/www/html/m234p1s/pub.

We need to set the document root to the pub, to do this go to file

D:\xampp\apache\conf\extra\httpd-vhosts.conf

Add this content at the bottom of the file.

<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs/m243p1s/pub"
ServerName yourname.magento.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "D:/xampp/htdocs"
ServerName localhost
</VirtualHost>

Where,

DocumentRoot "D:/xampp/htdocs/m243p1s/pub" is the location of the magento2 folder path

yourname.magento.com is the base url. Ex: – m243p1s.com

Now let's open

C:\Windows\System32\drivers\etc\hosts

the file in notepad++ and add the below line at the bottom of the file.

127.0.0.1 yourname.magento.com

Now all your setup is ready so that you can run the Magento installation command.

For this you can once again make sure that your MySql is running or not, Apache is running or not, Elasticsearch is running or not.

When all these are running properly then only you run the command given below.

Go to the root folder in which you have extracted magento and open then run the below command.

D:\xampp3\htdocs\m243p1s
php bin/magento setup:install --base-url="http://m243p1s.com/" --db-host="localhost" --db-name="m243p1s" --db-user="root" --db-password="root" --admin-firstname="admin" --admin-lastname="admin" --admin-email="cs.hemantsinghtech9@gmail.com" --admin-user="admin" --admin-password="Admin@#123" --language="en_US" --currency="USD" --timezone="America/Chicago" --use-rewrites="1" --backend-frontname="admin" --search-engine=elasticsearch7 --elasticsearch-host="localhost" --elasticsearch-port=9200

Magento 2.4.3 Installation Steps

Note:

Make sure to replace these values:

– base-url: your magento 2 installation folder

– db-name: your database name in step 3

– db-password: your database password in step 3

 

Unable to apply data patch Magento 2.4.3 Installation

Magento 2.4.3 Installation Issue

Now as soon as you run the command, you will see some issue, you can resolve the above issue by changing the file of the path given below.

Unable to apply data patch

Magento\Theme\Setup\Patch\Data\RegisterThemes for module Magento_Theme. Original exception message: Wrong file

In Gd2.php line 72: Wrong file

private function validateURLScheme(string $filename) : bool
{
$allowed_schemes = ['ftp', 'ftps', 'http', 'https'];
$url = parse_url($filename);
if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes) && !file_exists($filename)) {
return false;
}

return true; 
}

Now again, re-run the above installation command.

Magento 2.4.3 Installation Steps

Magenta 2.4.3 installation step is completed but when you hit this URL on the browser you will find that CSS and js are not loading.

To solve this, you have to change some of the files given below, then after that run the command, and then the issue will be resolved.

 

Solution of Not Loading CSS and JS

Here’s how to fix CSS and js loading issues:

Go to:

D:\xampp\htdocs\magento2\vendor\magento\framework\View\Element\Template\File

Edit Validator.php

$realPath = $this->fileDriver->getRealPath($path);

Replace with this code:

$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));

Or just copy-paste the below code

protected function isPathInDirectories($path, $directories)
{
if (!is_array($directories)) {
$directories = (array)$directories;
}
$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));
foreach ($directories as $directory) {
if (0 === strpos($realPath, $directory)) {
return true;
}
}
return false;
}

Now, Save this file.

Then, go to the app/etc/di.xml in the editor,

– Find the path

“Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink”

and replace to

“Magento\Framework\App\View\Asset\MaterializationStrategy\Copy”

Save the file.

Next, you will need to run the below commands to upgrade the database and deploy static view files

php bin/magento indexer:reindex

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy -f

Indexing and Upgradation While Magento 2.4.3 Installation Steps

Now when all the commands run correctly, you will need to resize the image,

clear the face after running the command

php bin/magento cache:flush

then run the command below to resize the image,

php bin/magento catalog:images:resize

Now open your store in browser.

Fronend Magento Loading

 

Solution of Magento 2.4.3 Admin Login Issue

Failed to send the message please contact the administrator.

You need to configure two-factor authorization in order to proceed with your store admin.

Admin Login Two Factor Issue While Magento 2.4.3 Installation

Now Resolve Magento 2 Login Issue After fresh installation of Magento 2.4.3 via the following command line.

php bin/magento module:disable Magento_TwoFactorAuth

All the upcoming versions of Magento 24 have been made more secure. Inside this security is the step-to-step verification.

Disable 2 Factor Authentication

Now open your admin URL, the issue has been resolved successfully.

Admin Login Issue Resolve

As soon as you go to the bottommost section of the dashboard, you will see on the right side corner that Magento is 2.4.1-p1 version.

Admin Mageno 2.4.3p1

 

Conclusion

Magento 2.4.3 version is a bit complicated for those who are not very technically aware.

Although the installation has been removed from it through the graphical user interface, due to this also it has become a bit more complicated.

But still, you can install Magento 2.4 version successfully using the XAMPP server on the Windows operating system.

 

Recommended Post:

Magento 2.4 Installation Guide: How to Install Magento 2.4.2

Page Builder Editor: How to Change Editor in Magento 2