Quick Links

How to Integrate the Kount Magento Extension

Provide comprehensive security for your Magento e-commerce transactions by using the Kount Magento extension as part of your integration to Kount.

Kount aggregates and evaluates data from three primary sources:

  • Device Data Collector (DDC): Processed in the Iframe. This passive analysis obfuscates Kount’s interaction with the customer and does not affect the customer’s purchasing experience.
  • Risk Inquiry Service (RIS): Evaluates the data provided by the Data Collector and the order form data submitted to the merchant from the customer to create a fraud score. Merchant-specified rules are assessed for each transaction during this evaluation process.
  • Kount Persona Technology: Linked data points across all Kount merchants, which provide behavioral analytics related to a transaction.
    Note: Magento 2 uses a technique called “transparent redirect” during the checkout process, which sends credit card information directly to the payment processor. Magento no longer has access to the credit card number, so that information is not sent to Kount.

Every transaction travels through the three sources listed above, is filtered through any applicable customer defined rules, and then is returned to the customer with a risk score and response.

The Magento Workflow Diagram below provides an overview of how a transaction flows through Magento once the Kount extension is installed.

mceclip0.png

The Kount Magento extension was written and is supported by a third-party development firm. Support and point releases are ongoing. If additional extensions or customizations have been added to your instance of Magento, conflicts might occur and can result in additional support and/or maintenance fees outside the Kount standard integration.

Kount Environments

Kount has separate environments for testing and production. The initial integration takes place in the Kount TEST environment. Boarding documents containing the information for the TEST environment are sent to the merchant by email. 

The TEST environment is not engineered to support load testing; it is designed primarily to verify connectivity and proper data submission. Many features such as order linking, scoring, device location, and persona-related information are disabled or limited in the TEST environment. PRODUCTION traffic should not be sent to the TEST environment due to the possibility of skewed scoring from the test orders.

Test credit cards can be passed into the TEST environment but fail in the PRODUCTION environment.

Port 443/HTTPS is required for submission and receipt of data in both the TEST and PRODUCTION environments.

API keys are required to authenticate to Kount and are created in the Agent Web Console (AWC). For more information on creating API keys, refer to How to Create an API Key for Authentication to Kount.

Integration Certification

Upon verification that the correct data is being passed for both the DDC and RIS, the merchant is issued a certification letter along with an additional boarding document providing the PRODUCTION environment information.

Any customized data created in the test environment must be recreated in the PRODUCTION environment. This includes users, rules, site IDs, user defined fields, and API keys.

The TEST environment is available to the merchant for testing purposes and must not be used for production transactional traffic.

Logging

Ensure logging is enabled before installation to facilitate troubleshooting. This setting can enable/disable logging for the Kount Extension.

Kount extension logging is also dependent on the Magento global logging settings.

Picture1.png

Note: The download link enables direct download access to the log files. Check your configuration file and make sure that logging is enabled in Magento.

Installing the Kount Magento extension

Note: Go to Magento 2 System Requirements for supplemental information to complete the following steps.

There are two methods for installing the Kount Magento Extension:

  • Composer - (KOUNT RECOMMENDED) Use the Composer package manager to define the Kount Magento Extension as a dependency in your project. Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on, and it installs and updates them for you. This installation method is useful if you are a developer already using Composer in your project or are interested in easily managing upgrades.
  • Manual copy - Decompress the extension archive and place the files in the appropriate file structure within your Magento installation. This method assumes the required SDK is also installed via composer found in the GitHub SDK repository. Installing the SDK via composer is the easiest path. Additional support is at the expense of the merchant.
Note: Follow each step precisely. Missing a step can cause unexpected results and/or issues in your Magento installation. If you encounter an issue that causes your installation to fail or you are seeing error messages, reinstall the module and then restart from the first step.

Merchant IDs and URLs associated with the DDC and RIS processes are sent within the Sandbox Boarding Information document during the initial kick-off call. A separate document for production is sent with the production service URLs once the test transaction is certified.

Installing using Composer

The module can be installed two different ways when using composer.

Install the Kount Magento 2 module using composer

  1. Copy the code below to install the Magento module and its dependencies.
    composer require kount/magento2-kount

    php bin/magento setup:upgrade

