Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
v:2.0:hmac_validation [2020/03/24 03:37] – [Bundled Products] adam | v:2.0:hmac_validation [2024/03/11 14:38] (current) – [PHP: Helper Function] marija | ||
---|---|---|---|
Line 27: | Line 27: | ||
+ | ===== Language and Site Independent Solutions ===== | ||
+ | Regardless of how you've built your site, you can use our Cloudflare Worker script, along with Cloudflare, to automatically protect your site. More info is here: | ||
+ | * [[https:// | ||
+ | |||
+ | Please let us know if you run into trouble getting that set up. | ||
===== Language Specific Examples & Helper Files ===== | ===== Language Specific Examples & Helper Files ===== | ||
While you certainly can build your validation functionality from scratch, it may be a boon to use an existing library. Currently we only have official code for PHP but if you're interested in porting the PHP version to another language please [[https:// | While you certainly can build your validation functionality from scratch, it may be a boon to use an existing library. Currently we only have official code for PHP but if you're interested in porting the PHP version to another language please [[https:// | ||
+ | |||
+ | ==== Webflow: Pre-Payment Webhook ==== | ||
+ | If you're using Webflow, you can set up a serverless function on Netlify.com to verify your product prices against your Webflow product collection. This is slightly technical, but hopefully will be more straightforward than it looks, and will generally be free unless you're doing really heavy volume. Setting it up starts with a single click. | ||
+ | |||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | |||
+ | Let us know if you need help getting it set up. | ||
+ | |||
==== PHP: Automatic Validation with Minimal Effort ==== | ==== PHP: Automatic Validation with Minimal Effort ==== | ||
Line 41: | Line 55: | ||
<code php> | <code php> | ||
$api_key = " | $api_key = " | ||
- | $encodingval = htmlspecialchars($var_code . $var_parent_code . $var_name . $var_value); | + | $encodingval = htmlspecialchars($var_code . $var_parent_code . $var_name . $var_value, ENT_COMPAT); |
$label = ($for_value) ? $var_value : $var_name; | $label = ($for_value) ? $var_value : $var_name; | ||
return $label . ' | return $label . ' | ||
Line 72: | Line 86: | ||
<input type=" | <input type=" | ||
</ | </ | ||
+ | |||
+ | <WRAP center round tip 90%> | ||
+ | **Where should the signature be placed in a form element?** Note that the signature can be appended to either the '' | ||
+ | </ | ||
In a link in it's vanilla state would look like this: | In a link in it's vanilla state would look like this: | ||
Line 83: | Line 101: | ||
$atc .= "&" | $atc .= "&" | ||
</ | </ | ||
+ | |||
**Bundled Products** | **Bundled Products** | ||
Line 195: | Line 214: | ||
As the child product in a bundled product setup often has a different price than if the product were added by itself, we require that the product code used to hash all attributes of the child product contains both the parent code and the child code in the format '' | As the child product in a bundled product setup often has a different price than if the product were added by itself, we require that the product code used to hash all attributes of the child product contains both the parent code and the child code in the format '' | ||
- | For example, if you are adding a T-shirt with the code "shirt" | + | For example, if you are adding a T-shirt with the code '' |
==== An Example ==== | ==== An Example ==== | ||