How to Decrease Bounce Rate of E-Commerce Website

The bounce rate of any website shows how is the quality of the content of that website, so the content quality of your website has to be good so that the bounce rate can be reduced, in this post I will explain how to decrease bounce rate of the website.

 

What is Bounce Rate?

Bounce rate means that when a visitor visits the site and they exit from the same page without visiting any other page, then it is called bounce rate.

This means the percentage of total visitors that are single-page sessions in which visitors leave without clicking on the link from the same page and leave the same page after visiting the page.

The bounce rate increases because of the poor engagement of the page of the website.

Check the Bounce Rate
Alexa.com Site Matrices

 

Read more: Top 7 Reasons That Leads Increase Bounce Rate of Website

 

How to Decrease Bounce Rate?

To reduce the bounce rate of your website, you will have to take the help of some important tools, which will tell where your website is lacking.

With the help of tools, you can measure the activities of your website such as website loading time, interactive link added, title heading description, etc. to be optimized properly.

 

Step 1: Increase Loading Speed

The bounce rate of any website also depends a lot on the loading speed of the website.

If your website is loading slowly, then the customer will leave your page immediately.

So if you want your visitor to stay on your page and the bounce rate is not high, then for that, you have to increase the speed of your website.

Website loading has to be done within 1 second.

You can take a maximum of 2 seconds to 3 seconds, but if you exceed this, the chances of increasing the bounce rate of your website will increase significantly.

 

Step 2: Add Interactive Links in Pages

The more interactive links there are in any page content, the more interactive the visitor will be with your page content.

 

Read more: Top 9 Free Tools To Analyze Your Website in 2022

 

Step 3: Use Analytics

Google Analytics is one such free tool that proves helpful in reducing your bounce rate. This is a tool that analyzes your pages in order to decrease the bounce rate of each of your pages.

Analytics gives you real-time data with the help of which you can track your visitor when the visitor is leaving your website.

When you look at the real-time visitors, then you will see the flaw of your page, with the help of which you can remove that flaw and reduce the bounce rate.

Decrease Bounce Rate by Google Analytics
Google Analytics Real-Time Data

 

Step 4: Evaluate Quality Content

The better the content, the better will be your customer engagement.

When customer engagement is good, then the bounce rate of the website will also decrease.

Therefore, the title, keywords, description, and page content of any page should be well optimized.

Need to well optimize the following points:

  • Don't keep the title too long
  • Optimize headings for main keywords
  • Keep phrases short
  • Improve internal linking

 

Step 5: Description and Title Should be Not Misleading

The page content description should be very well optimized, not that the page content is something else and you have put something else in the description.

If this happens then it will be a miss leading content and then when the customer visits your page then the content will not be relevant to him then your website bounce will increase.

For this, you have to select the right and perfect keyboard set for the most relevant keyboard so that your content matches it.

 

Step 6: Add Most Relevant Backlink

The backlink of the website should be absolutely relevant, if there is not even a little relevant then the chances of your bounce rate increase.

So whenever you add a  backlink, you have to keep in mind whether this backlink is in the most relevant backlink or not, then only add it.

Add Backlinks of Website
Referred Links

 

Read more: Top 10 Tools to Drive Traffic on Your Websites in 2022

 

Step 7: Improve Device Friendly Experience

You will have to test how your website looks on different devices.

If someone is opening that website on mobile, then how is your content appearing, if the same content is being opened on the desktop then how is it looking, you have to make all these things device friendly.

Your content should be optimized for every device and should be friendly.

The bounce rate of your website will decrease when your content provides a good experience on all types of devices.

Device Friendly Decrease Bounce Rate
Improve Device Friendly Experience

 

Step 8: Increase The Visitor Engagement Level

Content must be strong. The better the content, the greater the engagement between your website and the visitor.

To keep the customer engaged, you have to put good quality content and also add interrelated links, only then your customer engagement will increase, and the bounce rate will decrease.

 

Google Analytics Count

The way Google Analytics calculates the bounce rate is slightly different.

