Managing shop settings via a configuration file

Using a configuration file allows to avoid including hard-coded values in the code.

The configuration files may contain:

  • the payment page URL,
  • the test and production keys,
  • the shop ID,
  • etc.

These files allow to sort the data to be saved.

The program that generates the payment form interrogates the configuration file to know the value of a parameter.

It is the merchant's responsibility to do anything in his or her power to limit the access to the configuration file (.htaccess file, rewrite the URL, etc.).

Example of "conf.txt" configuration file:
vads_site_id = 11111111
TEST_key = 2222222222222222
PROD_key = 3333333333333333
vads_ctx_mode = TEST
Example of a call to configuration file in the payment form:
$conf_txt = parse_ini_file("conf.txt");
	if ($conf_txt['vads_ctx_mode'] == "TEST") $conf_txt['key'] = $conf_txt['TEST_key'];
	if ($conf_txt['vads_ctx_mode'] == "PRODUCTION") $conf_txt['key'] = $conf_txt['PROD_key'];