You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
1 week ago | |
|---|---|---|
| src | 1 week ago | |
| .gitignore | 1 week ago | |
| README.md | 1 week ago | |
| composer.json | 1 week ago | |
| phpunit.xml | 1 week ago | |
README.md
说明
汇付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)