protected function doPay(Order $order)
    {
        if ('TEST' == Paybox::getConfigValue('mode', false)) {
            $platformUrl = Paybox::getConfigValue('url_serveur_test', false);
        } else {
            $platformUrl = Paybox::getConfigValue('url_serveur', false);
        }

        // Be sure to have a valid platform URL, otherwise give up
        if (false === $platformUrl) {
            throw new \InvalidArgumentException(
                Translator::getInstance()->trans(
                    "The platform URL is not defined, please check Paybox module configuration.",
                    [],
                    Paybox::MODULE_DOMAIN
                )
            );
        }

        $hashAlgo = $this->getHashAlgorithm();
        $clefPrivee = Paybox::getConfigValue('clef_privee');

        $paybox_params = $this->doPayPayboxParameters($order)
            + [
                'PBX_HASH' => $hashAlgo,
                'PBX_SECRET' => $clefPrivee
            ];

        // Generate signature
        $param = '';

        foreach ($paybox_params as $key => $value) {
            $param .= "&" . $key . '=' . $value;
        }

        $param = ltrim($param, '&');

        $binkey = pack('H*', $clefPrivee);

        $paybox_params['PBX_HMAC'] = strtoupper(hash_hmac($hashAlgo, $param, $binkey));

        return $this->generateGatewayFormResponse($order, $platformUrl, $paybox_params);
    }