Install the Kount Magento 2 module using composer artifacts

  1. Enable the cache by going to System and then Cache Management before installing any extension.
  2. Download the extension zip archive and save it somewhere outside of your Magento project.
    Note: Make sure to download the SDK and the Magento Kount Module.
  3. Navigate to your Magento project root.
  4. Run the following composer command:
    composer config repositories.artifacts
        artifact </full/path/to/folder/with/extension/archive>
    The command adds the following code into the composer.json file in the repositories node. If the node does not exist, it is created.
    “artifacts”: {
    “type”: “artifact”,
    “url”: “/full/path/to/folder/with/extension/
    archive>” }
  5. Add composer artifact data to your composer.lock. Your composer.lock file
    looks similar to this:
    File example for composer.lock
    "name": "kount/kount-ris-php-sdk",
    "version": "7.3.9",
    "dist": {
    "type": "zip",
    "url": "artifacts/kount-ris-php-sdk.zip",
    "shasum": "4cb57a7c6ad2f168fec5fc6bf78bf763b5688e80"
    },
    "require": {
    "ext-curl": "*",
    "ext-json": "*",
    "ext-mbstring": "*",
    "ext-xml": "*",
    "php": ">=7.2.5"
    },
    "require-dev": {
    "phpdocumentor/phpdocumentor": ">=2.0",
    "phpunit/php-code-coverage": "^9.2.3",
    "phpunit/phpunit": "^9.5.3"
    },
    "type": "library",
    "autoload": {
    "classmap": [
    "./src/"
    ]
    },
    "notification-url": "https://packagist.org/downloads/", "license": [
    "proprietary"
    ],
    "authors": [
    {
    "name": "Kount",
    "email": "support@kount.com"
    }
    ],
    "description": "PHP client for Kount Risk Inquiry Service.",
    "homepage": "https://github.com/Kount/kount-ris-php-sdk",
    "keywords": [
    "payments",
    "sdk",
    "test"
    ],
    "support": {
    "issues": "https://github.com/Kount/kount-ris-php-sdk/issues",
    "source": "https://github.com/Kount/kount-ris-php-sdk/tree/7.3.9"
    },
    "time": "2021-03-26T12:46:42+00:00"
    },
    {
    "name": "kount/magento2-kount",
    "version": "4.3.4",
    "dist": {
    "type": "zip",
    "url": "artifacts/magento2-kount.zip",
    "shasum": "4cb57a7c6ad2f168fec5fc6bf78bf763b5688e80"
    },
    "require": {
    "kount/kount-ris-php-sdk": "^7.2",
    "magento/framework": "^102.0.0|^103.0.0",
    "magento/module-backend": "^100.0.0|^101.0.0|^102.0.0",
    "magento/module-checkout": "^100.0.0",
    "magento/module-config": "^100.0.0|^101.0.0", "magento/module-customer": "^100.0.0|^101.0.0|^102.0.0|^103.0.0",
    "magento/module-directory": "^100.0.0",
    "magento/module-payment": "^100.0.0",
    "magento/module-paypal": "^100.0.0|^101.0.0",
    "magento/module-sales": "^100.0.0|^101.0.0|^102.0.0|^103.0.0",
    "magento/module-store": "^100.0.0|^101.0.0"
    },
    "type": "magento2-module",
    "autoload": {
    "files": [
    "registration.php"
    ],
    "psr-4": {
    "Kount\\Kount\\": ""
    }
    },
    "notification-url": "https://packagist.org/downloads/", "license": [
    "proprietary"
    ],
    "authors": [
    {
    "name": "Kount",
    "homepage": "https://kount.com"
    }
    ],
    "description": "Magento 2 Kount Integration",
    "keywords": [
    "kount",
    "magento2"
    ],
    "support": {
    "issues": "https://github.com/Kount/magento2-kount/issues",
    "source": "https://github.com/Kount/magento2-kount/tree/4.3.4"
    },
    "time": "2021-10-04T14:50:30+00:00"
  6. Run composer command:
    composer require kount/magento2-kount
  7. Enable the module and upgrade the database by running the following commands:
    php bin/magento module:enable Kount_Kount

    php bin/magento setup:upgrade

Follow the extension specific setup steps now (as applicable) to finish installation.

Copying files

  1. Enable the cache by going to System, and then Cache Management before installing any extension.
  2. Open the extension ZIP file you downloaded from the Magento Marketplace and extract it to a directory on your computer using a tool like WinRar, WinZIP, or a similar program.
  3. Using the files extracted, copy <magento_root>/app/code/Kount/Kount of the Magento project.
  4. Using Command Line, terminal or use the following commands from the root of Magento project:
    php bin/magento module:enable Kount_Kount
    php bin/magento setup:upgrade
  5. Follow the extension specific setup steps now (as applicable) to finish installation.

Troubleshooting Installation

  • Module is not showing up in the admin panel or does not work as intended:
    Try manually deleting content of the /var/cache/, /var/generation/ and /var/di/ (/generated/ for Magento 2.2) directories. Remember that these directories are in the root of your Magento installation.
  • Module continues being hidden or inactive from your Magento installation:
    Doublecheck all files are in their correct respective locations per the file structure of the module and the official file structure of Magento. It is imperative that you do not forget to upload any single file as this could cause errors and/or unexpected behavior that you may be experiencing.
  • Module continues to remain inactive after the previous two attempts:
    Make sure your Magento installation has the correct file permissions for each uploaded file. Remember that the files must be readable by the web server to run properly.
  • Receiving errors that Class XYZ could not be found:
    Reinstall your module, making sure that you have triple checked all the correct files have been uploaded.
  • Receiving blank pages, 50x errors, or Exception printing is disabled:
    Enable developer mode in Magento to see the real error messages that are displaying.

Contact Kount Support if you continue to receive errors.

Configuration

The configuration of the Kount Magento Extension occurs within the Magento Admin Panel. Magento users must have the proper resource access within Magento to view and administer the Kount Magento Extension.

Once the Kount Magento Extension has been installed, follow the instructions below to configure Magento for Kount Command or Kount Control.

Configuring Magento for Kount Command

  1. Select Stores and then Configuration.
    mceclip3.png
  2. Select Stores, Configuration, and then Kount Integration.
    mceclip5.png

Configuring the Kount Integration Options

  1. Log into the Magento Admin Panel.
    mceclip0.png
  2. Configure Kount Integration Options by going to Stores and then Configuration.
    mceclip1.png
  3. Click the Kount Integration Options link.
    mceclip2.png
  4. Click on the arrows to expand each available option on the Kount Integration Options page.
    mceclip3.png

Account Information
mceclip5.png

Enabled: Toggle the Kount extension from being Enabled or Disabled in the Magento Order Management workflow.

Merchant Number: The merchant number issued by Kount. This merchant number is the same regardless if it is in the Kount Test or Production environment.

Website ID: On the initial install this field is set as Default. This allows multiple sites within the Magento instance to be managed by Kount. Different rules and searching features can be created for different sites.

Environment: This setting determines to which Kount environment the Magento instance is posting data.

API Key: The Kount Command API key is used for authentication and is created and visible within the AWC by going to Admin and then API Keys.

Payment Review Workflow
mceclip7.png

Payment Review Workflow Mode: Specify when Kount is queried.

  • Pre-Authorization Payment Review: Query Kount before the payment gateway.
  • Post-Authorization Payment Review: Query Kount after the payment gateway. For Post-Authorization transactions. There is not a notification presented to the customer upon checkout If a decline rule is triggered.

Decline Action: The Decline Action options are specific to Post-Authorization transactions. Based on the authorization strategy a merchant has chosen – whether to authorize and capture later or authorize and capture together – different decline actions are required to configure.

Hold Order/Decline Status: This places the order in a hold state but sets the status to decline within Magento. This allows merchants to release the order if the transaction was a false decline without making the customer resubmit the transaction.

  • Cancel Order/Void Payment: Select this option to cancel orders only when authorization happens at checkout and capture is separate.
  • Refund/Credit Order: Select this option to cancel orders where the transaction is authorized and captured at the same time.

Disable Payment Methods
mceclip8.png

Disable Payment Method Codes: If any of these payment methods are selected, a query is not sent to Kount for analysis. This functionality provides merchants the ability to whitelist payment methods that they do not want to be evaluated by Kount. 

We recommend that you whitelist the Kount scripts to bypass Content Security Policies (CSP), if the CSP Module is enabled.

CSP implementation example:

<?xml version="1.0" encoding="UTF-8"?>
<csp_whitelist
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 9 xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp:etc/csp_whitelist.xsd">
<policies>
<policy id="script-src">
<values>
<value id="kount" type="host">.kaptcha.com</value>
</values>
</policy>
<policy id="connect-src">
<values>
<value id="kount" type="host">.kaptcha.com</value>
</values>
</policy>
</policies>
</csp_whitelist>

Phone to Web: Admin Ordering

When a merchant submits phone orders with the same web page interface as a customer, the merchant’s device data – not the customer’s device data is sent to Kount. This causes order linking to occur and, in time, elevates the score of all orders associated with the persona.

The device data must be stopped from being sent to Kount. To block device data of customer service representatives from being sent to Kount, the Phone To Web configuration must be enabled and the IP addresses associated with the customer service network(s) must be added.
mceclip9.png

Logging

The logging functionality enables or disables logging Kount information to the server.
mceclip10.png

Configuring Magento for Kount Control

  1. Go to the Configuration page and select Kount 2FA.
  2. Under General Configuration, click the Enable drop-down menu and select Yes.
    mceclip0.png
  3. Click Save Configuration.
  4. Click Kount Integration.
    mceclip1.png
  5. Fill out the Account Information.
    • Enabled: Use the drop-down menu to select Yes.
    • Merchant Number: The merchant number issued by Kount. This merchant number is the same regardless if it is in the Kount Test or Production environment.
    • Website ID: During the initial install, this field is set as Default. This allows multiple sites within the Magento instance to be managed by Kount. Different rules and searching features can be created for different sites.
    • API Key: The Kount Control API key is generated by Kount and provided by your Solutions or Implementation Engineer.
  6. Fill out the Services Information form.
    mceclip2.png
    • Is Login API enabled: Use the drop-down menu to select Yes.
    • Is Trusted Device API enabled: The Trusted Device service might store a trust relationship between a device and a specific end-user. End-users use a small amount of devices to log in like a cell phone, work laptop, or home computer. By identifying these devices for specific end-users, the customer can reduce login times using policies to challenge end-users with an unknown device.
    • Amount of failed attempts to pass 2FA: Select the use system default checkbox for the default setting. The default value is zero. 
    • Is Sign-up API enabled: This option is responsible for an end-user's registration validation. If an end-user with decline@mail.com wants to register a new account, the email exists in AWC, and the status is set to Decline, registration will fail with an error message.
      mceclip3.png
      If a new end-user's email status is set to Approve or Review in AWC, then registration will continue to the next screen without an error code.

Policies

In order to change the module's behavior for testing purposes after logging in, create a Kount Test Portal account.

  1. After logging in, select Decision Manager, and then select Policies to edit the Swarming Demo Challenge policy.
    mceclip4.png
  2. In the Condition section, use the drop-down menu to select an option within the THEN section. Refer to the Conditions section below for information about specific condition options.
    mceclip5.png
  3. Click Save Policy.
    Note: Wait two to five minutes while the policy is applied.

Conditions

If conditions are true and the apply no decision option is selected, the end-user can log in without any checks and restrictions.

If conditions are true and the block option is selected, the end-user is redirected to the login page when they try to log in. This displays a message: The sign-in is not available for your customer account.

If conditions are true and challenge is selected, then the end-user is prompted with the 2FA Setup page. The Log Out link is the only available link from this page. When the user tries to log in again 2FA Setup page will be open.

  1. Enter invalid code. Message "Invalid 2FA Authentication Code" will appear.
  2. Enter invalid code N times (Path to the config: Admin / Stores / Configuration / Kount / Kount Control Integration / Amount of failed attempts to pass 2FA). If the checkbox “Use system value” is checked, then N = 0.

It will redirect to the Login page and show the message "Invalid 2FA Authentication Code. You have spent all possible tries to enter valid 2FA code. Please log in again!".

When a user tries to log in again 2FA Setup page is open. Scan QR-code (for example, via app “Google Authenticator”) and enter valid code. It can enter to customer account and show the message "2FA successfully set up"

Payment Workflow

Option 1: Pre-Authorization Payment Review

mceclip6.png

Option 2: Post-Authorization Payment Review

Picture2.png

Ability to Disable Payment Methods

mceclip7.png

Notifications

mceclip8.png

Logging

mceclip9.png

Admin Ordering

mceclip10.png

Ordering Settings

When an order is marked for review, the Kount module’s default state is set to automatically hide these orders for customers on the front-end of the Magento store.

If you wish to change the default, you are able to do so within the Admin panel. Change the answers to Yes to display the order to a customer after they have been marked for review.

Picture3.png

As illustrated in the Magento Payments Workflow Diagram, Kount is involved prior to or after the payment processor is queried for authorization. In the Pre-Authorization scenario, all transactions are processed by Kount. In the Post-Authorization scenario, the merchant chooses whether to pass on orders that were declined by the payment processor. Based upon the rules created by the merchant, one of four actions are returned from Kount: Decline, Approve, Escalate, or Review.

Pre-Authorization

Decline

When a transaction is evaluated by Kount and one or more merchant-created decline rule conditions are triggered, the order does not continue to the payment processor for authorization, and a failure message is presented to the customer. This allows merchants to create decline rule conditions and automatically stop transactions from being submitted to the payment processor.

Similar to when a transaction is declined by the payment processor, when transactions are declined by Kount, no reference of that transaction is found in the Magento Order Management panel. Since Kount is queried before the processor, declined transactions are displayed in the AWC.

Approve

When a transaction is evaluated by Kount and no merchant-created rule conditions for Decline, Review, or Escalate are triggered, the order is flagged with a status of Approve and continues to the payment processor for authorization. The default status within Magento for a Kount Approve order is Processing.
mceclip11.png

Post-Authorization

Decline

Unlike the Pre-Authorization workflow, when a transaction is evaluated by Kount and one or more merchant-created Decline rule conditions are triggered, the customer is not presented with an error popup or notification that the transaction failed.

Within Magento, the inventory is replaced. The order is then refunded if it was authorized and captured. If the order was only authorized during checkout, it is canceled.

The third option is to change the order status to On Hold.

Approve

When a transaction is evaluated by Kount and no merchant-created rule conditions are triggered, the order is flagged with a status of Approved. The default status within Magento for a Kount Approve order is Processing.
mceclip13.png

Review and Escalate

The order is flagged with a status of Review or Escalate and continues to the payment processor for authorization when a transaction is evaluated by Kount and one or more merchant-created rule conditions for Review or Escalate are triggered. The default status within Magento for a Kount Review or Escalate order is Review.

When a transaction is evaluated by Kount and one or more merchant-created rule conditions for Review or Escalate are triggered, the order is flagged as a status of Review or Escalate and continues to the payment processor for authorization. The default status within Magento for a Kount Review or Escalate Order is Review.
mceclip14.png

Managing Review Transactions

If ENS has been enabled, transactions administered within the AWC can interact with Magento. To enable ENS refer to the Configuration section.

The transaction is placed in an On Hold state within Magento and labeled with a status of Review when a transaction is flagged by Kount for Review or Escalate. Upon reviewing the transaction details within the AWC, each transaction can be manually approved or declined.

If ENS is configured, when changing the status of an order either approving or declining, an event is sent from Kount to the Magento server, and the order is removed from the Review status and placed back into the status prior to being placed in the On Hold state.

Manual Approve

When a transaction is manually approved within the AWC, an event is sent from Kount to Magento indicating an approved status. Within the Magento order management framework, the
transaction is removed from the Review status and returned to the status within Magento prior to being placed On Hold, which is normally Processing.

Manual Decline

When assigning a transaction to a Decline status within the AWC, an event is sent to Magento releasing the order from the Review status resulting in a Closed status and attempts to cancel the authorization and refund the charge.

Transactions flagged for Manual Review:
mceclip15.png

Transactions Manually Approved, Manually Declined, still in Review:
mceclip16.png

Inventory Management

No inventory is allocated from within Magento when a transaction is declined by either Kount or the payment processor. For orders that are flagged as Review, inventory is reserved for that item. If a transaction is being held and subsequently manually declined, the inventory item is returned and inventory incremented. Otherwise, if the transaction being held for review is manually approved the inventory remains decremented.

Payment Refunds

Pre-Authorization

Normally there are two options regarding credit card payment authorization: authorization and capture of funds together or capturing funds later.

If the online refund is not possible (typically when no payment has yet been made on the order and no invoice created), the extension attempts to cancel the order.

If an online refund is not possible or not successful, and it is not possible to cancel an order; the order is not set to the Kount Decline order status and placed in the On Hold order state.

Post-Authorization

A decline action must be specified when Post-Authorization is chosen within the Kount Integration Options.

For authorization, only the Cancel Order and Void Payment options are selected. When authorization and capture happens at the same time, the Refund/Credit Order option must be selected. This creates a credit memo and refund or it voids the payment record, depending on the payment method used on the order.

Orders submitted by Customer Service Representatives

There are two methods when submitting orders by customer service representatives. The first method is to create an order within the Magento Admin Console and the second is to submit the order as a customer through the site’s checkout page.

If orders are submitted through the Magento Admin Console and need to be evaluated by Kount, configure the Kount integration option for Admin Ordering to be enabled.
mceclip17.png

The Phone To Web option must be configured when orders are submitted through the customer checkout page. The IP address(es) of the service center must be added to the configuration. Once the IP address(es) is added, all device information related to the IP address is no longer associated with the transaction. This ensures that order linking based on the device does not occur.

Configuring Multiple Sites

Each site can be administered independently by Kount if multiple sites are administered within a single Magento instance. This can be accomplished by creating additional site IDs in the AWC and configuring the Magento Kount Integration Options.

  1. Click the Default Config drop-down menu and select Second Store View to access the additional site configuration within Magento.
    mceclip18.png
  2. In the Website ID field, deselect the Use Default checkbox and input the new Site ID that was created in the AWC.
    mceclip19.png
  3. Click Save Config.

ENS

Kount provides the ability to manually approve or decline transactions within the AWC, then have that action post back to the Magento instance. This interaction is dependent upon the ENS URL being configured within the AWC.

A load balancer is part of the network infrastructure and can be configured with Magento Admin Console. Within the Kount extension, security measures are implemented to protect against unauthorized submissions. Only ENS events sent from Kount are accepted. The ENS events are queued within Kount and then pushed out to the merchant. There can be up to a 30 second delay for the information to be updated between systems.

To begin, go to the Event Notifications section of the Kount Integration Options menu within the Magento Admin Panel. A portion of the URL string that is displayed is used for the configuration. 
mceclip0.png

Note: Additional IP addresses and IP ranges can be added in the Additional IPs for Load Balancer textbox.

Customizing the ENS Path Within the AWC

  1. Log into the AWC and go to Fraud Control and then the Websites menu:
    mceclip1.png
  2. If multiple sites are being hosted, choose the appropriate site, and click Edit (gear icon).
    mceclip2.png
  3. Choose the ENS Enabled radio button and then paste in the portion of the URL that was selected from the Event Notifications.
    mceclip3.png
  4. Click Update Website.
    Note: When adding or editing the ENS URL, there is a five-minute delay before the URL takes effect. It might be necessary to whitelist specific IP addresses for notifications to be delivered to the server. Contact a Customer Success Manager to obtain the ENS IP addresses.

User Defined Fields

User Defined Fields (UDFs) are fields related to your business that you want to pass to Kount to help you analyze an order. The Kount Magento Extension pre-populates UDF data for each transaction for the following default fields:

Name (Label) Description
ACCOUNT_NAME Saved name in the Magento account
CARRIER Shipping carrier sent from Magento
COUPON_CODE Coupon code passed in from Magento
EXT Magento Extension Version
METHOD Shipping Method sent from Magento
PLATFORM Magento Platform
AVS AVS response from gateway
CVV CVV response from gateway

To display the information in Transaction Details in the AWC, follow these steps to set up the UDFs (required for TEST and PROD environments):

  1. In the AWC, click the Fraud Control tab, then click User Defined Fields.
  2. On the User Defined Fields page, in the lower-right, click Add UDF.
  3. In the Add UDF field, in the Label textbox, enter the name of the UDF (from the list above, in all caps).
  4. In the Description field, enter the corresponding description (from the list above).
  5. From the Type drop-down menu, select Alphanumeric.
  6. Click Save UDF.
  7. Repeat these steps until all eight UDFs have been created.

Integrating Kount with a Custom Payment Method

Note: This documentation is meant for developers. You must be familiar with extending Magento functionality to integrate Kount with a custom payment method.

The extension defines a workflow interface, implemented for Pre-Authorization and Post-Authorization workflows.

interface WorkflowInterface
{
/**
* @param \Magento\Sales\Model\Order\Payment $payment
* @throws LocalizedException
*/
public function start(Payment $payment);
/**
* @param \Magento\Sales\Model\Order $order
* @throws LocalizedException
*/
public function failure(Order $order);
/**
* @param \Magento\Sales\Model\Order $order
* @throws LocalizedException
*/
public function success(Order $order);
  • The start method is called on the sales_order_payment_place_start event.
  • The success method is called on the checkout_submit_all_after event.
  • The failure method is called on the sales_model_service_quote_submit_failure event.

Standard Magento Payment Workflow

Kount works with all default Magento payment methods out of the box. The Kount extension collects all necessary data except payment (credit card) data. By default, it sets a “no payment” flag.

You need to add a custom RIS payment builder to send additional payment data to Kount. There are two payment builders available:

Note: If a custom payment workflow is not created, the default workflow is used \Kount\Kount\Model\Ris\Inquiry\Builder\Payment\NoPayment.
  • Inquiry builder: used for initial requests to Kount in both workflows (Pre-Authorization and Post-Authorization).
  • Update builder: used for updating a Kount account after a successful or failed order is placed. Should only be used with Pre-Authorization workflow.

Both RIS payment builders must implement the \Kount\Kount\Model\Ris\Base\Builder\PaymentInterface interface. It has one method, process(), which expects the RIS request and order payment objects as parameters.

The second step is an addition of these builders into RIS inquiry and update builders by using dependency injection (DI).

<virtualType
name="Kount\Kount\Model\Ris\Inquiry\Builder\Payment"
type="Kount\Kount\Model\Ris\Base\Builder\Payment">
<arguments>
<argument name="payments" xsi:type="array">
<item name="custom_payment_code" xsi:type="string">Custom\Inquiry\Payment\Builder</item>
</argument>
</arguments>
</virtualType>
<virtualType
name="Kount\Kount\Model\Ris\Update\Builder\Payment"
type="Kount\Kount\Model\Ris\Base\Builder\Payment">
<arguments>
<argument name="payments" xsi:type="array">
<item name="custom_payment_code" xsi:type="string">Custom\Inquiry\Payment\Builder</item>
</argument>
</arguments>
</virtualType>
Payment information which could be added to the RIS
request:
$request->setCardPayment() // card number
$request->setExpirationYear(); // expiration year
$request->setExpirationMonth(); //expiration month
$request->setAvst(); // AVS street address reply from
payment
$request->setAvsz(); // AVS zip code reply from payment
$request->setCvvr(); //CVV/CVC/CVV2 reply from payment
Note: Non-standard workflows include Authorize.Net, DirectPost, and PayPal Express Checkout.

Disabling calling workflow methods on default events

It might be necessary to disable calling workflow methods on the standard events and instead call them during other events.

Each observer for these events has a dependency on \Kount\Kount\Model\Observer\ConditionInterface. The default condition allows to execute an observer, and it's possible to configure conditions for each payment method via dependency injection. An example of this is done for Authorize.Net DirectPost on the checkout_submit_all_after event:

<virtualType name="Kount\Kount\Model\Observer\SubmitAllAfter\Condition" type="Kount\Kount\Model\Observer\Condition">
<arguments>
<argument name="conditions" xsi:type="array">
<item name="authorizenet_directpost" xsi:type="string">Kount\Kount\Model\Observer\Condition\Negative</item>
</argument>
</arguments>
</virtualType>

This disables the workflow method call on the checkout_submit_all_after event.

There are two already-implemented conditions in the extension, Negative and Positive, which could be used for enabling/disabling the calling of methods on events. If you wish to use any custom logic to determine the positive or negative conditional, simply create your own implementation of \Kount\Kount\Model\Observer\ConditionInterface.

Calling Workflow Methods on Custom Events

An example of calling workflow methods on custom events can be seen in the
\Kount\Kount\Plugin\PayPal\Controller\Payflow\ReturnUrl class. You need to add three dependencies to the custom observer:

/**
* @var \Kount\Kount\Helper\Workflow
*/
protected $helperWorkflow;
/**
* @var \Kount\Kount\Model\Config\Workflow
*/
protected $configWorkflow;

/**
* @var \Kount\Kount\Model\WorkflowFactory
*/
protected $workflowFactory;

And use them as such:
if (!$this->helperWorkflow->isProcessable($order))
{ return $result;
}

$workFlowType = $this->configWorkflow-
>getWorkflowMode($or- der->getStoreId());
$workFlow = $this->workflowFactory-
>create($workFlowType);

$workFlow->success($order); // or $workFlow-
>failure($order);

The success() and failure() methods require a \Magento\Sales\Model\Order $order object as a parameter. The start() method requires a \Magento\Sales\Model\Order\Payment $payment object as a parameter.

Keep in mind that the custom event must call the workflow’s methods for a specific payment method only. It is possible to reuse conditional logic with a default false condition, as it is done for \Kount\Kount\Observer\PaymentPlaceEnd observer (customization for Authorize.Net DirectPost):

Note: Authorize.net direct post is no longer supported.
<virtualType
name="Kount\Kount\Model\Observer\PaymentPlaceEnd\Conditio
n" type="Kount\Kount\Model\Observer\Condition">
<arguments>
<argument name="default" xsi:type="boolean">false</argument>
<argument name="conditions" xsi:type="array">
<item name="authorizenet_directpost" xsi:type="string">Kount\Kount\Observer\PaymentPlaceEnd\Condition\AuthorizeDirectPost</item>
</argument>
</arguments>
</virtualType>

Troubleshooting

  • The extension can be downloaded on the Kount Support Resource Center along with the TEST environment boarding information.
  • Ensure that the API key is used in the correct Kount environment. The TEST and PRODUCTION environments are completely isolated. It is impossible to utilize the correct API key between the two environments.
  • If the payment authorization rejection from the processor pop-up window keeps appearing when submitting an order, check in the kount.log file where the warnings or errors are displayed.
    mceclip4.png
    The default log location for the Kount extension is found in the following path:
    /var/www/magento/var/log

    Log file names: kount.log, exception.log, system.log

Frequently Asked Questions

Where can I find a list of RIS error codes?
Refer to RIS Error Codes.
What are some test scenarios for Magento?

Approve

  1. Add JohnDoeApprove@Acme.com email address to the VIP Approve list in the Kount Test environment.
  2. Place a test order using any item, via the front end of the test website.
    1. When filling out the customer information, please use JohnDoeApprove@Acme.com as the email address.
    2. Fill in necessary Test Credit Card information.
  3. Confirm that after the order has been placed that the proper customer experience message is displaying.
  4. Confirm that appears as approved in the Agent Web Console.

Decline

  1. Add JohnDoeDecline@Acme.com email address to the VIP Decline list in the Kount Test environment.
  2. Place a test order using any item, via the front end of the test website.
    1. When filling out the customer information, please use JohnDoeDecline@Acme.com as the email address.
    2. Fill in necessary Test Credit Card information.
  3. Confirm that after the order has been placed that the proper customer experience message is displaying.
  4. Confirm that appears as declined in the Agent Web Console.

Review

  1. Add JohnDoeReview@Acme.com email address to the VIP Decline list in the Kount Test environment.
  2. Place a test order using any item, via the front end of the test website.
    1. When filling out the customer information, please use JohnDoeReview@Acme.com as the email address.
    2. Fill in necessary Test Credit Card information.
  3. Confirm that after the order has been placed that the proper customer experience message is displaying.
  4. Confirm that appears as declined in the Agent Web Console.
    Note: Merchants are responsible for checking interaction with their OMS to validate expected behavior.

Optional Test Scenarios

Shipping/Billing Address Test Scenario

  1. Add JohnDoeReview@Acme.com email address to the VIP Review list in the Kount Test environment.
  2. Place a test order using any item, via the front end of the test website.
    1. When filling out the customer information, please use JohnDoeReview@Acme.com as the email address.
    2. Enter 1234 Main Street, Any Town, ID, USA 83705 for the Shipping Address.
    3. Enter 5678 Oak Street, Any Town, ID 83705 for the Billing Address.
    4. Fill in necessary Test Credit Card information.
  3. Confirm that after the order has been placed that the proper customer experience message is displaying.
  4. Confirm that the order is held as review in the Agent Web Console.
  5. Confirm the Shipping Address passed correctly.
  6. Confirm the Billing Address passed correctly.

Shipping Phone/Billing Phone Test Scenario

  1. Add JohnDoeReview@Acme.com email address to the VIP Review list in the Kount TEST environment.
  2. Place a test order using any item, via the front end of the test website.
    1. When filling out the customer information, please use JohnDoeReview@Acme.com as the email address.
    2. Enter 123-456-7890 for the Shipping Phone Number.
    3. Enter 102-345-6789 for the Billing Phone Number.
    4. Fill in necessary Test Credit Card information.
  3. Confirm that after the order has been placed that the proper customer experience message is displaying.
  4. Confirm that the order is held as review in the Agent Web Console.
  5. Confirm the Shipping Phone passed correctly.
  6. Confirm the Billing Phone passed correctly.

Order Number Test Scenario

  1. Add JohnDoeReview@Acme.com email address to the VIP Review list in the Kount Test environment.
  2. Place a test order using any item, via the front end of the test website.
    1. When filling out the customer information, please use JohnDoeReview@Acme.com as the email address.
  3. Confirm that after the order has been placed that the proper customer experience message is displaying.
  4. Confirm that the order is held as review in the Agent Web Console.
  5. Confirm that the order number has populated correctly.
    Note: Merchants are responsible for validating proper process management and testing interaction with their OMS to validate expected behavior.
What are the RIS payment types for Magento?

Kount is integrated with Magento with the following payment types supported natively within the Kount Magento Extension that provides cross-merchant linking with the Kount network:

  • Braintree
  • Authorize.net Direct Post
  • PayPal Express Checkout
  • PayPal Payflow Link
  • PayPal Payflow Pro
  • PayPal Payments Standard
  • PayPal Payments Pro
  • PayPal Payments Advanced
  • eWay (Magento Enterprise Edition)
Was this article helpful?
0 out of 0 found this helpful