首页
源码
关于
Search
1
luhn验证
9 阅读
2
git协同开发
7 阅读
3
微信公众号发送模版消息
7 阅读
4
银联商务支付对接
6 阅读
5
mysql大批量插入数据
5 阅读
PHP
Socket
Java
MYSQL
JS
Vue
ThinkPHP
Git
ts
Mac
登录
/
注册
Search
标签搜索
thinkphp
PHP
微信小程序
银联商务支付
支付
银联
luhn
luhn校验
mysql
mysql大批量插入数据
insert
load指令
tp
订阅消息
仓库
远程仓库
git仓库
git
git协同开发
微信
404
累计撰写
17
篇文章
累计收到
0
条评论
首页
栏目
PHP
Socket
Java
MYSQL
JS
Vue
ThinkPHP
Git
ts
Mac
页面
源码
关于
搜索到
1
篇与
的结果
2022-07-02
银联商务支付对接
测试期间不要设置白名单<? $appId = 'appId'; $appKey = 'appKey'; $mid = 'mid'; $tid = 'tid'; //业务内容az $time = time(); $content = [ 'requestTimestamp' => date('Y-m-d H:i:s', $time),//报文请求时间 'merOrderId' => '32AF' . date('YmdHis'),//商户订单号 'mid' => $mid,//商户号 'tid' => $tid,//终端号 'instMid' => 'H5DEFAULT',//业务类型 'totalAmount' => '1',//支付总金额 'expireTime' => date('Y-m-d H:i:s', strtotime('+1 day', $time)),//过期时间 'notifyUrl' => '',//支付通知地址 'returnUrl' => ''//网页跳转地址 ]; $timestamp = date('YmdHis', $time); //随机数 $str = md5(uniqid(mt_rand(), true)); $uuid = substr($str, 0, 8) . '-'; $uuid .= substr($str, 8, 4) . '-'; $uuid .= substr($str, 12, 4) . '-'; $uuid .= substr($str, 16, 4) . '-'; $uuid .= substr($str, 20, 12); $nonce = $uuid; //签名 $hash = bin2hex(hash('sha256', json_encode($content), true)); $hashStr = $appId . $timestamp . $nonce . $hash; $signature = base64_encode((hash_hmac('sha256', $hashStr, $appKey, true))); //$appKey银联商户H5支付产品的AppKey $data = [ 'timestamp' => $timestamp,//时间戳 'authorization' => 'OPEN-FORM-PARAM',//认证方式 'appId' => $appId,//APPID 'nonce' => $nonce,//随机数 'content' => urlencode(json_encode($content)),//业务内容 'signature' => urlencode($signature),//签名 ]; $options = ''; foreach ($data as $key => $value) { $options .= $key . '=' . $value .'&'; } $options = rtrim($options, '&'); //存在转义字符,那么去掉转义 if(get_magic_quotes_gpc()){ $options = stripslashes($options); } $url = 'https://api-mop.chinaums.com/v1/netpay/trade/h5-pay?' . $options; header("Location:$url");
2022年07月02日
6 阅读
0 评论
0 点赞