【问题标题】:Getting Problems to integrate payfort api in php在 php 中集成 payfort api 时遇到问题
【发布时间】:2017-04-09 16:52:09
【问题描述】:

我正在关注 (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.'

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

【问题讨论】:

    标签: php api payment payfort


    【解决方案1】:

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

    https://docs.payfort.com/

    【讨论】:

      【解决方案2】:

      您需要使用 Open API 密钥来完成身份验证。

      您应该在 Payfort 控制面板上找到它。

      注意:您的帐户可能不允许使用 Payfort 的 Start API。

      【讨论】:

        【解决方案3】:

        您需要使用Open API key来完成token,并使用secret key进行收费见链接:

        How to do payment using PayFort payment gateway?

        【讨论】:

          猜你喜欢
          • 2013-06-13
          • 1970-01-01
          • 1970-01-01
          • 2016-02-27
          • 2010-10-14
          • 2017-08-28
          • 1970-01-01
          • 2011-12-15
          • 1970-01-01
          相关资源
          最近更新 更多