• Hello license managers,
    Greetings from TheWebSolver. We have been developing an API where users can activate/deactivate/renew licenses using License Manager for WooCommerce and TheWebSolver License Manager (client/server).

    NOTE:

    1. Only manual renewal of existing license key is possible with parent/child order relation.
    2. Amazon PHP SDK is used for handling zip files saved on Amazon S3.

    For using on selling product: License Manager Client link

    For using on license server where this plugin is installed: License Manager Server Link

    We would like to share it with all our friends using this plugin.

    Thank you.

    • This topic was modified 3 years, 9 months ago by hsehszroc.
    • This topic was modified 3 years, 9 months ago by hsehszroc.
Viewing 14 replies - 16 through 29 (of 29 total)
  • Thread Starter hsehszroc

    (@hsehszroc)

    Inside your plugin class where you have instantiated the client manager, try adding this code to the construct method for debugging:

    add_action(
    			'admin_notices',
    			function() {
    				var_dump( $this->manager->client->get_error() );
    				var_dump( $this->manager->client->other_errors );
    				var_dump( $this->manager->get_response() );
    			},
    			99
    		);
    • This reply was modified 3 years, 8 months ago by hsehszroc. Reason: missing arrow

    Thank you!

    This is the output, I cant really find here any clue =(
    Do you have an idea?

    manager->client->get_error():

    object(WP_Error)#347 (3) { ["errors"]=> array(2) { ["invalid_json_response"]=> array(1) { [0]=> string(24) "JSON Error: Syntax error" } [""]=> array(1) { [0]=> string(0) "" } } ["error_data"]=> array(1) { ["invalid_json_response"]=> array(3) { ["request"]=> object(TheWebSolver\License_Manager\Component\Request)#1437 (5) { ["url":"TheWebSolver\License_Manager\Component\Request":private]=> string(449) "https://shop.siteix.co.il/wp-json/lmfwc/v2/licenses/activate/SMALL2D1FX42AHF1B7178X584HXF7?consumer_key=ck_3fc0620008eb219e510b42d7a1164c7e0d28b2f1&consumer_secret=cs_1eef46aeae9ef30571491672fd14b9cfcaf50856&form_state=activate&oauth_nonce=8dd468315c1a7d6d603c1e7f2f8e9c85796de33b&oauth_signature=za%2BA%2FxwPlMjLud6cVqIKZEjudwjTfSgutwR6tY5ItGY%3D&oauth_signature_method=HMAC-SHA256&oauth_timestamp=1625467297&order_id=57&slug=contact-forms-anti-spam" ["method":"TheWebSolver\License_Manager\Component\Request":private]=> string(3) "GET" ["parameters":"TheWebSolver\License_Manager\Component\Request":private]=> array(9) { ["consumer_key"]=> string(43) "ck_3fc0620008eb219e510b42d7a1164c7e0d28b2f1" ["consumer_secret"]=> string(43) "cs_1eef46aeae9ef30571491672fd14b9cfcaf50856" ["form_state"]=> string(8) "activate" ["oauth_nonce"]=> string(40) "8dd468315c1a7d6d603c1e7f2f8e9c85796de33b" ["oauth_signature"]=> string(44) "za+A/xwPlMjLud6cVqIKZEjudwjTfSgutwR6tY5ItGY=" ["oauth_signature_method"]=> string(11) "HMAC-SHA256" ["oauth_timestamp"]=> int(1625467297) ["order_id"]=> string(2) "57" ["slug"]=> string(23) "contact-forms-anti-spam" } ["headers":"TheWebSolver\License_Manager\Component\Request":private]=> array(5) { ["Accept"]=> string(16) "application/json" ["User-Agent"]=> string(49) "TheWebSolver License Manager API Client-PHP/2.0.0" ["Referer"]=> string(20) "https://siteix.co.il" ["Authorization"]=> string(4) "TWS " ["From"]=> string(17) "[email protected]" } ["body":"TheWebSolver\License_Manager\Component\Request":private]=> string(0) "" } ["response"]=> object(TheWebSolver\License_Manager\Component\Response)#1439 (3) { ["code":"TheWebSolver\License_Manager\Component\Response":private]=> int(301) ["headers":"TheWebSolver\License_Manager\Component\Response":private]=> array(6) { ["Server"]=> string(5) "nginx" ["Date"]=> string(29) "Mon, 05 Jul 2021 06:41:37 GMT" ["Content-Type"]=> string(9) "text/html" ["Content-Length"]=> string(3) "162" ["Connection"]=> string(10) "keep-alive" ["Location"]=> string(450) "https://shop.siteix.co.il/wp-json/lmfwc/v2/licenses/activate/SMALL2D1FX42AHF1B7178X584HXF7?consumer_key=ck_3fc0620008eb219e510b42d7a1164c7e0d28b2f1&consumer_secret=cs_1eef46aeae9ef30571491672fd14b9cfcaf50856&form_state=activate&oauth_nonce=8dd468315c1a7d6d603c1e7f2f8e9c85796de33b&oauth_signature=za%2BA%2FxwPlMjLud6cVqIKZEjudwjTfSgutwR6tY5ItGY%3D&oauth_signature_method=HMAC-SHA256&oauth_timestamp=1625467297&order_id=57&slug=contact-forms-anti-spam" } ["body":"TheWebSolver\License_Manager\Component\Response":private]=> string(162) "
    301 Moved Permanently
    nginx
    " } ["response_error"]=> NULL } } ["additional_data":protected]=> array(1) { ["invalid_json_response"]=> array(1) { [0]=> array(2) { ["request"]=> object(TheWebSolver\License_Manager\Component\Request)#1437 (5) { ["url":"TheWebSolver\License_Manager\Component\Request":private]=> string(449) "https://shop.siteix.co.il/wp-json/lmfwc/v2/licenses/activate/SMALL2D1FX42AHF1B7178X584HXF7?consumer_key=ck_3fc0620008eb219e510b42d7a1164c7e0d28b2f1&consumer_secret=cs_1eef46aeae9ef30571491672fd14b9cfcaf50856&form_state=activate&oauth_nonce=8dd468315c1a7d6d603c1e7f2f8e9c85796de33b&oauth_signature=za%2BA%2FxwPlMjLud6cVqIKZEjudwjTfSgutwR6tY5ItGY%3D&oauth_signature_method=HMAC-SHA256&oauth_timestamp=1625467297&order_id=57&slug=contact-forms-anti-spam" ["method":"TheWebSolver\License_Manager\Component\Request":private]=> string(3) "GET" ["parameters":"TheWebSolver\License_Manager\Component\Request":private]=> array(9) { ["consumer_key"]=> string(43) "ck_3fc0620008eb219e510b42d7a1164c7e0d28b2f1" ["consumer_secret"]=> string(43) "cs_1eef46aeae9ef30571491672fd14b9cfcaf50856" ["form_state"]=> string(8) "activate" ["oauth_nonce"]=> string(40) "8dd468315c1a7d6d603c1e7f2f8e9c85796de33b" ["oauth_signature"]=> string(44) "za+A/xwPlMjLud6cVqIKZEjudwjTfSgutwR6tY5ItGY=" ["oauth_signature_method"]=> string(11) "HMAC-SHA256" ["oauth_timestamp"]=> int(1625467297) ["order_id"]=> string(2) "57" ["slug"]=> string(23) "contact-forms-anti-spam" } ["headers":"TheWebSolver\License_Manager\Component\Request":private]=> array(5) { ["Accept"]=> string(16) "application/json" ["User-Agent"]=> string(49) "TheWebSolver License Manager API Client-PHP/2.0.0" ["Referer"]=> string(20) "https://siteix.co.il" ["Authorization"]=> string(4) "TWS " ["From"]=> string(17) "[email protected]" } ["body":"TheWebSolver\License_Manager\Component\Request":private]=> string(0) "" } ["response"]=> object(TheWebSolver\License_Manager\Component\Response)#1439 (3) { ["code":"TheWebSolver\License_Manager\Component\Response":private]=> int(301) ["headers":"TheWebSolver\License_Manager\Component\Response":private]=> array(6) { ["Server"]=> string(5) "nginx" ["Date"]=> string(29) "Mon, 05 Jul 2021 06:41:37 GMT" ["Content-Type"]=> string(9) "text/html" ["Content-Length"]=> string(3) "162" ["Connection"]=> string(10) "keep-alive" ["Location"]=> string(450) "https://shop.siteix.co.il/wp-json/lmfwc/v2/licenses/activate/SMALL2D1FX42AHF1B7178X584HXF7?consumer_key=ck_3fc0620008eb219e510b42d7a1164c7e0d28b2f1&consumer_secret=cs_1eef46aeae9ef30571491672fd14b9cfcaf50856&form_state=activate&oauth_nonce=8dd468315c1a7d6d603c1e7f2f8e9c85796de33b&oauth_signature=za%2BA%2FxwPlMjLud6cVqIKZEjudwjTfSgutwR6tY5ItGY%3D&oauth_signature_method=HMAC-SHA256&oauth_timestamp=1625467297&order_id=57&slug=contact-forms-anti-spam" } ["body":"TheWebSolver\License_Manager\Component\Response":private]=> string(162) "
    301 Moved Permanently
    nginx
    " } } } } } 

    manager->client->other_errors

    object(WP_Error)#346 (3) { ["errors"]=> array(0) { } ["error_data"]=> array(0) { } ["additional_data":protected]=> array(0) { } }
    

    manager->get_response()

    object(WP_Error)#347 (3) { ["errors"]=> array(0) { } ["error_data"]=> array(0) { } ["additional_data":protected]=> array(0) { } }
    

    Thank you =)

    I forgot to mention that I install the client plugin without Composer, I just included all the files inside my plugin.

    require_once __DIR__ . '/tws-license-manager-client-master/Includes/API/Manager.php';
    require_once __DIR__ . '/tws-license-manager-client-master/Includes/Component/Basic_Auth.php';
    require_once __DIR__ . '/tws-license-manager-client-master/Includes/Component/Http_Client.php';
    require_once __DIR__ . '/tws-license-manager-client-master/Includes/Component/OAuth.php';
    require_once __DIR__ . '/tws-license-manager-client-master/Includes/Component/Options.php';
    require_once __DIR__ . '/tws-license-manager-client-master/Includes/Component/Request.php';
    require_once __DIR__ . '/tws-license-manager-client-master/Includes/Component/Response.php';
    
    Thread Starter hsehszroc

    (@hsehszroc)

    As per your debug output, request data shows the server URL as https://shop.siteix.co.il but the location seems to be https://shop.siteix.co.il/.

    Also, try checking when making a server request:

    1. the options (at /tws-license-manager-client-master/Includes/Component/Options.php), and
    2. the parameters (at /tws-license-manager-client-master/Includes/Component/OAuth.php for non-SSL site & at /tws-license-manager-client-master/Includes/Component/Basic_Auth.php for SSL site)

    Also, the client manager is quite impossible to debug from my side beyond this.

    Hope you get this resolved.

    THank you!!!

    Working!!!!

    I just needed to add https:// before the server domain name

    Yaaaaay
    Thank you very much

    Thread Starter hsehszroc

    (@hsehszroc)

    You’re welcome. Happy to help.

    @hsehszroc
    Hey again =)

    I having another problem
    in debug mood, everything is find
    the response is:

    stdClass Object
    (
        [success] => 1
        [data] => stdClass Object
            (
                [id] => 5
                [orderId] => 57
                [productId] => 14
                [userId] => 2
                [licenseKey] => SMALL1D7FG75XEAD84542EEZB1X7B
                [expiresAt] => 2022-07-04 00:00:00
                [validFor] => 
                [source] => 1
                [status] => 3
                [timesActivated] => 3
                [timesActivatedMax] => 10
                [createdAt] => 2021-07-04 06:59:19
                [createdBy] => 2
                [updatedAt] => 2021-07-19 16:58:05
                [updatedBy] => 1
            )
    
    )
    

    But when I am not in debug mood after I type the license details, I get:
    The license for this site has already been activated.
    I don’t see the license was activated and in the status, I still see “Not Activated”

    I search a lot, didn’t found any solution yet, Maybe you have an idea?

    Thanks =)

    Thread Starter hsehszroc

    (@hsehszroc)

    The debug mode is only meant to be used for testing purposes on the development site whereas the license form should only be used on production (by clients). i.e. Debug mode and license form are not meant to be used on the same client site.

    As per your debug output, it seems you have used API endpoint /wp-json/lmfwc/v2/licenses/activate/{license_key} to activate the same license key 3 times.

    The license for this site has already been activated.
    The above output is the server response to let you know that license has already been activated for that client site. Check your server database table wp_lmfwc_licenses_meta for more details on which client sites have made license request.

    Thank you for your answer ????

    when I try the plugin in a new website, and I write the correct details of the license, I received a Fatal error (that coming from the server website) in the top “notice” message.
    There has been a critical error on this website.
    and in the error-log in the server, I find this line:
    so I guess here is my big problem

    2021/07/21 08:03:57 [error] 26303#0: *172142 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined property: TheWebSolver\License_Manager\API\Manager::$product in /home/shopwzil/domains/shop.siteix.co.il/public_html/wp-content/plugins/licenses/tws-license-manager-server-master/Includes/API/Manager.php on line 585
    PHP message: PHP Fatal error:  Uncaught Error: Call to a member function get_data() on null in /home/shopwzil/domains/shop.siteix.co.il/public_html/wp-content/plugins/licenses/tws-license-manager-server-master/Includes/API/Manager.php:585
    Stack trace:
    #0 /home/shopwzil/domains/shop.siteix.co.il/public_html/wp-content/plugins/licenses/tws-license-manager-server-master/Includes/API/Manager.php(570): TheWebSolver\License_Manager\API\Manager->send_product_details_with_data(Array, Object(LicenseManagerForWooCommerce\Models\Resources\License), 'data-siteusslwt...', Array)
    #1 /home/shopwzil/domains/shop.siteix.co.il/public_html/wp-includes/class-wp-hook.php(303): TheWebSolver\License_Manager\API\Manager->parse_response(Array, 'v2/licenses/act...', Array)
    #2 /home/shopwzil/domains/shop.siteix.co.il/public_html/wp-includes/plugin.php(189): WP_Hook->apply_filters(Array, Array)
    #3 /home/shopwzil/domains/shop.siteix.co.il/public_html/wp-content/plugins/license-manager-for-woocommerce/includes/abstracts/RestController" while reading response header from upstream, client: 88.218.117.3, server: shop.siteix.co.il, request: "GET /wp-json/lmfwc/v2/licenses/activate/SMALL1D7FG75XEAD84542EEZB1X7B?form_state=activate&order_id=57&slug=10-license-key&consumer_key=ck_3fc0620008eb219e510b42d7a1164c7e0d28b2f1&consumer_secret=cs_1eef46aeae9ef30571491672fd14b9cfcaf50856 HTTP/1.1", upstream: "fastcgi://unix:/usr/local/php72/sockets/shopwzil.sock:", host: "shop.siteix.co.il", referrer: "https://site.ussl.wtf"
    
    • This reply was modified 3 years, 7 months ago by yonifre.

    Also, after I update the WP to 5.8
    I get this error in admin edit pages:
    ( When I deactivate your plugin it’s diaspore )

    Fatal error: Uncaught Error: Call to undefined method WP_Error::is_error() in /home/shopwzil/domains/shop.siteix.co.il/public_html/wp-includes/block-patterns.php:75 Stack trace: #0 /home/shopwzil/domains/shop.siteix.co.il/public_html/wp-includes/class-wp-hook.php(303): _load_remote_block_patterns(Object(WP_Screen)) #1 /home/shopwzil/domains/shop.siteix.co.il/public_html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters('', Array) #2 /home/shopwzil/domains/shop.siteix.co.il/public_html/wp-includes/plugin.php(470): WP_Hook->do_action(Array) #3 /home/shopwzil/domains/shop.siteix.co.il/public_html/wp-admin/includes/class-wp-screen.php(421): do_action('current_screen', Object(WP_Screen)) #4 /home/shopwzil/domains/shop.siteix.co.il/public_html/wp-admin/includes/screen.php(243): WP_Screen->set_current_screen() #5 /home/shopwzil/domains/shop.siteix.co.il/public_html/wp-admin/admin.php(212): set_current_screen() #6 /home/shopwzil/domains/shop.siteix.co.il/public_html/wp-admin/post.php(12): require_once('/home/shopwzil/... in /home/shopwzil/domains/shop.siteix.co.il/public_html/wp-includes/block-patterns.php on line 75
    
    Thread Starter hsehszroc

    (@hsehszroc)

    Please check how server files are included and why product property is not been set.
    You can var dump the output for that property for debugging on the server:
    var_dump( Server::load()->product ).

    No test has been made for WP v5.8.
    Sorry, but this is all I can help you at this time.

Viewing 14 replies - 16 through 29 (of 29 total)
  • The topic ‘lmfwc API PHP for client and server’ is closed to new replies.