• Resolved TP SITES

    (@peymansi)


    Hello
    I am using your Amazing Plugin but i have 1 question that i dont understand:
    in my site i have 4 virtual products and every one of them have 3 type of License
    1. 1 Site License
    2. 3 Sites License
    3. 5 Sites License

    I noticed that if someone buy Product 1 and get his License its not unique License only for Product 1 …
    In other words if someone buy Product 1 and buy Product 2 he can insert Product 1 License to Product 2 License and the activation will succeed ….

    How can i know if user License key is only for Product 1 and not for Product 2 ?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello @peymansi

    thank you for your message and for using my plugin.

    You will need to perform additional validation on the REST API call.

    Take a look at the lmfwc_rest_api_validation filter found here:

    https://plugins.trac.www.ads-software.com/browser/license-manager-for-woocommerce/tags/2.1.2/includes/api/Authentication.php#L343

    If that filter returns a WP_Error object, then the API call will fail.

    Let me know if you need further help with this.

    Thread Starter TP SITES

    (@peymansi)

    Hello Drazen
    Thanks for the quick replay…
    but i dont understand, in my plugin i build a form that connect to the api, user insert his License Key and press submit, then the request sent to my server and try to activate License like this:
    https://mysite.com/wp-json/lmfwc/v2/licenses/activate/".$license_key."?consumer_key=".$consumer_key."&consumer_secret=".$consumer_secret."

    so i dont understand when i need to use lmfwc_rest_api_validation and how…
    i need to do 2 api calls (how)? something else?

    • This reply was modified 4 years, 8 months ago by TP SITES.

    Hello @peymansi

    You don’t need to use 2 API calls, you need to hook into this filter on the WordPress instance where the plugin is installed. Once you hook in, you can use the global variables ($_SERVER, $_POST, $_GET) to obtain the request data. Then you can make your checks, afterwards simply return a WP_Error object if there is an error, or true if everything is fine.

    Thread Starter TP SITES

    (@peymansi)

    Hello Drazen
    I tried to solve my problem but I can’t.
    i still dont understand, if user enter the License key i gave him how can i know if its the correct License key for product A and not fro product B…
    he only enter the License key and your plugin check if the License key is valid or not.
    How can you check if the License key belong to product A?
    if i add to my plugin the product ID for example 555 and sent it with the request to the API how can i check if its valid for product 555 or not? i saw that in your DB in this table tp_lmfwc_licenses you save the product id but its the variation id… can you add also the product id? (if its variation it be parent id). if you have another solution i’d love to hear, If you have an example this would be great.

    Hello @peymansi

    The problem arises because you have different types of license keys assigned to one product (if I understood correctly). I would suggest to try and use variable products. With those you can assign different license key(s) to each variation.

    Hello @peymansi

    Are you still having this issue?

    Closed due to inactivity.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘License Manager for WooCommerce activate License’ is closed to new replies.