tansilu / hfpay-lib
There is no license information available for the latest version (0.0.3) of this package.
0.0.3
2026-03-09 10:33 UTC
Requires
- php: >=7.4
- ext-json: *
- guzzlehttp/guzzle: ^7.10
- php-di/php-di: ^6.4
Requires (Dev)
- phpunit/phpunit: ^9.6
This package is not auto-updated.
Last update: 2026-03-09 10:34:36 UTC
README
汇付SDK
使用PHP-DI容器
要求
php >= 7.4
配置
$config=[
//环境
'debug' => true,
//本地签名服务器
'sign_server' => '',
//版本号,默认为10
'version' => '10',
//商户ID
'mid' => '6666000100064457',
//签名服务器上的文件路径(非本地签名文件)
'sign_file' => '',
//签名密码
'sign_pwd' => '123456',
//签名服务器上的证书路径(非本地签名文件)
'cert_file' => ''
];
初始化
$client = HFPayClient::getInstance()->init($config);
使用
一. 市场接口
1. 开户
$client->market()->create()
2. 钱包管理
$client->market()->walletManage()
二. 查询接口
三.管理接口
四.交易接口
示例
<?php
$config = [
//使用环境
'debug' => true,
//本地签名服务器
'sign_server' => 'https://sign.location.server/',
'version' => '10',
//商户ID
'mid' => '666000001',
'sign_file' => '/CFCA/HF123.pfx',
'sign_pwd' => '123456',
'cert_file' => '/CFCA/cert/CFCA_1234.cer'
];
$client = HFPayClient::getInstance()->init($params);
// 使用
try{
$response=$client->query()->wallet('用户ID');
if($response->isSuccess()){
//获取原始HTML数据
$response->getSource();
//获取 array 结果
$response->getBody();
//获取解密后的结果
$response->getDecodeBody();
}
}catch (\Tansilu\HfPayLib\exception\SignException $e){
}catch (\Tansilu\HfPayLib\exception\BizException $e){
//
}
?>
回调通知处理
$checkValue=$_POST['check_value']
$sign=new \Tansilu\HfPayLib\library\impl\SignerHttpClient(
$config
);
$result=$sign->decode($checkValue);
print_r($result)