Support » Plugin: License Manager for WooCommerce » timesActivated not incrementing on activation

  • Resolved namith.jawahar

    (@namithjawahar)


    When activating the plugin via rest API the “timesActivated” value is not increment and is always “null”. Any solution or quick fix?

    Thanks for the plugin

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Drazen Bebic

    (@drazenbebic)

    Hello @namithjawahar,

    thank you for your message and for using my plugin.

    I have a couple of questions:

    • Are you using the v2 API routes?
    • What does your request look like?
    • What does your response look like?

    Please let me know so that we can find a fix for this.

    I am using the v2 API

    Here is a sample response

    {“success”:true,”data”:{“id”:”1″,”orderId”:”116″,”productId”:”83″,”licenseKey”:”1C4A-B22A-133C-4ACA”,”expiresAt”:null,”validFor”:null,”source”:”1″,”status”:”2″,”timesActivated”:null,”timesActivatedMax”:”5″,”createdAt”:”2019-10-20 16:09:48″,”createdBy”:”2″,”updatedAt”:”2019-10-20 16:09:48″,”updatedBy”:”2″}}

    to the query

    https://mywebsite.com/?rest_route=/lmfwc/v2/licenses/activate/&license_key=1C4A-B22A-133C-4ACA&consumer_key=ck_blahblahblah6&consumer_secret=cs_blahblahblah

    Plugin Author Drazen Bebic

    (@drazenbebic)

    @namithjawahar

    your URL looks a bit out of the ordinary. Is this a standard WordPress feature or some custom code? Also I noticed that you started your first GET parameter with a &. It should be a ?

    Have you tried

    https://mywebsite.com/wp-json/lmfwc/v2/licenses/activate/?license_key=1C4A-B22A-133C-4ACA&consumer_key=ck_blahblahblah6&consumer_secret=cs_blahblahblah`

    namith.jawahar

    (@namithjawahar)

    That URL is the non permalink version of the normally used one. It works.

    Plugin Author Drazen Bebic

    (@drazenbebic)

    Another question:

    Are you doing a GET request?

    namith.jawahar

    (@namithjawahar)

    Yes, I do get a response from the server with the license object. Its just not incrementing.

    Plugin Author Drazen Bebic

    (@drazenbebic)

    @namithjawahar,

    do you have a test server where I could take a look myself? You could send me the login credentials to support@licensemanager.at

    Sorry, Dont have a test server where the credentials can be shared. But this can be reproduced pretty easily. Create a product with licensing, place an order to generate a new key and use the API to activate the license. The “timesActivated” variable will be stuck on “NULL”

    Plugin Author Drazen Bebic

    (@drazenbebic)

    @namithjawahar,

    well that’s the thing, it absolutely works on my end, and it works on at least 2 other servers which I know of. I also got confirmation from some users that everything works on their end.

    It must be something on your end.

    Plugin Author Drazen Bebic

    (@drazenbebic)

    Hello @namithjawahar,

    were you able to figure this one out?

    Yes, I just figured it out. The problem was with the rest API path. I had to repeat the “license_key” variable in the path too to match your regex. I didn’t delve into why it was returning a license object with the wrong path, it was probably getting matched with one of the other rest paths.

    ?rest_route=/lmfwc/v2/licenses/activate/license_key/&license_key=1234-B22A-5678-4ACA&consumer_key=ck_blahblahblah6&consumer_secret=cs_blahblahblah

    Thanks

    Plugin Author Drazen Bebic

    (@drazenbebic)

    @namithjawahar,

    I’m glad you figured it out, kudos!

    PS: I would greatly appreciate if you took some time out of your day to write a plugin review here on WordPress.org. Those reviews really help spread the plugin and mean a lot to me personally. Here’s the link:

    https://wordpress.org/support/plugin/license-manager-for-woocommerce/reviews/#new-post

    Have a great evening!

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.