Skip to main content

Configuration

Before using the KRA eTIMS OSCU SDKs, you must configure your environment variables and SDK bootstrap settings. This ensures proper authentication, OSCU initialization, and API usage.

⚠️ Important: CMC_KEY is obtained via selectInitOsdcInfo and must be stored securely. Do not commit secrets to version control.


PHP SDK Configuration

Load environment variables and bootstrap the SDK:

require_once __DIR__ . '/vendor/autoload.php';

use KraEtimsSdk\Services\AuthOClient;
use KraEtimsSdk\Services\EtimsOClient;

// Load env variables using dotenv if needed
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();

// SDK Config
$config = [
'env' => getenv('KRA_ENV') ?: 'sbx',
'auth' => [
'sbx' => [
'consumer_key' => getenv('KRA_CONSUMER_KEY'),
'consumer_secret' => getenv('KRA_CONSUMER_SECRET')
],
'prod' => [
'consumer_key' => getenv('KRA_CONSUMER_KEY'),
'consumer_secret' => getenv('KRA_CONSUMER_SECRET')
]
],
'oscu' => [
'tin' => getenv('KRA_TIN'),
'bhf_id' => getenv('KRA_BHF_ID') ?: '01',
'device_serial' => getenv('DEVICE_SERIAL'),
'cmc_key' => getenv('CMC_KEY') ?: '',
]
];

$auth = new AuthOClient($config);
$etims = new EtimsOClient($config, $auth);

Notes

  • Always use sandbox environment for development and testing.
  • Production credentials must never be used in dev or test environments.
  • Secure CMC_KEY properly; it's required for OSCU operations.
  • Refer to Initialization API to complete device registration.