Steps to Verify Woocommerce in Android App

Steps to Verify Woocommerce in Android App
Home » Blog » Steps to Verify Woocommerce in Android App

Steps to Verify Woocommerce in Android App

Steps to Verify Woocommerce in Android App

The most important thing that we are going to share with you guys today, that is how to verify woocommerce in the android app. Let’s check out the steps for Woocommerce authentication in the Android app.

Verify Woocommerce in Android App

WooCommerce Settings

  • Login to a WordPress site, and the menu will be displayed at the left side of the page from there select WooCommerce and select Settings menu under WooCommerce menu.
  • Setting options will appear in the content window select the API tab. Select settings under the API section. Check the Enable REST API checkbox to allow rest API access.
  • Select the Keys/Apps tab under the API section to add a key for the user and click the Add key button, add a description for the key and select user for which key will be generated. Always select Permission as Read/Write to have access to REST API for GET and POST methods.
  • Add key by providing details. And click on the Generate API Key button Consumer key and consumer secret keys will be generated

Android Setting

  • Add scribe library to android project in app/libs folder.
    Add the consumer key and consumer secret key in Strings.xml file
  • Create an oAuth service by providing consumer key and consumer secret key to request oAuth token for authorization.
  • Create an oAuth request with request method:

? For GET method:


? For POST method:


final Object being the JSONOBJECT with all required parameter values to post to API.

  • Send scribe signed requests based on the async http client method to construct a signed request for oAuth service. And send the request to server.

Get Products From Woocommerce Store:

  • Call the products API and pass category IDs in the URL, it will list all products of a category. It might be possible that a category has subcategories in it, in that case, pass all subcategories with the URL and all products for all subcategories mentioned in the URL will be listed
  • In product response each product will have a categories array, will list categories under which the product lies, get the category name or category ID and filter products on subcategory IDs. Suppose Category 1 has three subcategories then pass all three subcategory IDs in products API.

http://your_wordpress_site/wordpress/wp-json/wc/v2/products/?category=26,27,28
Product response will have categories array:

[php]
“categories”: [
{
“id”: 26,
“name”: “Subcategory”,
“slug”: “subcategory”
}
],
[/php]

While displaying subcategory with its products, filter this list based on current subcategory we are displaying.

Let’s create something beautiful and
innovative together! call us now!

Chat with our seniors to see if we have a good match

Comments

21 responses to “Steps to Verify Woocommerce in Android App”
  1. Rahul Bansal Avatar

    Hi avyatech.com
    This is Very Good Article Keep Doing Woorking

    1. Thank you so much, Rahul.

  2. Amit Kapoor Avatar

    Hi,
    Thanks for sharing such type of post.

    1. Your most welcome Amit, Keep subscribe us to get the latest info.

  3. Thanks for a great article

  4. Sanjay Jindal Avatar

    “I have just visited your website, and I think it’s great.”

    1. Thank you for visiting our site.

  5. Rahul Bansal Avatar

    Fantastic Blog! I agree completely with you here. It is a very valuable and helpful collection of blogs. I am trying to gain information from all these. Really helpful post. Thank you..!!

    1. Thank you so much, Rahul, to visit my blog and share your valuable feedback.

  6. thank you for sharing this information

  7. this post is really helpfull for us n thanks for this post.

  8. Amit Kapoor Avatar

    Hi,

    very good information. Thanks for sharing,

  9. Rahul Bansal Avatar

    Nice Blog

  10. Hey What is in the RequestToken.class. I cant understand. Can you help me with the full source code? Thanks a lot.

    1. Hi

      I really glad to give an answer to your query, Please find the code details and mail me if you need more help with it. RequestToken class is used for oAuth purpose to get the Access token and verify the user. package com.avyatech.woocommerceapp;

      import org.scribe.builder.api.DefaultApi10a;
      import org.scribe.model.Verb;
      import org.scribe.model.Token;

      /**
      * Created by avyatech3 on 5/31/2017.
      */

      public class RequestToken extends DefaultApi10a{
      @Override
      public String getAccessTokenEndpoint() {
      return null;
      }

      @Override
      public String getRequestTokenEndpoint() {
      return null;
      }

      @Override
      public String getAuthorizationUrl(Token requestToken) {
      return null;
      }

      @Override
      public Verb getAccessTokenVerb() {
      return Verb.GET;
      }

      @Override
      public Verb getRequestTokenVerb() {
      return Verb.GET;
      }
      }

  11. Danny williams Avatar

    Great information you have to share here.

  12. Where can I find scribe library? And download .jar file?

      1. thanks

      2. I have some questions.
        Which version do you use?
        I am getting from consumer his login and password for site based on wookomercy – what do I need to do?
        How can I made authorization by it?
        Please answer me – i am noob

  13. Hi, i ve a problem when i do the request :
    “{“code”:”woocommerce_rest_authentication_error”,”message”:”Firma no v\u00e1lida – la firma proporcionada no coincide.”,”data”:{“status”:401}}”

    Great info!

Leave a Reply

Your email address will not be published. Required fields are marked *

Request Free Consultation

"*" indicates required fields

BLOG

Our recent post