-
Notifications
You must be signed in to change notification settings - Fork 9
Example Usage
preslav-anev edited this page Apr 27, 2017
·
11 revisions
Once settings.ini file is in place, proceed with the following.
- Wrap the code inside of a try-catch block.
- Create a Kount_Ris_Request_Inquiry object or Kount_Ris_Request_Update object depending on if you are sending an initial request or updating a previous transaction.
- Call the setters required for the inquiry or update mode (Q is the default for inquiries and U is the default for updates).
- Call getResponse() on the inquiry or update object. A populated Kount.Ris.Response object will be returned. The Kount_Ris_Response object has many getters for using the RIS data.
Once a successful inquiry is made, incorporate as many additional setters to the object as are available before calling getResponse(). The more data provided in the object, the more accurate the risk assessment.
The following is sample code that illustrates these steps:
<?php
// RIS request --- requires curl support enabled in PHP
// php_mbstring support enabled in your php.ini file
include 'Kount/Ris/Request/Inquiry.php';
// Minimal RIS inquiry example:
try {
$inquiry = new Kount_Ris_Request_Inquiry();
$inquiry->setSessionId('session-id-max-32-chars');
$inquiry->setPayment('CARD', '4111111111111111');
$inquiry->setTotal(500);
$inquiry->setEmail('[email protected]');
$inquiry->setIpAddress('192.168.0.21');
$inquiry->setMack('Y');
$inquiry->setWebsite("SITE-1");
$cart = array();
$cart[] = new Kount_Ris_Data_CartItem("TV", "LZG-123", "32-inch LCD", 1, 129999);
$inquiry->setCart($cart);
$inquiry->setAuth('A');
// Setting user defined fields example
$inquiry->setUserDefinedField("label", "value");
// additional optional setters...
$inquiry->setDateOfBirth("YYYY-MM-DD");
// setGender value can be either "M" or "F"
$inquiry->setGender("M");
$response = $inquiry->getResponse();
// optional getter
$warnings = $response->getWarnings();
print $response;
$score = $response->getScore();
$auto = $response->getAuto();
} catch (Exception $e) {
print_r($e);
// handle exception
}
Getting Started
Using Our SDK
Advanced documentation