<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                >[danger] 注意:如果支付失敗,請到TP日志中查看錯誤信息,支付錯誤提示格式如下: > JSAPI支付錯誤 =======pay(WxPayJs) err: > Native掃碼支付錯誤 =======pay(WxNative) err: > H5支付錯誤 =======pay(WxMWEB_H5) err: > Micropay 刷卡支付錯誤 =======pay(WxMICROPAY) err: >[info]支付API,使用連接調起微信接口 微信支付: ``` {:url('accounts/Pay/pay',['payType'=>'WX','body'=>'cowcms','attach'=>'cowcms','out_trade_no'=>"1111",'total_fee'=>1])} ``` 微信H5支付: ``` {:url('accounts/Pay/pay',['payType'=>'WX_H5','body'=>'cowcms','attach'=>'cowcms','out_trade_no'=>"1111",'total_fee'=>1])} ``` 微信掃碼支付: ``` {:url('accounts/Pay/pay',['payType'=>'WX_Native','body'=>'cowcms','attach'=>'cowcms','out_trade_no'=>"1111",'total_fee'=>1,'product_id'=>0])} ``` >[info]【智能識別支付】在手機網頁端使用H5支付,直接調起微信支付,在手機以外,如電腦端使用掃描支付,顯示二維碼支付碼,在微信中調起微信支付,智能識別當前所在的支付環境,選擇對應的支付方式 * [x] 第一步 :在你需要支付的頁面中調用調起微信支付的 JS-SDK如果不是在微信環境下支付,可以跳過這步 ``` <script type="text/javascript" src="http://res2.wx.qq.com/open/js/jweixin-1.4.0.js"></script> ``` * [x] 第二步 :在你需要支付的頁面中編寫如下代碼 ``` <script> $(function($) { var payTypeUrl = "{:url('accounts/Pay/get_pay_type')}";//獲取支付方式的連接,固定不變 /*==========================編寫支付方式的選擇框===========================*/ $.post(payTypeUrl,{},function(data){ if(data) { var payTypeStr = "",checkedStr = ""; for(var i=0 ;i < data.length; i++) { checkedStr = i==0 ? "checked" : ""; payTypeStr += "<input type='radio' name='payType' value='"+data[i].payType+"' title='"+data[i].title+"' "+checkedStr+">" +data[i].payType } $('#payType').html(payTypeStr); } },"json"); </script> ``` >{payType:payType,body:BODY,attach:ATTACH,out_trade_no:OUT_TRADE_NO,total_fee:TOTAL_FEE} 參數說明 | 參數 | 類型 | 默認 | 描述 | | --- | --- |--- |--- | | payType(**必填**) | String(128) | WX:微信支付, WX_H5:微信H5支付,WX_Native:微信掃描支付| 支付類型| | body | String(128) | 產品消費__會員 | 商品描述| | attach | String(128) | PRO_1 | 附加數據,在查詢API和支付通知中原樣返回,可作為自定義參數使用 可以附帶產品id或者其它| | out_trade_no | String(32) | 20150806125346 | cowcms系統產生的訂單號, 且唯一 | | total_fee | INT | 100| 訂單總金額,單位為分 >[info]【微信支付】如何使用JSAPI支付 * [x] 第一步 :控制器的php代碼 ``` $param = array( 'body'=>'產品消費__會員充值', 'attach'=>'recharge', 'out_trade_no'=>"cowcms_123456", 'total_fee'=>1 ); $wxPayJs = pay('WX',$param); $this->assign('jsApiParameters',$wxPayJs[0]); ``` >$param 參數說明 | 參數 | 類型 | 默認 | 描述 | | --- | --- |--- |--- | | body(**必填**) | String(128) | 產品消費__會員 | 商品描述| | attach (**必填**)| String(128) | PRO_1 | 附加數據,在查詢API和支付通知中原樣返回,可作為自定義參數使用 可以附帶產品id或者其它| | out_trade_no(**必填**) | String(32) | 20150806125346 | cowcms系統產生的訂單號, 且唯一 | | total_fee (**必填**)| INT | 100| 訂單總金額,單位為分 | time_start | String(14) | 20091225091010 | 訂單生成時間,格式為yyyyMMddHHmmss,默認為當前時間| | time_expire | String(14) | 20091225091010 | 訂單失效時間,格式為yyyyMMddHHmmss,默認為下單時間加5分鐘| | goods_tag| String(14) | WXG | 訂單優惠標記,使用代金券或立減優惠功能時需要的參數| | openid| String(32) | oUpF8uMuAJO_M2pxb1Q9zNjWeS6o | 此參數為微信用戶在商戶對應appid下的唯一標識,可以不填| * [x] 第二步 :模板中JS代碼 ``` //調用微信JS api 支付 function jsApiCall() { WeixinJSBridge.invoke( 'getBrandWCPayRequest', <?php echo $jsApiParameters; ?>, function(res){ if(res.err_msg == "get_brand_wcpay_request:ok" ){ alert("支付成功") } else { alert("錯誤碼:"+res.err_desc+"錯誤信息"+res.err_msg); } } ); } 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(); } } ``` * [x] 第三步 :在你想觸發支付的按鈕上,加入 onClick="callpay()" 屬性,如: ``` <button type="button" onClick="callpay()" >立即支付</button> ``` 等同于打開以下連接 ``` {:url('systems/Pay/pay',['payType'=>'WX','body'=>'產品消費__會員充值','attach'=>'recharge','out_trade_no'=>"cowcms_123456",'total_fee'=>1])} ``` >[info]【微信支付】如何使用Native(掃碼)支付 * [x] 第一步 :控制器的php代碼 ``` $param = array( 'body'=>'產品消費__會員充值', 'attach'=>'recharge', 'out_trade_no'=>"cowcms_123456", 'total_fee'=>1, 'product_id'=>3, ); $url = pay('WX_Native',$param); $qrcodeUrl = Request()->domain().url("systems/Qrcode/qrcode",['text'=>urlencode($url) ] ); $this->assign('qrcodeUrl', $qrcodeUrl ); ``` >$param 參數說明 | 參數 | 類型 | 默認 | 描述 | | --- | --- |--- |--- | | body(**必填**) | String(128) | 產品消費__會員 | 商品描述| | attach (**必填**)| String(128) | PRO_1 | 附加數據,在查詢API和支付通知中原樣返回,可作為自定義參數使用 可以附帶產品id或者其它| | out_trade_no(**必填**) | String(32) | 20150806125346 | cowcms系統產生的訂單號, 且唯一 | | total_fee (**必填**)| INT | 100| 訂單總金額,單位為分 | | product_id (**必填**)| String(32) | cowcms_0| 此id為二維碼中包含的商品ID,商戶自行定義| | time_start | String(14) | 20091225091010 | 訂單生成時間,格式為yyyyMMddHHmmss,默認為當前時間| | time_expire | String(14) | 20091225091010 | 訂單失效時間,格式為yyyyMMddHHmmss,默認為下單時間加5分鐘| | goods_tag| String(14) | WXG | 訂單優惠標記,使用代金券或立減優惠功能時需要的參數| * [x] 第二步 :模板中顯示二維碼圖片 ``` <img src="{$qrcodeUrl}l" style="width:150px;height:150px;"/> ``` 等同于打開以下連接 ``` {:url('systems/Pay/pay',['payType'=>'WX_Native','body'=>'產品消費__會員充值','attach'=>'recharge','out_trade_no'=>"cowcms_123456",'total_fee'=>1,,'product_id'=>3,'qrcode_width'=>150])} ``` 注意:url("systems/Qrcode/qrcode",['text'=>urlencode($url) ] ),該連接可以生成一個臨時二維碼,連接所傳參數為 text:生成的二維碼所包含的內容,可以是連接也可以是文本內容 size:生成二維碼的大小,,默認為 4 level:二維碼的容錯率,默認"L", L(QR_ECLEVEL_L,7%),M(QR_ECLEVEL_M,15%),Q(QR_ECLEVEL_Q,25%),H(QR_ECLEVEL_H,30%); margin:二維碼周圍邊框空白區域間距值,默認 2 >[info]【微信支付】如何使用MWEB(H5)支付 * [x] 第一步 :控制器的php代碼 ``` $param = array( 'body'=>'產品消費__會員充值', 'attach'=>'recharge', 'out_trade_no'=>"cowcms_123456", 'total_fee'=>1, 'redirect_url'=>"http://tp.tybxkj.cc/public/index.php", ); $wxPayH5 = pay('WX_H5',$param); if($wxPayH5 ) { $mweb_url= $wxPayH5 ; $this->assign('mweb_url', $mweb_url ); } ``` >$param 參數說明 | 參數 | 類型 | 默認 | 描述 | | --- | --- |--- |--- | | body(**必填**) | String(128) | 產品消費__會員 | 商品描述| | attach (**必填**)| String(128) | PRO_1 | 附加數據,在查詢API和支付通知中原樣返回,可作為自定義參數使用 可以附帶產品id或者其它| | out_trade_no(**必填**) | String(32) | 20150806125346 | cowcms系統產生的訂單號, 且唯一 | | total_fee (**必填**)| INT | 100| 訂單總金額,單位為分 | | scene_info (**必填**)| String(256) | IOS移動應用{"h5_info": {"type":"IOS","app_name": "王者榮耀","bundle_id": "com.tencent.wzryIOS"}} 安卓移動應用{"h5_info": {"type":"Android","app_name": "王者榮耀","package_name": "com.tencent.tmgp.sgame"}}}WAP網站應用{"h5_info": {"type":"Wap","wap_url": "http://tp.tybxkj.cc","wap_name": "COWCMS"}} | 該字段用于上報支付的場景信息,針對H5支付有以下三種場景,請根據對應場景上報,H5支付不建議在APP端使用,針對場景1,2請接入APP支付,不然可能會出現兼容性問題,1,IOS移動應用{"h5_info":"h5_info" {"type": "","app_name": "","bundle_id": ""}| | redirect_url| String(256) | 當前支付頁面 | H5支付完成或者取消后,跳轉到那個頁面,默認跳轉到當前支付頁面| | time_start | String(14) | 20091225091010 | 訂單生成時間,格式為yyyyMMddHHmmss,默認為當前時間| | time_expire | String(14) | 20091225091010 | 訂單失效時間,格式為yyyyMMddHHmmss,默認為下單時間加5分鐘| | goods_tag| String(14) | WXG | 訂單優惠標記,使用代金券或立減優惠功能時需要的參數| * [x] 第二步 :模板中觸發 ``` <a href="{$mweb_url}">確認支付</a> ``` 等同于打開以下連接 ``` {:url('systems/Pay/pay',['payType'=>'WX_H5'','body'=>'產品消費__會員充值','attach'=>'recharge','out_trade_no'=>"cowcms_123456",'total_fee'=>1, 'redirect_url'=>"http://tp.tybxkj.cc/public/index.php")} ``` >[danger]注意:模版中主要是實現跳轉$mweb_url連接,目的是調起微信支付面板輸入密碼,可以在代碼中實現跳轉, 如果wxPayH5($param)執行成功會返回['mweb_url'=>'URL'], 如果執行中微信有錯誤信息返回 ['return_code'=>'FAIL','return_msg'=>'錯誤信息'], 如果wxPayH5($param)失敗返回false. >[info]【微信支付】如何使用MICROPAY(商家刷卡)支付 * [x] 第一步 :創建一個表單 ``` <form action="#" method="post"> <div style="margin-left:2%;">支付金額:</div><br/> <input type="text" style="width:96%;height:35px;margin-left:2%;" readonly value="1" name="Total_fee" /><br /><br /> <div style="margin-left:2%;">授權碼:</div><br/> <input type="text" style="width:96%;height:35px;margin-left:2%;" name="auth_code" /><br /><br /> <div align="center"> <input type="submit" value="提交刷卡" type="button" /> </div> </form> ``` * [x] 第二步 :在授權碼的輸入框,用掃碼器獲取用戶收付款二維碼或條形碼的授權碼,然后提交表單到PHP頁面,代碼如下: ``` if(request()->isPost()) { $Total_fee = request()->param('Total_fee') ? request()->param('Total_fee') : 1; $auth_code = request()->param('auth_code') ? request()->param('auth_code') : false; if($auth_code) { $param = array( 'body'=>'產品消費__會員充值', 'attach'=>'recharge', 'out_trade_no'=>"cowcms_".date("YmdHis"), 'total_fee'=>$Total_fee, 'auth_code'=>$auth_code, ); $returnData = pay('WX_Micropay',$param); ;//返回真表示支付成功 } } else { return $this->fetch(); } ``` >$param 參數說明 | 參數 | 類型 | 默認 | 描述 | | --- | --- |--- |--- | | body(**必填**) | String(128) | 產品消費__會員 | 商品描述| | attach (**必填**)| String(128) | PRO_1 | 附加數據,在查詢API和支付通知中原樣返回,可作為自定義參數使用 可以附帶產品id或者其它| | out_trade_no(**必填**) | String(32) | 20150806125346 | cowcms系統產生的訂單號, 且唯一 | | total_fee (**必填**)| INT | 100| 訂單總金額,單位為分 | | auth_code (**必填**)| String(32) | 120061098828009406| 掃碼支付授權碼,設備讀取用戶微信中的條碼或者二維碼信息(注:用戶付款碼條形碼規則:18位純數字,以10、11、12、13、14、15開頭)| | time_start | String(14) | 20091225091010 | 訂單生成時間,格式為yyyyMMddHHmmss,默認為當前時間| | time_expire | String(14) | 20091225091010 | 訂單失效時間,格式為yyyyMMddHHmmss,默認為下單時間加5分鐘| | goods_tag| String(14) | WXG | 訂單優惠標記,使用代金券或立減優惠功能時需要的參數| >[info]查詢支付訂單 ``` //$param['transaction_id']="4200000295201905289397268000";//微信支付訂單號 $param['out_trade_no']="cowcms_1559112635";//COWCMS系統支付時傳遞過去的訂單號 $order = pay('WX_PayOrder',$param);; dump($order); ``` >查詢訂單請求參數 | 參數 | 類型 | 默認 | 描述 | | --- | --- |--- |--- | | transaction_id | String(32) | 1217752501201407033233368018 | 微信支付訂單號,支付成功后在回調中或者支付碎片中返回| | out_trade_no| String(32) | cowcms_20190528192231 | COWCMS系統支付時傳遞過去的訂單號,transaction_id和out_trade_no二選一,推薦使用out_trade_no| >返回示例代碼 ``` array(20) { ["appid"] => string(18) "wxc0d7ec4863c12ab9" ["attach"] => string(8) "recharge" ["bank_type"] => string(3) "CFT" ["cash_fee"] => string(1) "1" ["fee_type"] => string(3) "CNY" ["is_subscribe"] => string(1) "N" ["mch_id"] => string(10) "1225084602" ["nonce_str"] => string(16) "KaqrYV88aB1VXkpz" ["openid"] => string(28) "o4KFnuLOwsQR9tDusUk0ZBhe5b4Q" ["out_trade_no"] => string(21) "cowcms_20190528192231" ["result_code"] => string(7) "SUCCESS" ["return_code"] => string(7) "SUCCESS" ["return_msg"] => string(2) "OK" ["sign"] => string(64) "558D972A61DA690C172E0F19BE14EEAA85BAEF738AD07C78FDE69F67615966BF" ["time_end"] => string(14) "20190528192532" ["total_fee"] => string(1) "1" ["trade_state"] => string(7) "SUCCESS" ["trade_state_desc"] => string(12) "支付成功" ["trade_type"] => string(6) "NATIVE" ["transaction_id"] => string(28) "4200000295201905289397268000" } ``` 參數說明[查看](https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=9_2) >[info]微信退款 ``` //$param['transaction_id']="4200000295201905289397268000";//微信支付訂單號 $param['out_trade_no']="cowcms_1559112635";//COWCMS系統支付時傳遞過去的訂單號 $param['refund_fee']=1;//退款金額 $param['total_fee']=1;//總金額 $order = pay('WX_Refund',$param);; dump($order); ``` >微信退款請求參數 | 參數 | 類型 | 默認 | 描述 | | --- | --- |--- |--- | | transaction_id | String(32) | 1217752501201407033233368018 | 微信支付訂單號,支付成功后在回調中或者支付碎片中返回| | out_trade_no| String(32) | cowcms_20190528192231 | COWCMS系統支付時傳遞過去的訂單號,transaction_id和out_trade_no二選一,推薦使用out_trade_no| | out_refund_no| String(32) | cowcms_1559112635| 商戶系統內部的退款單號,商戶系統內部唯一,由退款時生成| | refund_fee| int | 1 | 退款金額| | total_fee| int | 1 | 總金額| >返回示例代碼 ``` array(18) { ["appid"] => string(18) "wxc0d7ec4863c12ab9" ["cash_fee"] => string(1) "1" ["cash_refund_fee"] => string(1) "1" ["coupon_refund_count"] => string(1) "0" ["coupon_refund_fee"] => string(1) "0" ["mch_id"] => string(10) "1225084602" ["nonce_str"] => string(16) "TnqNAo748YYIWzJe" ["out_refund_no"] => string(27) "cowcms_Es52hE20190528200815" ["out_trade_no"] => string(21) "cowcms_20190528200640" ["refund_channel"] => array(0) { } ["refund_fee"] => string(1) "1" ["refund_id"] => string(29) "50000000342019052809759991995" ["result_code"] => string(7) "SUCCESS" ["return_code"] => string(7) "SUCCESS" ["return_msg"] => string(2) "OK" ["sign"] => string(64) "CD668E1F9C80D6E5B117D3FA81D32313EE563DF31DC288891A5C620982219B7F" ["total_fee"] => string(1) "1" ["transaction_id"] => string(28) "4200000294201905282699566424" } ``` 參數說明[查看](https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=9_4) >[info]微信退款訂單查詢 ``` //$param['transaction_id']="4200000295201905289397268000";//微信支付訂單號 $param['out_trade_no']="cowcms_1559112635";//COWCMS系統支付時傳遞過去的訂單號 $order = pay('WX_RefundOrder',$param);; dump($order); ``` >微信退款請求參數 | 參數 | 類型 | 默認 | 描述 | | --- | --- |--- |--- | | transaction_id | String(32) | 1217752501201407033233368018 | 微信支付訂單號,支付成功后在回調中或者支付碎片中返回refund_id > out_refund_no > transaction_id > out_trade_no 四選一,推薦使用out_trade_no| | out_trade_no| String(32) | cowcms_Es52hE20190528200815| COWCMS系統支付時傳遞過去的訂單號refund_id > out_refund_no > transaction_id > out_trade_no 四選一,推薦使用out_trade_no| | out_refund_no| String(32) | cowcms_1559112635| 商戶系統內部的退款單號,商戶系統內部唯一,由退款時生成refund_id > out_refund_no > transaction_id > out_trade_no 四選一,推薦使用out_trade_no| | refund_id| String(32) | 50000000342019052809759991995 | 微信退款單號,由退款生成refund_id > out_refund_no > transaction_id > out_trade_no 四選一,推薦使用out_trade_no | >返回示例代碼 ``` array(21) { ["appid"] => string(18) "wxc0d7ec4863c12ab9" ["cash_fee"] => string(1) "1" ["mch_id"] => string(10) "1225084602" ["nonce_str"] => string(16) "mIhD7yHURDURQMap" ["out_refund_no_0"] => string(27) "cowcms_Es52hE20190528200815" ["out_trade_no"] => string(21) "cowcms_20190528200640" ["refund_account_0"] => string(29) "REFUND_SOURCE_UNSETTLED_FUNDS" ["refund_channel_0"] => string(8) "ORIGINAL" ["refund_count"] => string(1) "1" ["refund_fee"] => string(1) "1" ["refund_fee_0"] => string(1) "1" ["refund_id_0"] => string(29) "50000000342019052809759991995" ["refund_recv_accout_0"] => string(21) "支付用戶的零錢" ["refund_status_0"] => string(7) "SUCCESS" ["refund_success_time_0"] => string(19) "2019-05-28 20:10:30" ["result_code"] => string(7) "SUCCESS" ["return_code"] => string(7) "SUCCESS" ["return_msg"] => string(2) "OK" ["sign"] => string(64) "845BBD20C1C13A92FDAF2108A3119C4C01956CF6D4D50A1E20BF8DFA3E74B9E5" ["total_fee"] => string(1) "1" ["transaction_id"] => string(28) "4200000294201905282699566424" } ```參數說明[查看](https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=9_5)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看