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.

49 lines
1.3 KiB

7 years ago
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta name="viewport" content="width=device-width,height=device-height,maximum-scale=1.0,user-scalable=no,inital-scale=1.0">
  6. <meta name="apple-mobile-web-app-capable" content="yes">
  7. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  8. <meta name="format-detection" content="telephone=no">
  9. <title>微信安全支付</title>
  10. </head>
  11. <script>
  12. //调用微信JS api 支付
  13. function jsApiCall()
  14. {
  15. WeixinJSBridge.invoke(
  16. 'getBrandWCPayRequest',
  17. {$jsApiParameters},
  18. function(res){
  19. WeixinJSBridge.log(res.err_msg);
  20. //alert(res.err_code+res.err_desc+res.err_msg);
  21. if(res.err_msg=='get_brand_wcpay_request:ok'){
  22. alert('支付成功!');
  23. }else{
  24. alert('支付失败!');
  25. }
  26. setTimeout("location.href = '{$returnUrl}'",2000);
  27. }
  28. );
  29. }
  30. function callpay()
  31. {
  32. if (typeof WeixinJSBridge == "undefined"){
  33. if( document.addEventListener ){
  34. document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
  35. }else if (document.attachEvent){
  36. document.attachEvent('WeixinJSBridgeReady', jsApiCall);
  37. document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
  38. }
  39. }else{
  40. jsApiCall();
  41. }
  42. }
  43. </script>
  44. <body onload="callpay();">
  45. </body>
  46. </html>