Make-Lemonade / lemonsqueezy-wp

The official Lemon Squeezy WordPress plugin
https://wordpress.org/plugins/lemon-squeezy/
6 stars 3 forks source link

Plugin updater doesn't seem to work #23

Closed sanzeeb3 closed 1 year ago

sanzeeb3 commented 1 year ago

Describe the bug When using LS Example Plugin Updater, the updates never arrived with the error:

[body] => {"success":false,"error":"Error fetching license_key","error_code":"error_fetching_license_key"}

the activation/deactivation worked fine.

While looking into LS plugin, here:

https://github.com/Make-Lemonade/lemonsqueezy-wp/blob/develop/src/class-lsq-updater.php

get_license() returned the license object fine.

[25-Jan-2023 08:07:43 UTC] stdClass Object
(
    [valid] => 1
    [error] => 
    [license_key] => stdClass Object
        (
            [id] => 20772
            [status] => active
            [key] => f20c53e0-2798-48dc-974c-36d216200a26
            [activation_limit] => 7
            [activation_usage] => 4
            [created_at] => 2023-01-19 07:18:18
            [expires_at] => 2025-01-19 00:00:00
            [test_mode] => 1
        )

    [instance] => 
    [meta] => stdClass Object
        (
            [store_id] => 12735
            [order_id] => 373446
            [order_item_id] => 373686
            [product_id] => 42204
            [variant_id] => 36955
        )

)

but, get_license_key() resulted in the response error. Which caused the error:

To Reproduce Steps to reproduce the behavior:

  1. Install the LS Updater Example Plugin https://github.com/Make-Lemonade/lemonsqueezy-wp-updater-example
  2. Add a LS in the settings.
  3. Add new version plugin in LS.
  4. The plugin update doesn't appear in the dashboard.

Software (please complete the following information):

Additional context Add any other context about the problem here.

gilbitron commented 1 year ago

@sanzeeb3 What was the error you received from get_license_key?

sanzeeb3 commented 1 year ago

@gilbitron 404 Error was the response. https://api.lemonsqueezy.com/v1/license-keys/20772/?include=store,product,order-item - the URL.

gilbitron commented 1 year ago

Ah, this is a test mode license key. Unfortunately, our WordPress plugin doesn't support authenticating with test mode at the moment so any calls to the full API (not the license API) will fail. See #18.