在php中集成payfort api时遇到的问题
我遵循()文档来实现Payfort支付Api,但我面临问题。有人能帮我解决这些问题吗 我在Api中使用以下代码:在php中集成payfort api时遇到的问题,php,api,payment,payfort,Php,Api,Payment,Payfort,我遵循()文档来实现Payfort支付Api,但我面临问题。有人能帮我解决这些问题吗 我在Api中使用以下代码: <?php require_once('lib/Start.php'); // Enter secret key here Start::setApiKey('test_sec_k_9d19ef5bd543507e333ba7b'); //Create a new token for customer $token = Start_Token::create(array(
<?php
require_once('lib/Start.php');
// Enter secret key here
Start::setApiKey('test_sec_k_9d19ef5bd543507e333ba7b');
//Create a new token for customer
$token = Start_Token::create(array(
"number" => "4242424242424242",
"exp_month" => 06,
"exp_year" => 2018,
"cvc" => "123",
"name" => "Abdullah Mohammed"
));
echo "<pre>"; print_r($token); exit;
$result = Start_Charge::create(array(
"amount" => 1000,
"currency" => "aed",
"metadata" => array(
"reference_id" => "1234567890",
"tag" => "new"
),
"card" => array(
"name" => "Abdullah Ahmed",
"number" => "4242424242424242",
"exp_month" => 06,
"exp_year" => 2018,
"cvc" => "123"
),
"description" => "Two widgets (test@example.com)",
"email" => "abc@gmail.com"
));
try {
// Use Start's bindings...
} catch(Start_Error_Banking $e) {
// Since it's a decline, Start_Error_Banking will be caught
print('Status is:' . $e->getHttpStatus() . "\n");
print('Code is:' . $e->getErrorCode() . "\n");
print('Message is:' . $e->getMessage() . "\n");
} catch (Start_Error_Request $e) {
// Invalid parameters were supplied to Start's API
} catch (Start_Error_Authentication $e) {
// Invalid API key
} catch (Start_Error_Processing $e) {
// Something wrong on Start's end
} catch (Start_Error $e) {
// Display a very generic error to the user, and maybe send
// yourself an email
} catch (Exception $e) {
// Something else happened, completely unrelated to Start
}
?>
在上面的代码中,我使用print_r()和exit来打印变量详细信息,但得到的错误如下:
致命错误:未捕获的异常“启动\u错误\u身份验证”,消息为“只能使用打开的API密钥对请求进行身份验证”
请帮我解决这个问题。
提前感谢您的关注。请参考以下文档,我认为这是PayFort集成的官方文档
您需要使用开放式API密钥来完成身份验证 您应该在Payfort控制面板上找到它
注意:您的帐户可能不允许使用Payfort提供的Start API。您需要使用开放式API密钥来完成令牌,并使用保密密钥收费请参阅链接:
<b>Fatal error</b>: Uncaught exception 'Start_Error_Authentication' with message 'Request can only be authenticated with an open API Key.'