When a customer visits your page and if visitors leave without clicking any link, then Google Analytics will consider you the bounce rate for that page of the website.

It doesn't matter for google analytics whether the visitors spend a considerable amount of time on that page or not.

 

Decrease Bounce Rate Service for My Websites

If you want to reduce the bounce rate of your website and are looking for a service for this, then we will fulfill that search.

We guarantee to bring down the bounce rate of any website between 20 to 30% at very affordable rates.

For this you can contact us, you can mail us and you can talk to us on the contact number.

Email: cs.hemantsingh@gmail.com

Contact Number: +91-7992293862

 

Conclusion

The low bounce rate of any website shows its quality. A low bounce rate indicates that the customer engagement is very good on your website and your content is very good.

Customer Account REST APIs With Example in Magento 2

For any new customer of the Magento 2 eCommerce website from creating an account to deleting the account, the details of any customer account rest apis required are being given in this post.

In this Customer API List, I am telling you in detail about each API.

I'll run each endpoint on Postman to show you an example of how each of the customer's APIs works.

Customer Account REST APIs
Customer APIs

 

List of Magento 2 Customer Account REST APIs

By the way, there are only a few customer rest APIs in Magento 2 which we frequently use.

It also depends on the function of our mobile application and what kind of functionality we want to provide to our customers.

Based on that, I am giving you the details of the Most Frequently Used Rest API, which has been prepared as an index in a way.

With this list of Magento 2's Customer Rest APIs, it will be easier for you to develop mobile applications.

 

1. Get Customer Details By Customer ID

This rest api will help you to get the customer account information by the getById service method.

Endpoint:

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

Method: GET

Headers:

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

 

2. Create Customer Account REST APIs

You need to use this REST API to create a new customer account. This is the REST API for Magento 2's default customer account creation.

Endpoint:

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

Method: POST

Header:

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

Create customer api detail with parameter

 

3. Save Customer Information API

When data is to be saved based on customer id then we save data by sending payload in Magento 2 customer rest api.

Endpoint:

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

Method: PUT

Header:

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

 

4. Customer API to Save Data

If Magento 2 customer data has to be saved without customer id then we use this rest api.

And also send the customer token in the header as authorization.

Endpoint:

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

Method: PUT

Header:

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

 

5. Get Customer Information REST API

In Magento 2 store we use this api when we have to get customers' data.

In this, only we have to send the customer's token by putting it in the header and then we get all the details of the customer.

We have to gate all the details of the customer with only the login details of the customer, even then on the basis of this get by ID, we gate the information through this API.

Endpoint:

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

Method: GET

Header:

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

 

6. Activate Customer ID via REST API

We use this api in Magento 2 to activate the customer id by activateById.

Endpoint:

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

Method: PUT

Header:

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

 

7. Search Customer REST API

This api help to get the list of the customer by the getList service method.

Endpoint:

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

Method: GET

Header:

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

 

8. Activate Customer Email API

To activate the email id of the customer of magento 2, we use this rest api.

Endpoint:

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

Method: GET

Header:

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

 

9. Change Customer Password REST API

Magento 2 Store by default provides REST API to change the password of the customer, using changePasswordById one can change the password of any customer account.

Endpoint:

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

Method: PUT

Header:

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

 

10. Send Customer Password Lest Link API

Using the customer's token to send the reset password link to the customer's mail id, we use the validateResetPasswordLinkToken API.

Endpoint:

<host>/rest/<store_code>/V1/customers/:customerId/password/resetLinkToken/:resetPasswordLinkToken

Method: GET

Header:

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

 

11. Initiate Customer REST Password API

If the API is to be used to initiate the password reset, then we can change the password of any customer using this initiatePasswordReset API.

Endpoint:

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

Method: PUT

Header:

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

 

12. Reset Password API

In this API, you have to enter the old password of the customer along with the new password that you want to select and hit it with the admin token.

Endpoint:

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

Method: POST

Header:

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

 

13. Confirm Customer Account API

When a customer creates an account on the Magento store then we can choose the account confirmation or rejections option from the admin.

And after selecting the same option, you can use the API to get the confirmation status of the customer via rest api in Magento 2.

