1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <!doctype html>
- <html>
- <head>
- <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
- <meta http-equiv="Expires" CONTENT="0">
- <meta http-equiv="Cache-Control" CONTENT="no-cache">
- <meta http-equiv="Pragma" CONTENT="no-cache">
- <title>微信支付</title>
- </head>
- <style>
- body iframe{
- display: none;
- opacity: 0;
- }
- </style>
- <body style="width:100%;height:100%;text-align: center;">
- <div style="color:#FFF;margin-top:40px;">
- </div>
- <script type="text/javascript">
- window.alert = function(name){
- var iframe = document.createElement("IFRAME");
- iframe.style.display="none";
- iframe.setAttribute("src", 'data:text/plain,');
- document.documentElement.appendChild(iframe);
- window.frames[0].window.alert(name);
- iframe.parentNode.removeChild(iframe);
- };
- //调用微信JS api 支付
- function jsApiCall()
- {
- WeixinJSBridge.invoke(
- 'getBrandWCPayRequest',<?php echo $jsApiParameters; ?>,
- function(res){
- if (res.err_msg == 'get_brand_wcpay_request:ok') {//支付成功
- goNotice();
- } else if (res.err_msg == 'get_brand_wcpay_request:cancel') {//支付过程中用户取消
- alert('取消支付/(ㄒoㄒ)/~~');
- goNotice();
- } else if (res.err_msg == 'get_brand_wcpay_request:fail') {//支付失败
- alert('支付失败/(ㄒoㄒ)/~~');
- goNotice();
- }
- }
- );
- }
- function goNotice(){
- window.location.href = '<?php echo $notify_url; ?>';
- return true;
- }
- function callpay()
- {
- if (typeof WeixinJSBridge == "undefined"){
- if( document.addEventListener ){
- document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
- }else if (document.attachEvent){
- document.attachEvent('WeixinJSBridgeReady', jsApiCall);
- document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
- }
- }else{
- jsApiCall();
- }
- }
- function writeObj(obj){
- var description = "";
- for(var i in obj){
- var property=obj[i];
- description+=i+" = "+property+"\n";
- }
- alert(description);
- }
- callpay();
- </script>
- </body>
- </html>
- <?php exit;?>
|