Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| v:2.0:fighting-fraud [2017/07/20 12:22] – [Example Endpoint] adam | v:2.0:fighting-fraud [2021/06/09 08:47] (current) – [Extra Setup if you're using a Custom Subdomain] adam | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Fraud Prevention in FoxyCart ====== | ====== Fraud Prevention in FoxyCart ====== | ||
| + | |||
| + | ===== Foxy's Internal Abuse Prevention ===== | ||
| + | |||
| + | In addition to the options below, we have some systems in place to block more " | ||
| ===== minFraud in Foxy ===== | ===== minFraud in Foxy ===== | ||
| Line 5: | Line 9: | ||
| ==== What to do with it? ==== | ==== What to do with it? ==== | ||
| - | You can enable minFraud in the " | + | You can enable minFraud in the " |
| Though every store and customer base will have different riskScore averages, MaxMind' | Though every store and customer base will have different riskScore averages, MaxMind' | ||
| Line 37: | Line 41: | ||
| Foxy's [[https:// | Foxy's [[https:// | ||
| - | Foxy defaults to reCAPTCHA being off, but has 2 different options: | + | The setting is shown within the “Anti-Fraud Integrations” section, displayed within the “Let customers pay with a Credit or Debit Card” payment option when enabled. |
| - | - **Enabled, Always.** As it sounds, this will include reCAPTCHA on every checkout. | + | <WRAP center round info 95%> |
| - | - **Enabled, Automatically as Needed.** This will require reCAPTCHA for checkouts loaded by IP addresses that have triggered multiple errors in a preceding window of time. We attempt to set this so it would //very// rarely be shown to a legitimate customer, but would effectively make bot-based bulk fraud impossible. We don't publicize the exact thresholds, and may change them as needed. | + | If you're using a payment |
| - | + | ||
| - | Note that reCAPTCHA isn't required for API-based or [[v: | + | |
| - | + | ||
| - | ===== Pre-Checkout Hooks ===== | + | |
| - | + | ||
| - | The Pre-Checkout Hook functionality allows for stores to apply custom validations for transactions prior to the request being set to the chosen | + | |
| - | + | ||
| - | Common use cases for the pre-checkout hook include: | + | |
| - | + | ||
| - | * Final inventory checks for low-stock | + | |
| - | * Custom validations | + | |
| - | * Integrations with custom validation or fraud-check services | + | |
| - | + | ||
| - | ==== Enabling the Pre-Checkout Hook ==== | + | |
| - | + | ||
| - | To enable | + | |
| - | + | ||
| - | ; pre-checkout hook url | + | |
| - | : The URL for the endpoint script, which needs to be HTTPS, which will receive the JSON payload. | + | |
| - | ; failure handling | + | |
| - | : If your endpoint script fails to load or respond correctly, use this setting to set whether the transaction should be automatically approved or rejected. If set to reject, a generic error message will be returned, which you can edit the error from the " | + | |
| - | + | ||
| - | + | ||
| - | ==== Handling the request ==== | + | |
| - | + | ||
| - | When the customer attempts to complete their purchase, after the Google | + | |
| - | + | ||
| - | The following is an example of the JSON payload, showing two products (with one having live rates) and having | + | |
| - | + | ||
| - | <code javascript> | + | |
| - | { | + | |
| - | | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | { | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | { | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | ], | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | { | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | ], | + | |
| - | " | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | ], | + | |
| - | " | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }], | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | ], | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | } | + | |
| - | } | + | |
| - | }, | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | </ | + | |
| - | + | ||
| - | === Notes === | + | |
| - | + | ||
| - | * The payload includes several _links arrays. These contain helpful URI's that could be used through the Hypermedia API if you're also making use of that. If not, these can be safely ignored. | + | |
| - | + | ||
| - | <WRAP center round important 90%> | + | |
| - | FoxyCart expects a response from your endpoint within 20 seconds of the request being sent - so you will need to ensure that any logic that your endpoint undertakes is completed quickly. Remember that as this request happens after the customer clicks to complete their transaction, | + | |
| </ | </ | ||
| + | Foxy defaults to reCAPTCHA being '' | ||
| + | - **Disabled**: | ||
| + | - **Enabled, Always**: As it sounds, this will include reCAPTCHA on every checkout. | ||
| + | - **Enabled, Automatically as Needed**: This will require reCAPTCHA only in specific situations when our systems have cause to believe your store needs extra protection. We do not reveal specific behavior here, but broadly: If we detect behavior that makes us think a bot (or botnet) is pushing transactions through without a real human behind it, we will enable reCAPTCHA either for specific IPs or for //all checkout attempts//. We attempt to set this so it would //very// rarely be shown to a legitimate customer, but would effectively make bot-based bulk fraud impossible. | ||
| + | Note that reCAPTCHA isn't required for API-based or [[.: | ||
| - | ==== Sending | + | ==== Extra Setup if you're using a Custom Subdomain |
| - | + | ||
| - | In response, FoxyCart expects a JSON payload in the following format to be output on the page (prettified for display purposes): | + | |
| - | + | ||
| - | === Approve === | + | |
| - | + | ||
| - | <code javascript> | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | </ | + | |
| - | + | ||
| - | === Reject === | + | |
| - | + | ||
| - | <code javascript> | + | |
| - | { | + | |
| - | " | + | |
| - | " | + | |
| - | } | + | |
| - | </ | + | |
| - | + | ||
| - | {{ : | + | |
| - | + | ||
| - | <WRAP center round important 90%> | + | |
| - | Only a valid JSON object should be output to your custom endpoint. If you output other elements to the page that is not part of a valid JSON object, the hook will fail to process and the default handling will happen. | + | |
| - | </ | + | |
| - | ==== Example Endpoint ==== | + | If you're using a [[.: |
| - | The following | + | - Go to the [[https:// |
| + | - Enter a label that' | ||
| + | - Select the reCAPTCHA V2 option, and if given options, choose the " | ||
| + | - Enter the domain | ||
| + | - It should | ||
| + | - Copy those two keys into the " | ||
| + | | ||
| + | - Do some test transactions, | ||
| - | <code php> | + | ===== FraudLabs Pro ===== |
| - | <?php | + | |
| - | $rawPost | + | |
| - | $cart_details | + | |
| - | $response = array( | + | [[https:// |
| - | | + | * [[https:// |
| - | ' | + | |
| - | ); | + | |
| - | foreach($cart_details[' | + | ===== Pre-Payment Webhook ===== |
| - | if ($item[' | + | |
| - | $response[' | + | |
| - | $response[' | + | |
| - | } | + | |
| - | } | + | |
| - | header(' | + | The [[pre_payment_webhook|pre-payment web hook]] can be used for custom anti-fraud integrations. |
| - | print json_encode($response); | + | |
| - | </ | + | |
| - | ==== Debugging Errors ==== | + | * [[https:// |
| + | * Some of our users have done custom [[https:// | ||
| - | If your pre-checkout hook endpoint fails to return a response, or returns a non-JSON response, a error will be added to your store' | ||