Managing the shop settings using a configuration file

Using a configuration file allows to avoid hard coding.

The configuration files may contain:

  • the payment page URL,
  • the certificate value
  • the shop ID,
  • etc.

These files allow to characterize the stored data.

The program that generates the payment form will call the configuration file with the parameter for using the value.

The merchant must make sure:

  • to check the file permissions so that it is not accessible from outside,
  • to take into account the nature of the programming language that was used.
Example of the "conf.txt" configuration file:
vads_site_id = 11111111
TEST_key = 2222222222222222
PROD_key = 3333333333333333
vads_ctx_mode = TEST
Example of a call of the 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'];