For a complete integration you must include the Device Data Collector as well as the Risk Inquiry Service POST. It is recommended that you code for the Device Data Collector first.
For release notes, refer to Kount Risk Inquiry Service .NET SDK Release Notes History.
Note
If you are migrating from Command to Kount 360, you must have an API key for both products. Both API keys are required for integration so you can transfer traffic from Command to Payments Fraud. Go to EMBEDDED LINK for more information.
To install the latest Risk Inquiry Service .NET SDK, we recommend using the NuGet package manager. Enter the following command in the NuGet console:
nuget install Kount.Net.RisSDK
For information on how to build the Risk Inquiry Service .NET SDK from the GitHub SDK repository, refer to the Building the RIS .NET SDK from the GitHub repository.
Before you make your first Risk Inquiry Service call, you must have the following:
-
Client ID, six-digit integer, referenced as
Ris.MerchantIdin code snippets (provided by your Kount representative) -
URL for (test) RIS calls as
Ris.Url -
API key,
Ris.API.Key -
An additional configuration key used within the SDK,
Ris.Config.Key
Note
If any of these characters (", \``, or '`) are in the configuration key value, those need to be removed from the command line.
In your app or web configuration file, in the appsettings.json section, add your basic configuration. Before using the SDK, you must set the Client ID and RIS URL to the config file.
The following table describes the required static settings found in the SDK:
|
Data |
Size |
Description |
Example |
|
|
6 |
Six digit identifier issued by Kount. |
999666 |
|
|
na |
HTTPS URL path to the company’s servers provided in boarding documentation from Kount. |
|
|
|
Varies |
API Key value copied from clipboard - originating from API Key page within Agent Web Console. |
Alpha/Numeric hashed value provided by Kount |
|
|
Varies |
Config Key used in hashing method. |
String key provided by Kount |
|
|
Varies |
RIS connect timeout value measured in milliseconds. |
30000 |
|
|
na |
Specifies which logger to use: SIMPLE or NOP. |
|
|
|
na |
If SIMPLE logging is enabled, this lists logging levels in order of decreasing severity: FATAL, ERROR, WARN, INFO, DEBUG |
|
|
|
na |
Name of the log file for SIMPLE logging. |
|
|
|
na |
SimpleLogger log path. This is the directory where the log file will be located. |
|
|
|
na |
When is |
|
Note
If LOG.SIMPLE.PATH log path not exist, it is created dynamically.
-
Add the
Kount.NETlibrary to your project. -
Create a
Kount.Ris.Inquiry Object, then populate the setters. -
Add the cart data.
-
Ask for the
responger(Inquiry.GetResponse()). -
Process the
Kount.Ris.Responseobject returned.
This is a description of what happens during request creation.
-
Create masked inquiry with CARD payment, and populate the setters.
Note
KHASH is the default implementation for payment encryption and requires a config key. Masking overrides the default KHASH implementation, masks payment tokens, and does not require a config key.
-
Set the request mode. As mentioned previously, there are several request modes and
InquiryType.ModeQis the most used one. -
Set a session identifier. This ID should be unique for a 30-day span and is used to track all changes regarding the purchase described in the request. More information on the Advanced page.
-
Obtain the end user's IP address. The customer can discover it or it can be obtained through the Data Collector service.
-
Provide the total purchase amount represented in the lowest possible currency denomination (example: cents for US Dollars).
After a customer has posted RIS information to Kount, a key-value pair string will be returned back to the customer. The RIS response format is the same that was specified in the RIS request, with the default being named pairs. Each data field must be invoked by getter methods on the response object from the SDK. The customer can then use the RIS response to automate the order management process by keying off of the AUTO field and can utilize any of the additional data returned for internal processing.
An important use of the RIS response is the ability to view any warnings or errors that were made during the RIS POST from the customer. All warnings are displayed in the response and if errors do occur the RIS response is returned with a MODE = E.
If the Device Data Collector was used to collect customer information, the KAPT field can be checked to determine if this process was successful. KAPT = Y means successful, KAPT = N means the process was unsuccessful.
When using the SDK, KHASH, and MASK are available.
In .NET Risk Inquiry Service SDK version 5.0.0+, all payment tokens are hashed (one-way encryption) prior to being transmitted to Kount. No credit card numbers, Paypal payment IDs, check numbers, Google Pay IDs, Bill Me Later IDs, Green Dot MoneyPak IDs, gift card numbers, and so on are transmitted in plain text. When the payment type is a credit card (optional for all other payment types), you must send data in the LAST4 input field. The value of this field is the last four numbers/characters of the payment token. The SDK automatically sets this value prior to hashing the payment token for all payment types.
Output : BIN + 14 alpha-numeric characters. Example: "123456A12C34E56G7DFG"
Note
When using the .NET SDK all credit card information, by default, uses the KHASH encryption method where the credit card information is irreversibly hashed prior to transmission from the merchant to Kount.
KHASH Code Example
/// <summary>
/// Create inquiry with CARD payment
/// </summary>
/// <param name="cardNumber">card number</param>
/// <param name="sid">session id</param>
/// <param name="orderNum">order number</param>
/// <returns>inquiry</returns>
public static Inquiry CreateInquiry(string cardNumber, out string sid, out string orderNum)
{
// create inquiry with default settings
Inquiry inquiry = DefaultInquiry(out sid, out orderNum);
// hashing card number
inquiry.SetCardPayment(cardNumber);
return inquiry;
}
In the .NET SDK, version 6.9.5 is implemented as new method Request.SetCardPaymentMasked(string cardNumber), which sets a card payment and masks the card number.
MASK Code Example
/// <summary>
/// Create masked inquiry with CARD payment
/// </summary>
/// <param name="cardNumber">card number</param>
/// <param name="sid">session id</param>
/// <param name="orderNum">order number</param>
/// <returns>masked inquiry</returns>
public static Inquiry CreateInquiryMasked(string cardNumber, out string sid, out string orderNum)
{
// create inquiry with default settings
Inquiry inquiry = DefaultInquiry(out sid, out orderNum);
// mask card number
inquiry.SetCardPaymentMasked(cardNumber);
return inquiry;
}
The two major request types, Inquiry and Update, are configured by setting the MODE parameter to the correct value.
Use Inquiry for initial registration of the purchase in the Kount system. It has four available values for the MODE parameter:
|
Inquiry MODE |
SDK Constant |
Description |
|
Q |
|
Default inquiry mode, internet order type |
|
P |
|
Used to analyze a phone orders |
|
W |
|
Full inquiry with returned thresholds |
|
J |
|
Fast inquiry with thresholds only |
Use Update whenever there are changes to a given order that need to be updated in the Kount system. Update has two available values for the MODE parameter:
|
Update MODE |
SDK Constant |
Description |
|
U |
|
Default update mode, only sends the update event |
|
X |
|
Sends the update event and RIS service returns a status response |
|
Parameter name |
Setter |
Mode Q |
Mode P |
Mode W |
Mode J |
Mode U |
Mode X |
|
|
|
Y |
Y |
Y |
Y |
Y |
Y |
|
|
|
Y |
Y |
Y |
Y |
Y |
Y |
|
|
|
Y |
Y |
Y |
Y |
Y |
Y |
|
|
|
Y |
Y |
Y |
|||
|
|
|
Y |
Y |
Y |
Y |
Y |
|
|
|
|
Y |
Y |
Y |
Y |
||
|
|
|
Y |
Y |
Y |
Y |
||
|
|
|
Y |
Y |
||||
|
|
Y |
Y |
Y |
Y |
|||
|
|
|
Y |
Y |
Y |
Y |
||
|
|
|
Y |
Y |
Y |
Y |
Y |
|
|
|
|
Y |
Y |
||||
|
|
* |
Y |
Y |
Y |
|||
|
|
* |
Y |
Y |
Y |
|||
|
|
* |
Y |
Y |
Y |
|||
|
|
* |
Y |
Y |
Y |
|||
|
|
|
Y |
Note
Parameters marked with an asterisk (*) are the shopping cart parameters. They are bulk-set by the Inquiry.setCart(collection<CartItem> cart) method. If the shopping cart contains more than one entry, values for each parameter are transformed to single concatenated strings and then set to the corresponding parameter.
The Risk Inquiry Service provides optional request parameters to increase precision when making a decision about a given purchase/order.
-
AUTH: Authorization Status returned to merchant from processor. Acceptable values for theAUTHfield areAfor Authorized orDfor Decline. In orders whereAUTH = Awill aggregate towards order velocity of the persona while orders whereAUTH = Dwill decrement the velocity of the persona. -
AVST: Address Verification System Street verification response returned to merchant from processor. Acceptable values areMfor match,Nfor no-match, orXfor unsupported or unavailable. -
AVSZ: Address Verification System Zip Code verification response returned to merchant from processor. Acceptable values areMfor match,Nfor no match, orXfor unsupported or unavailable. -
CVVR: Card Verification Value response returned to merchant from processor. Acceptable values areMfor match,Nfor no-match, orXunsupported or unavailable. -
LAST4: Last 4 numbers of Credit Card Value. -
LBIN: Captures between 6 and 8 characters of BIN data.
You can create User Defined Fields (UDFs) to include additional information related to your business that is not a standard field in the Transactions Details page in the Agent Web Console. Once you have defined the UDF in the Agent Web Console, you can pass this data into Kount via an array called UDF as key-value pairs where the label is the key and the data passed in is the value. For more information on creating UDF, review Managing User Defined Fields.
There are a few parameters responsible for maintaining connection between linked interactions with the RIS. They are transported as a part of the request or response objects during standard RIS communication.
This parameter should be created by the customer at the start of each new end user purchase. SESS is used to join the customer device data with the order data sent with the RIS request. If the customer uses the Device Data Collector service to obtain customer device information, then the same SESS value must be used for all RIS calls starting with the one to the Device Data Collector service. Requirements for the parameter value are:
-
Alphanumeric
-
1-32 characters
-
Value should be unique over a thirty-day period of time SESS is a mandatory parameter set by
Request.session_set(string)method.
The TRAN parameter is required for Update calls to Kount RIS. Its value is created by Kount and is returned within the Response object for the first RIS Inquiry. For all subsequent events, modifying this particular customer order, the TRAN parameter should be set to the Kount-created value.
The Kount Risk Inquiry Service .NET SDK includes a basic logging framework abstraction. This allows your logging framework to be integrated with the SDK. By default, the SDK provides two basic loggers: NOP and SIMPLE.
NOP is a logger that discards all logging. This is the default logger used by the .NET RIS SDK. SIMPLE is a logger that logs messages to a specified file on the SDK host-machine.
The SIMPLE logger can be configured in your App.config. The following logging levels are available in order of decreasing severity: FATAL, ERROR, WARN, INFO, and DEBUG.
We recommend the following steps to integrate a custom logger with the SDK:
-
Create the class
Kount.Log.Factory.LoggerXFactorythat implementsKount.Log.Factory.LoggerFactory. -
Create
Kount.Log.Binding.LoggerXclass that implementsKount.Log.Binding.Logger.This class is the interface to your custom loggerX.
-
Set your logger factory using the method
Kount.Log.Factory.LogFactory.SetLoggerFactory().
The end user can provide their implementation of ILogger and use it to capture Kount SDK logs. The abstract logger overrides the SimpleLogger configuration.
Create the ILogger instance and pass it to the Kount Inquiry object constructor.
Abstract Logger Example
using var loggerFactory = LoggerFactory.Create(builder =>
{
builder.
SetMinimumLevel(LogLevel.Error)
.AddConsole().AddFile("C:/Logs/logfilename.txt");
});
ILogger logger = loggerFactory.CreateLogger<Program>();
// Passing ILogger reference to Kount.Ris.Inquiry
Inquiry inquryObj = new Inquiry(logger);
We recommend using the Package Manager. Only build the Risk Inquiry Service .NET SDK if it is required for your environment.
There are two integration test modules in the folder structure: pre-configuration (KountRisTest) and post-configuration (KountRisConfigTest).
Option 1: Pre-Configuration
-
Before running
build_sdk.batchange paths settings inzipBuild.ps1(PS script file) according to the installed Visual Studio version.Visual Studio 2013
# Paths settings for VS 2013 $VSPath = "C:\Program Files (x86)\Microsoft Visual Studio 12.0" $MSBuildPath = "C:\Program Files (x86)\MSBuild\12.0\Bin"
Visual Studio 2015
# Paths settings for VS 2015 $VSPath = "C:\Program Files (x86)\Microsoft Visual Studio 14.0" $MSBuildPath = "C:\Program Files (x86)\MSBuild\14.0\Bin"
Visual Studio 2017
# Paths settings for VS 2017 $VSPath = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community" $MSBuildPath = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin"
-
Run
build_sdk.batfrom thebuildsfolder.
Option 2: Post-Configuration
Open KountSdk.sln in Visual Studio and build KountSdk.sln.
For more information about the Risk Inquiry Service, go to: