PHP code example of youhujun / bs-pay-sdk
1. Go to this page and download the library: Download youhujun/bs-pay-sdk library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
youhujun / bs-pay-sdk example snippets
use YouHuJun\BsPaySdk\core\BsPay;
use YouHuJun\BsPaySdk\request\V2MerchantBusiOpenRequest;
use YouHuJun\BsPaySdk\core\BsPayClient;
BsPay::init('./config/config.json');
$request = new V2MerchantBusiOpenRequest();
$param = array(
"funcCode" => $request->getFunctionCode(),
"params" => array(
"req_seq_id" => date("YmdHis").mt_rand(),
"req_date" => date("Ymd"),
"huifu_id" => "6666000104778898",
"upper_huifu_id" => "6666000003080000",
"balance_pay_config" => json_encode(array(
"fee_rate" =>"2",
"fee_fix_amt" =>"1",
),JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES),
));
$client = new BsPayClient();
$result = $client->postRequest($param);
// p($result);die;
if (!$result || $result->isError())
{ //失败处理
p($result -> getErrorInfo());
}
else
{ //成功处理
p($result);
}
if(function_exists('p'))
{
function p($param)
{
echo "<br/>";
print_r($param);
echo "<br/>";
}
}