Support » Plugin: License Manager for WooCommerce » Adding license code to Woocommerce payload

  • Resolved kevinburgess

    (@kevinburgess)


    Hi!

    Firstly – you are awesome and so is this plugin. Thanks!

    We have a webhook set up that is triggered on order completion. Is there a snippet I can add to include the license code for an order in the payload?

    Thanks
    Kevin

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter kevinburgess

    (@kevinburgess)

    Ok – I’m a complete novice, but is this anywhere near getting the license into the payload?

    `function my_custom_wc_api_order_response( $order_data, $order ) {

    $license = get_post_meta($order_id , ‘license_key’ , true );
    $order_data[‘license_key’] = $license;
    return $order_data;
    }

    add_filter( ‘woocommerce_api_order_response’, ‘my_custom_wc_api_order_response’, 10, 3 );

    andyll00

    (@andyll00)

    Hi Kevin, I have to ask, did it work? Since I would also like to implement it

    Thread Starter kevinburgess

    (@kevinburgess)

    My code above did not work – in the end I paid a developer to write the php snippet for it. It was more complex than originally thought, as the keys are encrypted in the database so there needs to be a decrypt action as part of it all.

    Would you be open to share share the snippet that retrieves the recently purchased license code to me or would I need to hire a developer for my use case? Thank you Kevin.

    The plugin provides procedures of getting the license decrypted.

    Hello @kevinburgess @andyll00

    As @dan009 said, there is a way to decrypt a license key (Assuming that the encrypted license key is stored in the $encrypted_license_key variable):

    $decrypted_license = apply_filters( 'lmfwc_decrypt', $encrypted_license_key);

    Similar to this, the filter to encrypt is lmfwc_encrypt.

    To answer your original question: There is no out-of-the box way to do that, you would need to hire a developer to do that for – which you’ve already done 🙂

    Let me know if I can provide any other help.

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