Endpoint:

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

Method: GET

Header:

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

 

14. Customer Account Confirmation API

And after selecting the customer account confirmation option, you can use this API to resend confirmation and validate the account status of any customer through the rest of the API.

Endpoint:

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

Method: POST

Header:

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

 

15. Validate Customer Account API

This api provides a facility to validate any customer account by this any customer account can be validated through the rest api.

Endpoint:

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

Method: PUT

Header:

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

 

16. Read-Only Customer Account API

You can get the customer detail like isReadonly or not.

Endpoint:

<host>/rest/<store_code>/V1/customers/:customerId/permissions/readonly

Method: GET

Header:

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

 

17. Delete Customer By ID REST API

Magento2 also provides the facility of default rest api to delete customer accounts based on id. Using this, you can delete any customer on the basis of a customer ID.

Endpoint:

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

Method: DELETE

Header:

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

 

18. Check Email Available or not Via REST API

When creating a customer account, we have to check the email id.

Now if you want to check customer email id whether it is available or not then you can use this isEmailAvailable REST API for that.

Endpoint:

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

Method: POST

Header:

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

 

 

References:

https://magento.stackexchange.com/

https://devdocs.magento.com/

Magento 2 All REST API List for Mobile App Development

There is no documentation in Magento where you can see the complete Magento 2 All REST APIs of catalog, customer, and checkout at one place.

If you look at the documentation on the official website of Magento, you will find that you can get the list of all APIs using Document Swagger.

But this documentation keeps so many details together that we find it a bit complicated and sometimes we are not able to extract the important things.

I am solving your problem through this documentation where you will get the list of default api of Magento with body details.

In this, you will see as much detail as you need and I have removed the things which are not needed.

All the components that are there by default like Catalog APIs, Customer APIs, Checkout APIs, CMS APIs, Payment APIs, Reviews APIs, Shipping APIs, Wishlist APIs, etc. I am giving all the list here.

Magento 2 All REST APIs List

 

Magento 2 All REST APIs List for Catalog

All the necessary APIs for the catalog will be available to you through this.

For this, what endpoint do you need and the payload that we send in the body so that we can save the data?

  1. Product Service APIs
  2. Tier Price APIs
  3. Product Custom Options APIs
  4. Product Links APIs
  5. Category Product Links APIs
  6. Product Website Links APIs

 

Read more: Best 3 Simple Ways to Upgrade Magento 2 Store in 2022

 

Customer APIs List

In this list, we have prepared the details of all the endpoints of the customer API, such as how to get the metadata of a customer, you will get the details of all the APIs of the customer group.

To get data of customer account via api or delete or save any information, the endpoint of API and payload with complete details is mentioned.

List of customer APIs that are available in Magento 2 default.

  1. Group APIs of Customer
  2. Metadata APIs of Customer
  3. Customer Address Metadata APIs
  4. Magento 2 Customer Account APIs
  5. Addresses APIs for Customer

 

Checkout REST APIs List in Magento 2

How do you add to the cart through REST API for Magento 2 customers? Perform an action for all the functionalities of the mini cart like update the price, update the content, or arrive at the checkout, its API endpoint indexed here As stated.

Receive data or save data on the checkout page, update price, or place an order.

To perform all these processes through the API, you will get a list that is prepared like a dictionary.

You won't need to do much research, everything is explained in step by step order.

This checkout API's default index is created so that any developer can easily use this list to create their own mobile application

  1. Shipping guest information
  2. My shipping information
  3. Shipping information
  4. Totals information
  5. Guest totals information
  6. Managing My totals information
  7. Guest place order with payment information saving
  8. My place order with payment information saving
  9. Get payment information
  10. Managing payment guest information
  11. My payment information

 

References

https://magento.stackexchange.com/

https://devdocs.magento.com/

Best 3 Simple Ways to Upgrade Magento 2 Store in 2022

I am explaining you to the best 3 simple ways to upgrade your Magento 2 e-commerce store.

It is important for any eCommerce store to give a better experience to its customers, as well as keeping the data of the store and its customers safe is also very important.

