<?php
$verificationCode = '6g8998f53f98d69cbdf07c789a7ec1284b9gaeab573a0dc94e76a4db9ceg21a4';
$request = [
"title" => "57c58ce24b1e15e8358b4568",
"body" => "57c58ce24b1e15e8358b4568",
"charset" => "UTF-8",
"isApp" => "app",
"defaultbank" => "ICBC",
"merchantId" => "100000000002698",
"notifyUrl" => "https://requestb.in/12q245v1",
"orderNo" => "57c58ce24b1e15e8358b4568",
"paymentType" => "1",
"paymethod" => "directPay",
"returnUrl" => "http://china.isitdomain.com",
"service" => "online_pay",
"totalFee" => "1.0"
];
// var_dump($request);
$request = array_filter($request);
// var_dump($request);
ksort($request);
var_dump($request);
// $signParams = [];
// foreach ($request as $key => $value) {
// $signParams[] = "{$key}={$value}";
// }
// $rawSign = implode('&', $signParams) . $verificationCode;
$rawSign = http_build_query($request) . $verificationCode;
var_dump($rawSign);
$sign = strtoupper(sha1($rawSign));
$url = "https://ebank.ztpo.cn/payment/v1/order/100000000002698-57c58ce24b1e15e8358b4567?";
$request['signType'] = 'SHA';
$request['sign'] = $sign;
$readyUrl = $url . http_build_query($request);
echo $sign, PHP_EOL;
echo $readyUrl, PHP_EOL;
- Output for 7.2.1, 7.3.24 - 7.3.33, 7.4.12 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
- array(13) {
["body"]=>
string(24) "57c58ce24b1e15e8358b4568"
["charset"]=>
string(5) "UTF-8"
["defaultbank"]=>
string(4) "ICBC"
["isApp"]=>
string(3) "app"
["merchantId"]=>
string(15) "100000000002698"
["notifyUrl"]=>
string(28) "https://requestb.in/12q245v1"
["orderNo"]=>
string(24) "57c58ce24b1e15e8358b4568"
["paymentType"]=>
string(1) "1"
["paymethod"]=>
string(9) "directPay"
["returnUrl"]=>
string(27) "http://china.isitdomain.com"
["service"]=>
string(10) "online_pay"
["title"]=>
string(24) "57c58ce24b1e15e8358b4568"
["totalFee"]=>
string(3) "1.0"
}
string(382) "body=57c58ce24b1e15e8358b4568&charset=UTF-8&defaultbank=ICBC&isApp=app&merchantId=100000000002698¬ifyUrl=https%3A%2F%2Frequestb.in%2F12q245v1&orderNo=57c58ce24b1e15e8358b4568&paymentType=1&paymethod=directPay&returnUrl=http%3A%2F%2Fchina.isitdomain.com&service=online_pay&title=57c58ce24b1e15e8358b4568&totalFee=1.06g8998f53f98d69cbdf07c789a7ec1284b9gaeab573a0dc94e76a4db9ceg21a4"
CCE781D3B36F70DD339E2E3869E19C4DFAE49C16
https://ebank.ztpo.cn/payment/v1/order/100000000002698-57c58ce24b1e15e8358b4567?body=57c58ce24b1e15e8358b4568&charset=UTF-8&defaultbank=ICBC&isApp=app&merchantId=100000000002698¬ifyUrl=https%3A%2F%2Frequestb.in%2F12q245v1&orderNo=57c58ce24b1e15e8358b4568&paymentType=1&paymethod=directPay&returnUrl=http%3A%2F%2Fchina.isitdomain.com&service=online_pay&title=57c58ce24b1e15e8358b4568&totalFee=1.0&signType=SHA&sign=CCE781D3B36F70DD339E2E3869E19C4DFAE49C16
preferences:
44.7 ms | 411 KiB | 5 Q