Skip to content

Add Settings Configuration

preslav-anev edited this page Sep 4, 2017 · 22 revisions

Provide proper configuration settings

The file settings.ini contains basic configuration for the Kount RIS PHP SDK. Please make sure to set all the values appropriately before attempting to make a RIS request. The file is located in the zip SDK package hierarchy at the following path:

 kount-ris-php-sdk/
   --src/
      --settings.ini
Set the following keys to the desired values:
  MERCHANT_ID = 6-digit integer, referenced as MERCHANT_ID in code snippets
  URL = URL for RIS calls
  SITE ID = SITE_ID
  API_KEY = a JWT key used for authentication, in favor of the deprecated certificates
  CONFIG_KEY = an additional configuration key used within the SDK

⚠️ The CONFIG_KEY needs to be surrounded by single or double quotes and if they(", ') are present in the configuration key value they need to be escaped.

Custom Settings

You can also opt for custom settings. That can be achieved by creating your own settings file. This way you can avoid the hassle of having to configure the settings.ini file every time there is an update with the php sdk.

ℹ️ If you decide to go with this option it's highly recommended that you use the full layout and structure with all the keys and values from the original src/settings.ini file.

The only thing you need to do in order to use your own settings file is to provide the path to Kount_Ris_Request_Inquiry.

ℹ️ Recommendation : You should place your custom settings file in the root directory of your e-commerce application. That way you'll only need to provide the name of the settings file.

$customPathToSettingsFile = 'absolute-path-to-settings-file/customSettings.ini';
// the settings file can be a .ini file or a .txt file. 
// If you've placed your custom settings file in the root directory of your e-commerce application,
// you'll just need to provide the name of the settings file.
// $customPathToSettingsFile = 'customSettings.ini';

$inquiry = new Kount_Ris_Request_Inquiry(Kount_Util_Khash::createKhash($customPathToSettingsFile ));
// the Inquiry class will initialize an instance of Kount_Util_Khash and provide the absolute path for the settings file and thus receive the custom settings.

If you still wish to use the default src/settings.ini you can call the Kount_Ris_Request_Inquiry directly. And don't worry about supplying a null Khash object as a constructor parameter as it is null-safe and will not cause exceptions or errors.

$inquiry = new Kount_Ris_Request_Inquiry();
// just as valid, uses the default settings.ini file

Next Step

Clone this wiki locally