Foxy Forum Status

We're no longer responding to questions via our forum, but we will keep it up for historical reasons. If you can't find the answer you're looking for, please visit our knowledge base or contact us. If there's enough interest in the future, we may bring the forum back.

How to use --open-- in HMAC?


I'm not understanding the help documentation on this...

I have a variable image URL that changes in my Buy Button form, so I need to keep it out of the HMAC validation.

Here is the current code for the image:
<input type="hidden" name="image||89d4a42b026bad37a51866f78ba6a80b9dc775e10f4bd4322c1a0cd29f387bbd" value="">

How does the code need to look before it goes into the HMAC encoder? (open, -open-, --open--, -OPEN-, --OPEN-- ?? And input where??)

And how does the code need to look when it goes onto my website with the image URL? (still need open, -open-, --open--, -OPEN-, --OPEN-- ??)

  • fc_adamfc_adam FoxyCart Team

    I believe we got you squared away on this in our email thread - but to follow up here too in case anyone else finds this thread:

    If you have a text input within an add to cart form that you need to allow a dynamic value for, whether that is because the user is able to change the value, or you're changing it using javascript, it can't be signed as normal as once it's changed it will fail validations.

    To allow for that, we do support an "open" setting for form signing that allows for the value to be changed. To trigger that, when signing the form, you would pass a value of --OPEN-- in the form fields value.

    For example, as an input, that would look like this:
    <input type="text" name="my_open_field" value="--OPEN--"
    After signing, you'll notice that any "open" fields will have ||open appended to the signature, which identifies those fields that are open. To confirm, you don't need to add that suffix to the signature, it will get added by the signing process.

    After signing the form, if you're handling it manually, you can then replace the --OPEN-- value with whatever you need it to be.

    I hope that helps! We've also updated the documentation for this to hopefully make things a little clearer.
Sign In or Register to comment.