gpt4 book ai didi

php - 在 php 中集成 payfort api 时遇到问题

转载 作者:可可西里 更新时间:2023-10-31 23:45:30 26 4
gpt4 key购买 nike

我正在按照 ( https://docs.start.payfort.com/references/api/ ) 文档来实现 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(
"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() 并退出来打印变量详细信息,但出现了如下错误:

<b>Fatal error</b>:  Uncaught exception 'Start_Error_Authentication' with message 'Request can only be authenticated with an open API Key.'

请帮我解决这个问题。预先感谢您的关注。

最佳答案

请引用以下我认为是官方 PayFort 集成文档的文档。

https://docs.payfort.com/

关于php - 在 php 中集成 payfort api 时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40802416/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com