• Hi,

    At first: congrats to the plugin, it’s generally an awesome product.
    BUT – as the title suggests, I’m totally unstatisfied with the documentation. Currently you have 8 articles in the plugin knowledge base, and none of these articles include the following information:

    What does ACTIVATION mean at all? What is this feature, how does it work?

    I would appreciate if you shared some relevant and detailed information.

    And a question: I tried to implement a custom activation programmatically, because I had the idea that this ‘activation’ thingy might be related to the serial number status/availability.

    I used these codes:

    1. Updating availability:

    $sn_id = 344;
    wc_serial_numbers_update_serial_number_status( $sn_id, 'available' );

    ?? This snippet works as expected.

    2. Updating activation status

    $sn_id = 344;
    $sn_Obj = wc_serial_numbers_get_serial_number( $sn_id );
    
    wc_serial_numbers_insert_activation( array(
    	'serial_id' => $sn_id,
    	'active'    => 1,
    	'instance'  => $sn_Obj,
    ) );

    ?? This snippet doesn’t work. At least not as expected. It created activation entries all right, but all activation column data is missing – and this data should be there, based on what I see in the related functions file on Github.

    Thanks in advance for your information, and ideally with your help regarding what am I doing wrong with the second snippet.

    • This topic was modified 2 years, 3 months ago by Gabor Lippert.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Sultan Nasir Uddin

    (@manikmist09)

    Hi @lunule
    Thank you for trying out the plugin. We are constantly working on documentation and making the plugin better than before. The entire API doc is here https://pluginever.com/docs/wocommerce-serial-numbers/woocommerce-serial-numbers-api-docs/. I feel sorry if it was not clear to you & I will try to make the documentation more elaborate in the future.

    The plugin has two parts serial number & Activations.

    Serial number
    Serial numbers are supposed to create per product basis, then when that product is sold, the customer will receive that serial key and become available for use. It could be offline or online. If you want to do something through API with the serial key, say activating software, that’s where the activation comes.

    Activation
    Inbuilt API can check the version, activate, and halt the license key. To activate/deactivate the serial key, the order status associated with the serial key must be completed. So, the summary is you must buy a key before using that.

    If you look into the plugin folder, there is a file api-test.php inside the examples folder. That file has all the demo codes for interacting with activation.

    Example code for activating a key

    $args     = [
    	'wc-api'     => 'serial-numbers-api',
    	'request'    => 'activate',
    	'email'      => '{[email protected]}',
    	'serial_key' => '{serial key}',
    	'product_id' => '{product id associated to the key}',
    	'instance'   => '{unique string to identify this activation}',
    ];
    $site_url = '{https://yoursite.com}';
    $api_url  = add_query_arg( $args, $site_url );
    $data     = wp_remote_get( $api_url );
    print_r( $data['body'] );
    

    Please let me know if there is anything else I can help with.

    Thread Starter Gabor Lippert

    (@lunule)

    Hi @manikmist09,

    Thanks for your quick reply, and for the API example code, I guess this is exactly what I needed. ?? All clear.

    Or – just one last question before marking this topic closed.

    So, if my understanding is correct, the only way to programmatically activate/deactivate serials is with an active Rest API, right? So, if, for instance because of security reasons, we need the Rest API to be kept deactivated, we also lose the ability to programmatically control the serial statuses.

    Thanks,
    Lunule/Gabor

    Thread Starter Gabor Lippert

    (@lunule)

    Hi @manikmist09,

    … also, I tested the code you recommended:

    $args     = [
    	'wc-api'     => 'serial-numbers-api',
    	'request'    => 'activate',
    	'email'      => $u_Arr['email'],
    	'serial_key' => $u_Arr['sn_id'],
    	'product_id' => 38639,
    	'instance'   => __('some identification string', 'our-text-domain'),
    ];
    $site_url = get_site_url();
    $api_url  = add_query_arg( $args, $site_url );
    $data     = wp_remote_get( $api_url );
    print_r( $data['body'] );

    And I get the error Serial Number is not associated with provided product id – but the product id is definitely correct.

    As for the ‘serial key’ parameter, I tested the serial id, the encrypted serial key, and the decrypted serial key – the above error persists with each attempts.

    Can you help me with this?

    Thanks,
    @lunule

    Plugin Author Sultan Nasir Uddin

    (@manikmist09)

    Hi @lunule
    Could you please verify if the order status associated with the key is complete?
    I would request you to ping on our live support for fastest solution.

    Thanks

    Hi @lunule,

    Just checking on this. Do you still need assistance here? I’ll close this ticket for now but if you still need assistance with it, please reopen it and I’ll happily assist you.

    If you have other issues, you can open a new ticket and I’ll help you there too.

    Thanks for using WooCommerce Serial Numbers. Have a great day!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Documentation about ACTIVATIONS is poor (or nonexistent) + a question’ is closed to new replies.