{"id":7586,"date":"2020-03-30T10:58:54","date_gmt":"2020-03-30T05:58:54","guid":{"rendered":"https:\/\/thedevcouple.com\/?p=7586"},"modified":"2020-06-30T10:59:23","modified_gmt":"2020-06-30T05:59:23","slug":"ipstack-api-for-ecommerce","status":"publish","type":"post","link":"https:\/\/thedevcouple.com\/ipstack-api-for-ecommerce\/","title":{"rendered":"IPStack API Aims to Deliver an Incredible Experience for e-Commerce Applications"},"content":{"rendered":"<p>How amazing it would be if you can show products in your e-commerce application according to the location of your audience. How it would stand you out from the rest of the competition. Today, I am going to talk about an API that provides location information of your visitors and much. I am also going to show you how you can use it in your e-commerce application. So without any further ado, let&#8217;s jump in!<\/p>\n<div class=\"eckosc eckosc_full_width_block\">\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-7601\" src=\"https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1.png\" alt=\"ipstack-cover\" width=\"3543\" height=\"2365\" srcset=\"https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1.png 3543w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1-300x200.png 300w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1-1024x684.png 1024w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1-768x513.png 768w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1-1536x1025.png 1536w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1-2048x1367.png 2048w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1-1920x1282.png 1920w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1-1680x1121.png 1680w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1-1240x828.png 1240w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1-860x574.png 860w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1-680x454.png 680w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1-500x334.png 500w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1-400x267.png 400w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1-250x167.png 250w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1-200x134.png 200w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1-100x67.png 100w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1-76x51.png 76w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/cover-1-50x33.png 50w\" sizes=\"(max-width: 3543px) 100vw, 3543px\" \/><\/p>\n<\/div>\n<h2><b>\ud83d\udccd ipstack<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Started with a different name in 2009, <a href=\"http:\/\/ipstack.com\/\" rel=\"nofollow noopener\" target=\"_blank\">ipstack<\/a> was a community funded open-source project that offered software developers an API that gave the geolocation information of any IP address. Fast forward to eleven years later, the API was rebuilt into a fully-fledged IP geolocation platform. Currently, ipstack is serving the needs of 100k+ satisfied customers.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><a href=\"http:\/\/ipstack.com\/\" rel=\"nofollow noopener\" target=\"_blank\">ipstack<\/a> API service allows you to get the location of website visitors at a stage before any data is entered into the system. This location data then helps you customize content on your website according to your visitor\u2019s location. The data also help you assess risks and potential threats to your web application in time.<\/span><\/p>\n<h2><b>\ud83d\udd17 API Endpoints<\/b><\/h2>\n<p><span style=\"font-weight: 400;\"><a href=\"http:\/\/ipstack.com\/\" rel=\"nofollow noopener\" target=\"_blank\">ipstack<\/a> provides three types of endpoints that let you choose their services according to your need. The base URL is <\/span><a href=\"https:\/\/api.ipstack.com\/\" rel=\"nofollow noopener\" target=\"_blank\"><i>https:\/\/api.ipstack.com\/<\/i><\/a>. <span style=\"font-weight: 400;\">Now I am going to discuss each of them in detail.<\/span><\/p>\n<h3><b>\ud83d\udccc Standard Lookup<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">The first one on the list is standard lookup which gives you the power to get the location data of any IP address. The only thing you need to do is add the IP address and your ipstack access key after the base URL.<\/span><\/p>\n<pre class=\"eckosc_syntax eckosc_syntax_theme_dark\"><code>GET http:\/\/api.ipstack.com\/134.201.250.155?access_key=YOUR_ACCESS_KEY<\/code><\/pre>\n<p><span style=\"font-weight: 400;\">Once you will hit this API endpoint, you will get the following information.<\/span><\/p>\n<pre class=\"eckosc_syntax eckosc_syntax_theme_dark\"><code>{\n\n\u00a0\u00a0\"ip\": \"134.201.250.155\",\n\n\u00a0\u00a0\"type\": \"ipv4\",\n\n\u00a0\u00a0\"continent_code\": \"NA\",\n\n\u00a0\u00a0\"continent_name\": \"North America\",\n\n\u00a0\u00a0\"country_code\": \"US\",\n\n\u00a0\u00a0\"country_name\": \"United States\",\n\n\u00a0\u00a0\"region_code\": \"CA\",\n\n\u00a0\u00a0\"region_name\": \"California\",\n\n\u00a0\u00a0\"city\": \"Los Angeles\",\n\n\u00a0\u00a0\"zip\": \"90013\",\n\n\u00a0\u00a0\"latitude\": 34.0453,\n\n\u00a0\u00a0\"longitude\": -118.2413,\n\n\u00a0\u00a0\"location\": {\n\n\u00a0\u00a0\u00a0\u00a0\"geoname_id\": 5368361,\n\n\u00a0\u00a0\u00a0\u00a0\"capital\": \"Washington D.C.\",\n\n\u00a0\u00a0\u00a0\u00a0\"languages\": [\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"code\": \"en\",\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"name\": \"English\",\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"native\": \"English\"\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0],\n\n\u00a0\u00a0\u00a0\u00a0\"country_flag\": \"https:\/\/assets.ipstack.com\/images\/assets\/flags_svg\/us.svg\",\n\n\u00a0\u00a0\u00a0\u00a0\"country_flag_emoji\": \"\ud83c\uddfa\ud83c\uddf8\",\n\n\u00a0\u00a0\u00a0\u00a0\"country_flag_emoji_unicode\": \"U+1F1FA U+1F1F8\",\n\n\u00a0\u00a0\u00a0\u00a0\"calling_code\": \"1\",\n\n\u00a0\u00a0\u00a0\u00a0\"is_eu\": false\n\n\u00a0\u00a0},\n\n\u00a0\u00a0\"time_zone\": {\n\n\u00a0\u00a0\u00a0\u00a0\"id\": \"America\/Los_Angeles\",\n\n\u00a0\u00a0\u00a0\u00a0\"current_time\": \"2018-03-29T07:35:08-07:00\",\n\n\u00a0\u00a0\u00a0\u00a0\"gmt_offset\": -25200,\n\n\u00a0\u00a0\u00a0\u00a0\"code\": \"PDT\",\n\n\u00a0\u00a0\u00a0\u00a0\"is_daylight_saving\": true\n\n\u00a0\u00a0},\n\n\u00a0\u00a0\"currency\": {\n\n\u00a0\u00a0\u00a0\u00a0\"code\": \"USD\",\n\n\u00a0\u00a0\u00a0\u00a0\"name\": \"US Dollar\",\n\n\u00a0\u00a0\u00a0\u00a0\"plural\": \"US dollars\",\n\n\u00a0\u00a0\u00a0\u00a0\"symbol\": \"$\",\n\n\u00a0\u00a0\u00a0\u00a0\"symbol_native\": \"$\"\n\n\u00a0\u00a0},\n\n\u00a0\u00a0\"connection\": {\n\n\u00a0\u00a0\u00a0\u00a0\"asn\": 25876,\n\n\u00a0\u00a0\u00a0\u00a0\"isp\": \"Los Angeles Department of Water &amp; Power\"\n\n\u00a0\u00a0}\n\n}<\/code><\/pre>\n<h3>\ud83d\udca1 Bulk Lookup<\/h3>\n<p><span style=\"font-weight: 400;\">This endpoint allows its users to get location data of multiple IP addresses with a single API call. All you need to do is put all the IPs together with a comma between them and you are good to go.<\/span><\/p>\n<pre class=\"eckosc_syntax eckosc_syntax_theme_dark\"><code>GET http:\/\/api.ipstack.com\/134.201.250.155,72.229.28.185,110.174.165.78?access_key=YOUR_ACCESS_KEY<\/code><\/pre>\n<p>You will get an array of objects as a response. Each object contains the location information of the IP address that was put in the API.<\/p>\n<pre class=\"eckosc_syntax eckosc_syntax_theme_dark\"><code>[\n  {\n    \"ip\": \"134.201.250.155\",\n    \"type\": \"ipv4\",\n    \"continent_code\": \"NA\",\n    \"continent_name\": \"North America\",\n    \"country_code\": \"US\",\n    \"country_name\": \"United States\",\n    \"region_code\": \"CA\",\n    \"region_name\": \"California\",\n    \"city\": \"Los Angeles\",\n    \"zip\": \"90013\",\n    \"latitude\": 34.0453,\n    \"longitude\": -118.2413,\n    \"location\": { ... },\n    \"time_zone\": { ... },\n    \"currency\": { ... },\n    \"connection\": { ... },\n  },\n  {\n    \"ip\": \"72.229.28.185\",\n    \"type\": \"ipv4\",\n    \"continent_code\": \"NA\",\n    \"continent_name\": \"North America\",\n    \"country_code\": \"US\",\n    \"country_name\": \"United States\",\n    \"region_code\": \"NY\",\n    \"region_name\": \"New York\",\n    \"city\": \"New York\",\n    \"zip\": \"10036\",\n    \"latitude\": 40.7605,\n    \"longitude\": -73.9933,\n    \"location\": { ... },\n    \"time_zone\": { ... },\n    \"currency\": { ... },\n    \"connection\": { ... },\n  },\n  {\n    \"ip\": \"110.174.165.78\",\n    \"type\": \"ipv4\",\n    \"continent_code\": \"OC\",\n    \"continent_name\": \"Oceania\",\n    \"country_code\": \"AU\",\n    \"country_name\": \"Australia\",\n    \"region_code\": \"NSW\",\n    \"region_name\": \"New South Wales\",\n    \"city\": \"Coffs Harbour\",\n    \"zip\": \"2450\",\n    \"latitude\": -30.2963,\n    \"longitude\": 153.1135,\n    \"location\": { ... },\n    \"time_zone\": { ... },\n    \"currency\": { ... },\n    \"connection\": { ... },\n  }\n]<\/code><\/pre>\n<h3>\ud83c\udfaf Requester IP Lookup<\/h3>\n<p>The ipstack API also offers a separate API endpoint capable of detecting the IP address which the current API request is coming from. In order to use this endpoint, simply append <strong>check<\/strong> to the API&#8217;s base URL and specify your preferred optional parameters.<\/p>\n<pre class=\"eckosc_syntax eckosc_syntax_theme_dark\"><code>GET http:\/\/api.ipstack.com\/check?access_key=YOUR_ACCESS_KEY<\/code><\/pre>\n<p>You will get a response somewhat like the one below.<\/p>\n<pre class=\"eckosc_syntax eckosc_syntax_theme_dark\"><code>{\n  \"ip\": \"155.52.187.7\",\n  \"type\": \"ipv4\",\n  \"continent_code\": \"NA\",\n  \"continent_name\": \"North America\",\n  \"country_code\": \"US\",\n  \"country_name\": \"United States\",\n  \"region_code\": \"MA\",\n  \"region_name\": \"Massachusetts\",\n  \"city\": \"Boston\",\n  \"zip\": \"02115\",\n  \"latitude\": 42.3424,\n  \"longitude\": -71.0878,\n  \"location\": {\n    \"geoname_id\": 4930956,\n    \"capital\": \"Washington D.C.\",\n    \"languages\": [\n        {\n          \"code\": \"en\",\n          \"name\": \"English\",\n          \"native\": \"English\"\n        }\n    ],\n    \"country_flag\": \"https:\/\/assets.ipstack.com\/images\/assets\/flags_svg\/us.svg\",\n    \"country_flag_emoji\": \"\ud83c\uddfa\ud83c\uddf8\",\n    \"country_flag_emoji_unicode\": \"U+1F1FA U+1F1F8\",\n    \"calling_code\": \"1\",\n    \"is_eu\": false\n  },\n  \"time_zone\": {\n    \"id\": \"America\/New_York\",\n    \"current_time\": \"2018-03-30T07:54:25-04:00\",\n    \"gmt_offset\": -14400,\n    \"code\": \"EDT\",\n    \"is_daylight_saving\": true\n  },\n  \"currency\": {\n    \"code\": \"USD\",\n    \"name\": \"US Dollar\",\n    \"plural\": \"US dollars\",\n    \"symbol\": \"$\",\n    \"symbol_native\": \"$\"\n  },\n  \"connection\": {\n    \"asn\": 40127,\n    \"isp\": \"Longwood Medical and Academic Area (LMA)\"\n  }\n}<\/code><\/pre>\n<h2>\ud83d\uded2 IPStack API For eCommerce<\/h2>\n<p>In 2020, there are loads of e-commerce applications available on the Internet. This much saturation ultimately leads to competition. If your application is just like the rest then it will not stand out. If it does not stand out then probably it will not be a success.<\/p>\n<p>What if you can offer a discount on your products depending upon the location of your audience. This will be a huge game-changer for you. Fortunately, <a href=\"http:\/\/ipstack.com\/\" rel=\"nofollow noopener\" target=\"_blank\">ipstack<\/a> makes it extremely easy for you to develop just this unique feature. \u26a1\ufe0f<\/p>\n<p>I have built a small web application that shows its visitor the country they are residing in. I have used ipstack API to get the visitor&#8217;s location.<\/p>\n<div class=\"eckosc eckosc_full_width_block\">\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-7602\" src=\"https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/where_are_you_from_thedevcouple.png\" alt=\"Where Are You From Thedevcouple\" width=\"1440\" height=\"811\" srcset=\"https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/where_are_you_from_thedevcouple.png 1440w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/where_are_you_from_thedevcouple-300x169.png 300w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/where_are_you_from_thedevcouple-1024x577.png 1024w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/where_are_you_from_thedevcouple-768x433.png 768w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/where_are_you_from_thedevcouple-1240x698.png 1240w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/where_are_you_from_thedevcouple-860x484.png 860w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/where_are_you_from_thedevcouple-680x383.png 680w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/where_are_you_from_thedevcouple-500x282.png 500w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/where_are_you_from_thedevcouple-400x225.png 400w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/where_are_you_from_thedevcouple-250x141.png 250w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/where_are_you_from_thedevcouple-200x113.png 200w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/where_are_you_from_thedevcouple-100x56.png 100w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/where_are_you_from_thedevcouple-76x43.png 76w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/where_are_you_from_thedevcouple-50x28.png 50w\" sizes=\"(max-width: 1440px) 100vw, 1440px\" \/><\/p>\n<\/div>\n<p>Now I am going to explain to you how I brought this application into existence.<\/p>\n<h3>\ud83e\uddd0 How it works!?<\/h3>\n<p>Let&#8217;s do this in steps so you can understand it more clearly.<\/p>\n<h4><b>\u2192 Step #1<\/b><\/h4>\n<p>You need the ipstack API to get your visitor&#8217;s location. So head over to the website. If you are only testing the API then go for the free API key. You can get that by navigating to the pricing page.<\/p>\n<div class=\"eckosc eckosc_full_width_block\">\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-7603\" src=\"https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple.png\" alt=\"Price Page Thedevcouple\" width=\"1440\" height=\"811\" srcset=\"https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple.png 1440w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-300x169.png 300w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-1024x577.png 1024w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-768x433.png 768w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-1240x698.png 1240w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-860x484.png 860w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-680x383.png 680w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-500x282.png 500w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-400x225.png 400w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-250x141.png 250w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-200x113.png 200w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-100x56.png 100w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-76x43.png 76w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-50x28.png 50w\" sizes=\"(max-width: 1440px) 100vw, 1440px\" \/><\/p>\n<\/div>\n<h4><b>\u2192 Step #2<\/b><\/h4>\n<p>On the pricing page, you will see that there are five packages, i.e., one free package, three paid packages, and one custom package. Select the free package. You will be directed to sign up.<\/p>\n<p>Once you have signed up, you will be directed to a dashboard. There you will see your API access key. This might be the most important thing on your dashboard. Copy it!<\/p>\n<div class=\"eckosc eckosc_full_width_block\">\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-7604\" src=\"https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-dashboard-thedevcouple.png\" alt=\"Ipstack Dashboard Thedevcouple\" width=\"1440\" height=\"811\" srcset=\"https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-dashboard-thedevcouple.png 1440w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-dashboard-thedevcouple-300x169.png 300w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-dashboard-thedevcouple-1024x577.png 1024w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-dashboard-thedevcouple-768x433.png 768w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-dashboard-thedevcouple-1240x698.png 1240w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-dashboard-thedevcouple-860x484.png 860w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-dashboard-thedevcouple-680x383.png 680w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-dashboard-thedevcouple-500x282.png 500w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-dashboard-thedevcouple-400x225.png 400w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-dashboard-thedevcouple-250x141.png 250w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-dashboard-thedevcouple-200x113.png 200w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-dashboard-thedevcouple-100x56.png 100w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-dashboard-thedevcouple-76x43.png 76w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-dashboard-thedevcouple-50x28.png 50w\" sizes=\"(max-width: 1440px) 100vw, 1440px\" \/><\/p>\n<\/div>\n<h4><b>\u2192 Step #3<\/b><\/h4>\n<p>I am a React.js fan. So to build this location tracker, I created a React.js app using\u00a0<em>npx create-react-app app_name<\/em>. This is the code I wrote in the\u00a0<strong>App.js<\/strong>\u00a0that made the above application possible.<\/p>\n<pre class=\"eckosc_syntax eckosc_syntax_theme_dark\"><code>import React, { useState, useEffect } from \"react\";\nimport axiox from \"axios\";\nimport \".\/App.css\";\n\nfunction App() {\n  const [countryInfo, setCountryInfo] = useState(\"\");\n  const [location, setLocation] = useState(\"\");\n\n  useEffect(() =&gt; {\n    (async () =&gt; {\n      const { data } = await axiox.get(\n        \"http:\/\/api.ipstack.com\/check?access_key=YOUR_API_ACCESS_KEY\",\n      );\n      setCountryInfo(data);\n      setLocation(data.location);\n    })();\n  }, []);\n\n  return (\n    &lt;div className=\"container\"&gt;\n      &lt;div className=\"countryInfo\"&gt;\n        &lt;p&gt;\n          {` You are living in ${countryInfo.country_name} ${location.country_flag_emoji}`}\n        &lt;\/p&gt;\n      &lt;\/div&gt;\n    &lt;\/div&gt;\n  );\n}\n\nexport default App;\n<\/code><\/pre>\n<p>The first thing I did was to install\u00a0<strong>axios<\/strong> package to make the API call. Then I imported React hooks, i.e., useState and useEffect. I made the API call in the useEffect hook and using object destructuring extracted\u00a0<strong>data\u00a0<\/strong>object from the response. Lastly, I used the useState hook to save the data object in the state.<\/p>\n<p>This data object contains the location information of your website&#8217;s visitor. I simply used this information to extract the country information and displayed it on the screen. That&#8217;s it. \ud83d\udcaf<\/p>\n<p>Now you know how easy it is to use <a href=\"http:\/\/ipstack.com\/\" rel=\"nofollow noopener\" target=\"_blank\">ipstack<\/a> API in your e-commerce application and customize the content, offer discounts, and much more according to your visitor&#8217;s location.<\/p>\n<h3>\ud83d\ude80 Performance<\/h3>\n<p>The performance of an API is extremely important as in many cases the data it provides us is directly being used in the application. If there is any lag whatsoever, your website performance can be affected. Companies such as Microsoft, Samsung, Airbnb, etc are using ipstack API. So it must be extremely fast.<\/p>\n<p>I am doing a performance test using Postman. I have run several tests with different API addresses. The following is the result I acquired. These results are the average of many tests I performed.<\/p>\n<div class=\"eckosc eckosc_contrast_block\"><div class=\"eckosc_contrast_block_inner\">\n<p style=\"text-align: center;\">\ud83d\udca1<\/p>\n<ul>\n<li>\u26a1\ufe0f On the first test, I received a response time of <strong>413ms\u00a0<\/strong>which is quite decent.<\/li>\n<li>\ud83d\ude80 I then used different IP addresses and I observed an average response time of <strong>385ms.<\/strong><\/li>\n<li>\ud83d\udd25 I also used <strong>check<\/strong> endpoint and the response time was <strong>398ms<\/strong>.<\/li>\n<\/ul>\n<\/div><\/div>\n<p>385ms average response time is extremely impressive for an API of this scale. This again justifies that ipstack API will be the perfect location tracking API for your e-commerce application.<\/p>\n<div class=\"eckosc eckosc_full_width_block\">\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-7605\" src=\"https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-performance.png\" alt=\"Ipstack Performance\" width=\"1440\" height=\"811\" srcset=\"https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-performance.png 1440w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-performance-300x169.png 300w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-performance-1024x577.png 1024w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-performance-768x433.png 768w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-performance-1240x698.png 1240w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-performance-860x484.png 860w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-performance-680x383.png 680w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-performance-500x282.png 500w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-performance-400x225.png 400w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-performance-250x141.png 250w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-performance-200x113.png 200w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-performance-100x56.png 100w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-performance-76x43.png 76w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-performance-50x28.png 50w\" sizes=\"(max-width: 1440px) 100vw, 1440px\" \/><\/p>\n<\/div>\n<h3>\ud83d\udcd6 Documentation<\/h3>\n<p>The next thing that comes to mind is that there should be a complete guide about how to use the API. It can also happen that your e-commerce application is facing some unexpected error or it needs a specific set of options or results from the API. All of this can be easily dealt with if the API has proper documentation.<\/p>\n<p>ipstack is happy to oblige with our needs by providing us with extremely detailed <a href=\"https:\/\/ipstack.com\/documentation\" rel=\"nofollow noopener\" target=\"_blank\">documentation<\/a>. The documentation not only has information about the API endpoints but also includes explanations of the error messages. It explains the error code so that the API users can easily debug what the issue is. \u26a1\ufe0f<\/p>\n<p>The documentation also has an <strong>Options<\/strong> section. This section contains all the options you can add to the API URL to get your desired result. For instance, if you are interested in getting the <a href=\"https:\/\/ipstack.com\/documentation#outputformat\" rel=\"nofollow noopener\" target=\"_blank\">API response as XML<\/a>, you can do that by appending <strong>&amp;output=xml<\/strong> at the end of the API.<\/p>\n<pre class=\"eckosc_syntax eckosc_syntax_theme_dark\"><code>GET http:\/\/api.ipstack.com\/134.201.250.155?access_key=YOUR_API_ACCESS_KEY&amp;output=xml<\/code><\/pre>\n<div class=\"eckosc eckosc_full_width_block\">\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-7606\" src=\"https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-documentation-thedevcouple.png\" alt=\"Ipstack Documentation Thedevcouple\" width=\"1440\" height=\"811\" srcset=\"https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-documentation-thedevcouple.png 1440w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-documentation-thedevcouple-300x169.png 300w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-documentation-thedevcouple-1024x577.png 1024w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-documentation-thedevcouple-768x433.png 768w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-documentation-thedevcouple-1240x698.png 1240w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-documentation-thedevcouple-860x484.png 860w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-documentation-thedevcouple-680x383.png 680w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-documentation-thedevcouple-500x282.png 500w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-documentation-thedevcouple-400x225.png 400w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-documentation-thedevcouple-250x141.png 250w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-documentation-thedevcouple-200x113.png 200w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-documentation-thedevcouple-100x56.png 100w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-documentation-thedevcouple-76x43.png 76w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/ipstack-documentation-thedevcouple-50x28.png 50w\" sizes=\"(max-width: 1440px) 100vw, 1440px\" \/><\/p>\n<\/div>\n<h2>\ud83d\udcb0 Pricing<\/h2>\n<p>ipstack <a href=\"https:\/\/ipstack.com\/product\" rel=\"nofollow noopener\" target=\"_blank\">offers<\/a> three fixed price plans and one custom plan that you can avail according to your need. The three fixed price plans are <strong>Basic, Professional, and Professional Plus.<\/strong>\u00a0 All three of them offer different API features. You also have an option to purchase any of these plans on a yearly basis. A yearly base plan gets you a 20% discount. \ud83e\udd42<\/p>\n<p>On the Basic plan, you get 50,000 API requests\/month, premium support, the location module, SSL encryption, currency, timezone, and connection module. On the Professional plan, you get everything in the Basic plan with addition to 500,000 API requests\/month and bulk endpoint. Last but not least, the Professional Plus plan includes everything that is in the Professional Plan but with a major change. Instead of 500,000 API requests, you get 2M API requests\/month and also security module.<\/p>\n<div class=\"eckosc eckosc_full_width_block\">\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-7603\" src=\"https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple.png\" alt=\"Price Page Thedevcouple\" width=\"1440\" height=\"811\" srcset=\"https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple.png 1440w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-300x169.png 300w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-1024x577.png 1024w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-768x433.png 768w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-1240x698.png 1240w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-860x484.png 860w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-680x383.png 680w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-500x282.png 500w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-400x225.png 400w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-250x141.png 250w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-200x113.png 200w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-100x56.png 100w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-76x43.png 76w, https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/price-page-thedevcouple-50x28.png 50w\" sizes=\"(max-width: 1440px) 100vw, 1440px\" \/><\/p>\n<\/div>\n<h2>\ud83d\ude4c\ud83c\udffb Wrapping Up<\/h2>\n<p><a href=\"http:\/\/ipstack.com\/\" rel=\"nofollow noopener\" target=\"_blank\">ipstack<\/a> is one of the best location tracking API I have worked with. It provides you a lot of amazing features that you can make use of in your product. It has great applications in e-commerce. Getting your user&#8217;s location data can allow you to show them more region-specific content.<\/p>\n<p>It is a blazing fast API. Easy to use. It has great documentation and the price is also very affordable. If you are looking for a location tracking API for your e-commerce application then ipstack might be your best choice. \ud83d\udcaf<\/p>\n<p><i>Have you used IPAPI or any similar service to drill user\u2019s information? Which service did you use and how was your experience? Let us know your thoughts in the comments section below.\u00a0<\/i><\/p>\n<p>Peace! \ud83e\udd1e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>IPStack API for ecommerce applications is one of the best resources to find out the geolocation of your incoming audience. At times, you want to offer a purchasing parity feature for your customers and in that case, you need a handy solution that gets integrated with your online store smoothly. IPStack offers everything you need in this respect.<\/p>\n","protected":false},"author":9,"featured_media":7600,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":""},"categories":[18],"tags":[222,229,228],"coauthors":[214],"jetpack_featured_media_url":"https:\/\/thedevcouple.com\/wp-content\/uploads\/2020\/06\/main-cover-scaled.jpg","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/thedevcouple.com\/api\/wp\/v2\/posts\/7586"}],"collection":[{"href":"https:\/\/thedevcouple.com\/api\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thedevcouple.com\/api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thedevcouple.com\/api\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/thedevcouple.com\/api\/wp\/v2\/comments?post=7586"}],"version-history":[{"count":5,"href":"https:\/\/thedevcouple.com\/api\/wp\/v2\/posts\/7586\/revisions"}],"predecessor-version":[{"id":7617,"href":"https:\/\/thedevcouple.com\/api\/wp\/v2\/posts\/7586\/revisions\/7617"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thedevcouple.com\/api\/wp\/v2\/media\/7600"}],"wp:attachment":[{"href":"https:\/\/thedevcouple.com\/api\/wp\/v2\/media?parent=7586"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thedevcouple.com\/api\/wp\/v2\/categories?post=7586"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thedevcouple.com\/api\/wp\/v2\/tags?post=7586"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/thedevcouple.com\/api\/wp\/v2\/coauthors?post=7586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}