PayFort SDK令牌:无效的命令

时间:2018-04-08 11:21:42

标签: php sdk token payfort

[更新如下]

我正试图以这种方式获得原生应用中所需的sdk_token

$requestParams = array(
        'access_code'         => $this->PayfortAccessCode ,
        'amount'              => floatval($amount)*100,
        'currency'            => strtoupper($currency),
        'customer_email'      => $email,
        'merchant_reference'  => $order_id,
        'order_description'   => $order_description,
        'language'            => $this->PayfortLanguage,
        'merchant_identifier' => $this->PayfortMerchantID,
        'payment_option'      => $payment_option,
        'command'             => 'SDK_TOKEN',
        'return_url'          => $this->PayfortReturnUrl,
        'customer_name'       => $customer_name,
        'customer_ip'         => ''//$this->CI->input->ip_address()
    );

 $filtered_params = array_filter($requestParams);
 ksort($filtered_params);

$this->setEncryptionKey($this->PayfortRequestEncryptionKey);
$postData = array();
foreach ($filtered_params as $name => $value) {
    $postData[strtolower(htmlentities($name))] = htmlentities($value);
}
$postData['signature'] = $this->generate_signature($filtered_params);

$requestParams=json_encode($parameters['post_data']);

 $result = file_get_contents('https://paymentservices.payfort.com/FortAPI/paymentApi', null, stream_context_create(array(
         'http' => array(
                'method' => 'POST',
                'header' => 'Content-Type: application/json' . "\r\n"
                        . 'Content-Length: ' . strlen($requestParams) . "\r\n",
                'content' => $requestParams,
            ),
         )
     ));

$result=json_decode($result);
print_r($result);

代码分为多个文件,但我在此处将其视为一个文件。问题是我通过“无效命令”错误获得此响应

stdClass Object
(
[amount] => 2130
[response_code] => 00004
[signature] => signature_here
[merchant_identifier] => id_here
[access_code] => code_here
[language] => en
[command] => SDK_TOKEN
[response_message] => Invalid command
[merchant_reference] => reference_here
[customer_email] => email_here
[return_url] => url_here
[currency] => currency_symbol_here
[customer_name] => customer_name_here
[status] => 00
)

那么如何解决这个问题才能获得SDK_TOKEN

[UPDATE]

将Command更改为service_command,现在我收到此错误

Channel not configured for selected payment option

1 个答案:

答案 0 :(得分:0)

要添加新服务或命令,我必须致电支持部门来执行此操作。