我正在尝试设置 Payfort 我有一个包含此代码的配置文件(https://github.com/payfort/payfort-php-sdk)
[更新]:如何修改此链接中的 php 文件,以使 PayfortIntegration.php 文件中的金额、客户、商品名称、电子邮件和商家标识符(订单 ID)动态值不是静态的?
$objFort->merchantIdentifier = 'my_id';
$objFort->accessCode = 'my_access_code';
$objFort->SHARequestPhrase = 'request_phrase';
$objFort->SHAResponsePhrase = 'response_phrase@545';
在 PayfortIntegration.php 的主类中
class PayfortIntegration
{
public $merchantIdentifier, $accessCode, $SHARequestPhrase, $SHAResponsePhrase, $amount;
}
然后每次调用 route.php 文件时,我都会更改为这样的内容(如果未在 route.php 文件中设置金额,我会收到“无效金额错误”)
public function getMerchantPageData() //inside the main class in PayfortIntegration.php
{
$amount = $this->amount; //to get the amount value sent to the class from index.php
$merchantReference = $this->generateMerchantReference();
$returnUrl = $this->getUrl('route.php?r=merchantPageReturn&amount='.$amount);
}
在 index.php 中
require_once 'PayfortIntegration.php';
$objFort = new PayfortIntegration();
require 'config.php';
$amount = $_POST['amount'];
$objFort->amount = amount;
在 route.php 中
require_once 'PayfortIntegration.php';
$objFort = new PayfortIntegration();
require 'config.php';
$amount = $_REQUEST['amount'];
$objFort->amount = $amount;
但我收到“无效金额”错误。问题是如何以正确的方式将 amount 参数发送到 route.php?