[下方更新]
我正在尝试以这种方式获取本机应用程序所需的 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
[更新]
将命令更改为 service_command,现在我收到此错误
Channel not configured for selected payment option