• Resolved stijnb12345

    (@stijnb12345)


    Hello there,

    Is it possible to add extra information to a license key? I want to check the license, and if the IP and Port are correct.

    So, at the activation, I need to give the API an IP and port, and then at validation I need to check if that IP and port are correct.

    So, I need something like an instance.

    Is this possible?

    Thanks in advance!

    Kind regards,

    Stijn

    • This topic was modified 4 years, 11 months ago by stijnb12345.
    • This topic was modified 4 years, 11 months ago by stijnb12345.
Viewing 13 replies - 16 through 28 (of 28 total)
  • @stijnb12345

    Honestly, I don’t know ?? Give it a go and see how it turns out.

    Thread Starter stijnb12345

    (@stijnb12345)

    {"code":"lmfwc_rest_data_error","message":"License Key invalid.","data":{"status":404}}

    I get this error when I go to /lmfwc/v2/licenses/activate/KEY

    The KEY is correct and not activated yet.

    It must be the $licenseKey variable inside the filter. You need to debug to see if you’re getting anything in there.

    Thread Starter stijnb12345

    (@stijnb12345)

    I will debug it today.

    If you still need any translators for nl_NL (Dutch), I’m here to help you with the translations.

    Hello @stijnb12345,

    hope you had a merry xmas ??

    Yes, I would absolutely love to take you up on that translation offer, thank you very much!

    I see that you’ve already contributed to a couple of translations, they haven’t been approved by the nl_NL community yet. I have to ask: would you like to become a Project Translation Editor (PTE for short) for this plugin? If you were a plugin PTE, you could manage all the nl_NL translations for the plugin, and approve them right away yourself.

    Please let me know either way ??

    Thread Starter stijnb12345

    (@stijnb12345)

    Hope you had a merry Christmas too!

    Yeah, I like to be a PTE.

    Thread Starter stijnb12345

    (@stijnb12345)

    $licenseKey = sanitize_text_field($request->get_param('license_key'));

    This line at the lmfwc_rest_api_validation filter is null, what is wrong?

    @stijnb12345

    great, I will make the PTE request soon!

    The route isn’t really using any query or body parameters, so that probably is the reason it fails. You’ll have to extract the license key from the $request->get_route() method instead. This route will return something like: v2/licenses/YOUR-LICENSE-KEY. I’d recommend using a regular expression to match the pattern and extract the license key. You could also do explode('/', $request->get_route()) and check the array contents.

    Thread Starter stijnb12345

    (@stijnb12345)

    /** @var \LicenseManagerForWooCommerce\Models\Resources\License $license */
    $license = \LicenseManagerForWooCommerce\Repositories\Resources\License::instance()->findBy(
        array(
            'license' => apply_filters('lmfwc_hash', $licenseKey)
        )
    );
    
    if ($license) {
        $licenseId = $license->getId();
    } else {
        return new WP_Error(
            'lmfwc_rest_data_error_12',
            'License Key ID invalid.',
            array('status' => 404)
        );
    }

    Now I get the lmfwc_rest_data_error_12 error. The License key is now correct.

    • This reply was modified 4 years, 11 months ago by stijnb12345.
    • This reply was modified 4 years, 11 months ago by stijnb12345.
    Thread Starter stijnb12345

    (@stijnb12345)

    Fixed that issue, but the instance is still not added at activation.

    Thread Starter stijnb12345

    (@stijnb12345)

    Okay, at the lmfwc_rest_api_pre_response filter, how to get the key from the URL?

    $route returns:

    Array
    (
        [0] => v2
        [1] => licenses
        [2] => {license_key}
    )
    • This reply was modified 4 years, 11 months ago by stijnb12345.
    Thread Starter stijnb12345

    (@stijnb12345)

    Fixed it. I’m now using the $data variable, and get it from there.

    Thanks for your help! It’s working now.

    Hello @stijnb12345

    Great job! I’m glad you worked it out ??

    If I can help with anything else, do let me know.

    PS: I would also be extremely thankful if you could take some time out of your day to write a plugin review here on www.ads-software.com. These reviews really help the plugin to grow and mean a lot to me personally. Here’s the link:

    https://www.ads-software.com/support/plugin/license-manager-for-woocommerce/reviews/#new-post

Viewing 13 replies - 16 through 28 (of 28 total)
  • The topic ‘Extra information for license keys’ is closed to new replies.