In this episode comes a step that also includes keeping your Magento e-commerce store up to date which is a very important step to maintain the high-security level.

I am telling you the best and easiest way to upgrade your Magento store, with the help of which you can upgrade your store.

The easiest and safest way to upgrade a live website is to create a clone website of your website or keep a complete backup of your live website only then follow the up-gradation step.

 

Basic Steps to update Magento 2 - 3 Simple Ways to Upgrade

There are five basic steps to update Magento 2 store.

Step 1: Take Complete Backup of your store

Step 2: Enable maintenance mode

Step 3: Select Magento 2 Version

Step 4: Run Composer update Command

Step 5: Check the current Magento 2’s version

 

Method 1: Composer Upgradation

You can take the help of a composer to upgrade your Magento 2 store.
To update the Magento website through composer, you need to install composer first.

Then the version you want to update from will have to be mentioned in the composer upgrade.

Then after that composer version, no upgrade command has to be run.

You can check the complete step-by-step guide to upgrade your Magento 2 store through composer in detail.

 

Step 1: Change The Store Mode

In order to upgrade the magento store, you have to change the mode into maintenance.

php bin/magento maintenance:enable

 

Step 2: Mention Your Version

composer require <product> <version> —no-update

Now run the below command

composer update

Example:

Suppose you want to upgrade your Magento 2 store to Magento 2 CE 2.4.3-p1 Then use the command as in the example:

composer require magento/product-community-edition 2.4.3 —no-update

Composer Upgradation Magento 2

Then,

composer update

Best 2 Simple Ways to Upgrade Store

Similarly, you can follow this step to upgrade to any version of the Magento store.

Now run the below command

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy

php bin/magento cache:clean

php bin/magento indexer:reindex

 

Step 3. Disable the Maintenance Mode

Now, you can disable the maintenance mode and put your store back to work by running the command:

php bin/magento maintenance:disable

 

Method 2: Upgrade Magento 2 Store Manually

The third way is to go to the Magento store and download the latest Magento version from there.

Then extract it and paste it in the root directory of your Magento store and if any file or folder is asking to replace then replace it.
After this, now you run the setup upgrade command, then compile it and then deploy it.

After this do the indexing, now you flush all the cache of the store, your store has been upgraded.

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy

php bin/magento cache:clean

php bin/magento indexer:reindex

manual update Magento 2 Store

If even after this your store is not showing Upgraded then run the below command and then run all the above commands one by one.

Now you can check your Magento 2 store by opening the browser you can see that your store has been upgraded without internet.

rm -rf var/cache/ var/generation/ var/page_cache/ var/view_preprocessed/

And then run above command again.

 

Method 3: Web Step Wizard Upgradation

Now the last method is to use the web setup wizard for the up-gradation.

This upgrade step is simple for those who are not able to use Magento 2 Composer in a better way.

 

Step 1: Login into Magento 2 Admin

For this, you have to log in to your magento 2 admin and go to system tools and click on the web setup wizard.

You should have administrator access for your admin user.

System > Tools > Web Setup Wizard

 

Step 2. Fill System Configuration Details

Now you have to enter the authentication key of the marketplace, after that, you have to save and proceed to the next stage.

 

Step 3. Save config and then System Upgrades

In the meantime, the Marketplace may ask you to update other technologies and tools, such as updating the PHP version.

And may also ask you to update your database version.

For this, it is better that you keep both versions updated only then you can go to the next step.

Note: Please take backup of your store before upgradation.

 

 

Check Store Version - 3 Simple Ways to Upgrade

Now you can check the store version via the following Magento 2 command.

php bin/magento --version

 

Upgrade Magento 2 Store Service in 2022

If you also want to update your Magento 2 website at a very cheap price, then you can contact us for this.

We update the Magento 2 store with complete database backup at very cheap rates in 2022.

For this you do not need to pay any extra charge, we keep a complete backup of your store and you will get your store updates within 6 hours.

 

Recommended Posts:

Website Speed Optimization: How to Make Website Faster

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

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