public static function createToken($cardNumber = null, $cardHolder = null, $cardExpiryMonth = null, $cardExpiryYear = null, $cardSecurityCode = null, $firstname = null, $lastname = null, $paymentproductswitcher = null)
 {
     try {
         $hipay = new HiPay_Tpp();
         HipayLogger::addLog($hipay->l('Token Create call initiated', 'hipay'), HipayLogger::APICALL, 'Action : Create Token');
         define('API_ENDPOINT_TOKEN', HipayClass::getAPITokenURL());
         define('API_USERNAME_TOKEN', HipayClass::getAPIUsername());
         define('API_PASSWORD_TOKEN', HipayClass::getAPIPassword());
         $credentials_token = API_USERNAME_TOKEN . ':' . API_PASSWORD_TOKEN;
         $resource_token = API_ENDPOINT_TOKEN . 'create';
         // Multi_use : only boolean
         // 0 = Generate a single-use token
         // 1 = Generate a multi-use token (default)
         $multi_use = 1;
         if ($paymentproductswitcher == 'american-express') {
             $data_token = array('card_number' => $cardNumber, 'card_expiry_month' => $cardExpiryMonth, 'card_expiry_year' => $cardExpiryYear, 'firstname' => $firstname, 'lastname' => $lastname, 'cvc' => $cardSecurityCode, 'multi_use' => $multi_use);
         } elseif ($paymentproductswitcher == 'bcmc') {
             $data_token = array('card_number' => $cardNumber, 'card_expiry_month' => $cardExpiryMonth, 'card_expiry_year' => $cardExpiryYear, 'card_holder' => $cardHolder, 'multi_use' => $multi_use);
         } else {
             $data_token = array('card_number' => $cardNumber, 'card_expiry_month' => $cardExpiryMonth, 'card_expiry_year' => $cardExpiryYear, 'card_holder' => $cardHolder, 'cvc' => $cardSecurityCode, 'multi_use' => $multi_use);
         }
         // create a new cURL resource
         $curl_token = curl_init();
         // set appropriate options
         $options_token = array(CURLOPT_URL => $resource_token, CURLOPT_USERPWD => $credentials_token, CURLOPT_HTTPHEADER => array('Accept: application/json'), CURLOPT_RETURNTRANSFER => true, CURLOPT_FAILONERROR => false, CURLOPT_HEADER => false, CURLOPT_POST => true, CURLOPT_POSTFIELDS => http_build_query($data_token), CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false);
         foreach ($options_token as $option => $value) {
             curl_setopt($curl_token, $option, $value);
         }
         $result_token = curl_exec($curl_token);
         $status_token = (int) curl_getinfo($curl_token, CURLINFO_HTTP_CODE);
         $response_token = Tools::jsonDecode($result_token);
         // execute the given cURL session
         if (false === $result_token) {
             throw new Exception(curl_error($curl_token));
         }
         if (floor($status_token / 100) != 2) {
             throw new Exception($status_token);
         }
         curl_close($curl_token);
         HipayLogger::addLog($hipay->l('Token Create call success', 'hipay'), HipayLogger::APICALL, 'Creation token avec success');
         return $response_token;
     } catch (Exception $e) {
         HipayLogger::addLog($hipay->l('Token Create call status error', 'hipay'), HipayLogger::ERROR, Db::getInstance()->escape($e->getMessage()));
         return $e->getMessage();
     }
 }