国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

? ?? ??? ?? ?? WeChat ?? ?? ?? ??? ?? ??

WeChat ?? ?? ?? ??? ?? ??

Feb 24, 2017 pm 04:38 PM
?? ?? ??

???? ????

WeChat ?? ?????? ??? ?? ?? ???? ???? ????. ?? ????????.

???? ?? ??? ?????-->{??????? ? ?? ??}-->????? ?? ? ?? ??? ??? ????? ???? ?????? ?????-->?? ???? ????? ???? ??? ??? ???(? ??? WeChat ???? ????? ??? ???? ? ??? ????.) --> ??? ?? ???? ?????. ???? ???? ?? ???..???? ?? ???~ ??? ??? ?????. ???? ??? ?? ????? ????? ??????. ??>

?? ??

1) ??? ?? ??(?? ?? ? ?? ???? ??? ?? ? ??)

2) ?? ?? ID? ?? ?? ?? ?? ?????

3) H5? WeChat ??? ??? JS? ?????

4) ??? ??? ? WeChat ?? URL ??

? ?? ?? ? ??? ??? ???? ? ??? ??? ??? ??????. ?? ?? ? ?? ?? ? ?. (???? ?? ??? ??? ?? ? ???. ?? ?? ? ??

WeChat ?? ?? ?? ??? ?? ??

? ?? ?? ?? ?????(??? ?? ?? ???, ??? ????? ??? ? ? ?? ????. ???? ??? ?????, ??? ??, ??? ???? ???? ??? ?? ????. ?????? ??? ??? ?? ??? $get_brand_wcpay_request:fail.$? ????? ?? ?? ????.key0 ?? ????? ???? ???.) ??? ??? ??? ??? ?? ???????. ??? ????? ??? ???? ???????.

1. ?? ?? ?????? ???? prepay_id? ????.

name == ?? ? ?? ?:

WeChat ??? ??? ???? https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1? ?? ??? ?? ?? ????, ??? ??? ?? ? ??? ?????

appid == ?????? ID == WeChat ?? ?? ???? ??? - ?? - ?? ??

mch_id ==? ?????. ?? ?? ??? ?? == ?? ?? ???? ??????

device_info ==?? ??==??? ??(?? ?? ?? ?? ??? ?? ID)? ?????. ??: "WEB"? ?????. PC???? ?? ???? ???

body==????==?? ?? ???? ???? (?? ??? ????? ????? ???? ??????) ??? ??? ???? ??? ?? ? ????. ????? ??? ?? ?? ????. ?? ??? ???? ??? ??? ?? ???? ?????.

trade_type==?? ??==?? ??? ????: JSAPI, NATIVE, APP. ??? ???? JSAPI? ???? ?? WeChat ?? ?? ???? ?? ????. ps: JSAPI--?? ?? ??, NATIVE--???? ?? ?? ??, APP--? ??, ?? ?? ????? trade_type? ?? ????? ???? ??? ? ????. MICROPAY--?? ??, ?? ??? ??? ?????. ?????, ?? ?? ?????? ???? ????.

nonce_str==random string==random string, 32?? ??

ps: ???? nonce? ??? ?? ? ????. ?? ?????. WeChat ? Doubi? ?? ???? ????? ??? ?? ??? nonce? ????? ?? ?????. (??? ?? ???? nonce? ??? ???? ???? ??? ? ????.) ???? ????

??? ??????. nonce ==? ? ??? ?????.

notify_url==?? ??==WeChat ?? ??? ?? ?? ??? ?????. ?? URL? ?? ???? ? ?? URL??? ?? ????? ??? ? ????. (??? ?? ??? ??? ?? ????? ???? ???? ?? ?? ? ???)

out_trade_no==??? ????==??? ??? ? ????? 32? ??? ?????. be ??? ????? (?? ?? ?? ???? ? ?????. ?? ???? ????? 1?? ????????.)

total_fee==?? ==? ?? ??, ??? ?????(??? ???? ???? ?? ??? ?? ???? ?? 1??? ????. ps: ?? ?? ??? ????? ?? ???? ??? ????) ??? ????)

openid ==User ID==trade_type=JSAPI, ? ????? ???? appid ??? ?? ???? ?? ID? ????? ???.

?? ??? ?? ??? ??? ?? ???? ????? ????.

sign==??==?? ?? ????. https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_3. ??? ? ??, ? ??? ? ??. ? ?? ?? ??? ???? ??? ??? ??? ?? ??? ???? ?? ?? ???

? ? ???? ? ??? ????? ??? ?????. ??? ??? ???????. ??? ??? ??? ?? ?????. (?? ???? ??? ?? ????, ??? ??? ??? ?????.

key==? ?? ?? : ?? ??? ???(pay.weixin.qq.com)- ->?? ??-->API ??-->?? ??

??: WeChat ?? ?? ?? ??? ?? ??

????? ?? ??? ?? ??? ????. ?? ??? ???? ?? ????. ?? ?? ?? ???? ???? MD5? ???? 32?? ???? ????? ???????.

??? ??? ? ???? ? ???? ???? ???.

?? ???? ??? ???? ? ?? ???? ?? ?????. ??? ?? ??? ?? ??? ???? ??? ??????. (?? WeChat? ?? ? ???? ?????. ??? ??? ?? ?? ??? ??????. ?? ?? ??? ????? ??????)

?? ?? ??? ??? ????

WeChat ?? ?? ?? ??? ?? ??

?? ????? ??? ?, XML

???? ???? ??? ????.

<?xml  version="1.0" encoding="UTF-8" standalone="yes"?><xml>
????<appid>wxb1427ebebexxxxxx</appid>
????XXX費(fèi)用
????<device_info>WEB</device_info>
????<mch_id>132186xxxx</mch_id>
????<nonce_str>6AED000AF86A084F9CB0264161E29DD3</nonce_str>
????<notify_url>https://一個域名/api/wechatPay/jsapiPayNotify</notify_url>
????<openid>oo8WUt0taCqjt552htW1vw-xxxxx</openid>
????<out_trade_no>1</out_trade_no>
????<sign>各種排序+key生成的那個sign</sign>
????<total_fee>1</total_fee>
????<trade_type>JSAPI</trade_type></xml>

WeChat ?? ?? ??? ??: https://api.mch.weixin.qq.com/pay/unifiedorder

???? ??? ?????. ?? ????? ???? ????

<xml>
??<return_code></return_code>
??<return_msg></return_msg>
??<appid></appid>
??<mch_id></mch_id>
??<device_info></device_info>
??<nonce_str></nonce_str>
??<sign></sign>
??<result_code></result_code>
??<prepay_id></prepay_id>
??<trade_type></trade_type></xml>


???? ??? ?? ? ?????

prepay_id

獲取到這貨之后,第一步驟已經(jīng)結(jié)束了,可以去喝個茶,吃個冰棍,小慶祝一下。

2、H5調(diào)起微信支付的內(nèi)置JS

???? WeChat?? ??? XML ???? ?? ???. ??????? ??? ???? ?????? ?? ??? ????? ???.

appId==??? ???? ????==???? ????

timeStamp==Timestamp==Rules: https://pay .weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_2. ??? ?? ??? ??? ????? ????. ???? ????. ?? ???? ????. ?? ????, ?? ?? ?????

nonceStr == ??? ??? ??? ??? ??? ???? ??????. ?????, ???? ???? ??? ? ? ????.

package==?? ???? ?? ???==prepay_id ?? ?? ??????? ???? ???? ?? ??? ????. : prepay_id=** *(????. ?? ??? ??? ?? prepay_id? ??? ???????. ?? ??? ?? ?? ?? ID? ???? ???? ? ???? WeChat?? ??? ??? ??????. ?? ????? ???? ?????? ????. ??? ???. ?? ?????. )

signType==?? ??==?? ????? ?? ?????

paySign==??==? ??? ??????? ???? ?????. ?? 4? ???? + ?(???? ??)? ?????. (??? ??? ?? ?????? ???? ?? ?? ?????? ?? ????????. ??? ?????? ??? ????)

paySign ?? ??

WeChat ?? ?? ?? ??? ?? ??

??: prepay_id ?? ? appid? ??? i???. paySign ?? ? appId? ??? I???

???? ?? ?? ? ???? ??? ?? ?????. ?? ???.

??? ?? ?? ???? ????? ?? ????? ???? ???? ??? ??? ??????? ??? ???? ?????. ??? ? ???? ?? ??? ????? ?????.

WeChat ?? ?? ??, WeChat ??, ?? ??? ?? ?? ????? ????. ??? ?? ????,

?? ?? ????: ?? ?? ?? ????. (???? ????? ????? ?? ? ??? ??? ? ?? ??? ????? ???? ?? ????.)

?? ?? ????: ??? ??? ? ?????. ???? ??? ? ?? ??? ?????. IP? ??? ? ????(????? ??? ??). ?? ?????? ??? IP? ??? ? ?? ??, ?? ? ???? ????? ?? ??? ?????. ???? ???? ?? ?????? ?? ??? ??? ??? ???? ?? ????.

??? ??????: ?? ???? ????

WeChat ?? ?? ?? ??? ?? ??

????? ???? ?? ??? ????. (???? ? ??? ????)

WeChat ?? ?? ?? ??? ?? ??

?? ? ??? ??? ??? ?????.

??? ?? ?? ? ?? ? ?? ?? ????. ?? ??? ??? ??????.

3. ??? ????? ???? ??? ????? ?? ???? ?? ?????.

function?onBridgeReady(){
???WeixinJSBridge.invoke
???(???????'getBrandWCPayRequest',?
???{???????????"appId"?:?appId,???????
???//公眾號名稱,由商戶傳入
???????????"timeStamp":timeStamp,?//時間戳,自1970年以來的秒數(shù)?????
???????????"nonceStr"?:?nonceStr,?//隨機(jī)串?????
???????????"package"?:?Package,?????
???????????"signType"?:signType,??//微信簽名方式:?????
???????????"paySign"?:?paySign?????//微信簽名?
???????},???????function(res){?
???????????if(res.err_msg?==?"get_brand_wcpay_request:ok"?)?{
???????????????window.location.replace("index.html");
???????????}
???????}
???);?
}

? ???? ??? ??? ????? ???? ???? ???. ???? ???? ?????? ??? ???? ?????: http://www.miracleart.cn/

4, ??? ??. ???

? ??? ??? ?? 3?? ?? ??? ?????

 1) ??? ??? ??? ?? ???? ???? ?? ???? ??? ??? ???? ?????. ???? ??? ???? ???? ????

2) return_code? result_code? ?? SUCCESS? ?? ??? ?? ???? ??? ?????. ??? ?? ?? ? ?? ??? ????.

    3)告訴微信,我收到你的返回值了。不用在發(fā)了。

關(guān)于以上三點(diǎn)的解釋。微信官方是這么說的


//支付完成后,微信會把相關(guān)支付和用戶信息發(fā)送到商戶設(shè)定的通知URL,
//驗(yàn)證簽名,并回應(yīng)微信。
//對后臺通知交互時,如果微信收到商戶的應(yīng)答不是成功或超時,微信認(rèn)為通知失敗,
//微信會通過一定的策略(如30分鐘共8次)定期重新發(fā)起通知,
//盡可能提高通知的成功率,但微信不保證通知最終能成功。

//商戶自行增加處理流程,
//例如:更新訂單狀態(tài)
//例如:數(shù)據(jù)庫操作
//例如:推送支付完成信息


還記得我們在第一步生成預(yù)支付id(prepay_id時的那個notify_url嗎。如果不記得了,請往上翻。如果當(dāng)時只是隨便寫了一個,那么這會需要去改一改了。)

一個能訪問的到的action.同樣地址需要外網(wǎng)能訪問的到。沒有試ip好不好使。開發(fā)這部分功能的時候,運(yùn)維同學(xué)已經(jīng)配置了測試域名。好開心啊,終于不用在糾結(jié)于一些交互配置了。

和支付寶不同,微信返回的是流。和支付寶不同,微信返回的是流。和支付寶不同,微信返回的是流。重要的事情說三遍

解析之后,得到的格式是這樣子的

<xml><appid><![CDATA[wxb1427ebebeeaxxxx]]></appid>
<bank_type><![CDATA[CFT]]></bank_type>
<cash_fee><![CDATA[1]]></cash_fee>
<device_info><![CDATA[WEB]]></device_info>
<fee_type><![CDATA[CNY]]></fee_type>
<is_subscribe><![CDATA[Y]]></is_subscribe>
<mch_id><![CDATA[132186xxxx]]></mch_id>
<nonce_str><![CDATA[07FC15C9D169EE48573EDD749D25945D]]></nonce_str>
<openid><![CDATA[oo8WUt0taCqjt552htW1vw-xxxxx]]></openid>
<out_trade_no><![CDATA[你的訂單編號]]></out_trade_no>
<result_code><![CDATA[SUCCESS]]></result_code>
<return_code><![CDATA[SUCCESS]]></return_code>
<sign><![CDATA[E69940B3EDC437CB5A181210D523806E]]></sign>
<time_end><![CDATA[20160621134204]]></time_end>
<total_fee>1</total_fee>
<trade_type><![CDATA[JSAPI]]></trade_type>
<transaction_id><![CDATA[400386200120160621763973xxxx]]></transaction_id>
</xml>

對以上第一點(diǎn)和第三點(diǎn)做個解釋。

再次吐槽一下。微信真的很喜歡用簽名啊。整個過程,3遍簽名。也是醉了。

1)我們看到上述微信返回的xml中含有很多字段。使用上述xml中,處sign意外的值+key,進(jìn)行簽名。你沒有看錯。包含result_code和return_code。

微信的官方對于簽名有解釋。

WeChat ?? ?? ?? ??? ?? ??

原諒我真的好久不學(xué)語文了。真的沒理解這句話,是用微信回調(diào)函數(shù)中傳的參數(shù),進(jìn)行重新簽名。傻傻的,還在想,用第二次簽名是的參數(shù)進(jìn)行簽名,時間戳怎么辦,要不要存在數(shù)據(jù)庫里面。

將獲得的簽名與xml中的sign對比,如果相同,證明是微信返回的通知。如果不同,你的通知地址可能被黑客破解了。要不要告訴老板呢,告訴老板了,我怎么解決呢。

2)商戶邏輯處理,不解釋

3)告訴微信,我收到了你的通知,不需要在發(fā)送了。

怎么告訴微信呢。我翻遍了微信的文檔,也沒有找到回復(fù)微信通知這個url。

經(jīng)人知道,再一次的刷新了認(rèn)知觀。用response.

我是這么寫的


 response.getWriter().write(xml);


這個xml就是微信給你的那個流轉(zhuǎn)化的字符串。

xml中的return_code要是SUCCESS或者FAIL

別問我怎么知道的。官方的demo里面寫的

if($notify->checkSign() == FALSE){
        $notify->setReturnParameter("return_code","FAIL");//返回狀態(tài)碼
        $notify->setReturnParameter("return_msg","簽名失敗");//返回信息
    }else{
        $notify->setReturnParameter("return_code","SUCCESS");//設(shè)置返回碼
    }
    $returnXml = $notify->returnXml();

按照這個寫法,返回的數(shù)據(jù)。在沒有收到微信的通知。

之前在測試的時候,返回字符串之后,在沒有收到微信的通知,這兩天偶然查日志,發(fā)現(xiàn),微信在一直的,通知,不一定是8次。從打印的日志看

有4次,6次。突然,好暈啊。有明白的朋友,還請多多指教

--------------------------------------------------------------

微信公眾號支付--JSAPI的開發(fā)思路和一下參數(shù)的具體解釋,全部完成了。具體代碼。等我從公司項(xiàng)目里面抽出來。在整理。

還有一個坑:我們在第一步的時候,body傳的是英文,如果傳中文,直接能用的趕緊感謝一下上蒼,返回參數(shù)錯誤的,應(yīng)該是正常吧。

我的對象和xml轉(zhuǎn)化是用的Java的JAXBContext。很好用的趕腳。趕腳比XMLStream好用。

更多WeChat ?? ?? ?? ??? ?? ??相關(guān)文章請關(guān)注PHP中文網(wǎng)!

? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1601
29
PHP ????
1502
276
???
Scrapy? WeChat ?? ?? ??? ??? ? ??? ?????. Scrapy? WeChat ?? ?? ??? ??? ? ??? ?????. Jun 22, 2023 am 09:41 AM

Scrapy? WeChat ?? ??? ?? ??? ? ??? ?????. WeChat? ?? ? ? ?? ?? ?? ?? ??? ????????, ??? ???? ?? ??? ?? ??? ??? ???. ?? ?? ?? ??? WeChat ?? ??? ??? ??? ?????. ???? ? ?? ??? ??, ??? ??? ? ?? ??? ??? ? ?? ?????. ? ??? ????, ???? ? ??? ???? ??? ??? ? ????. ??? ? ???? Scrapy ?????? ???? WeChat ?? ?? ?? ????? ???? ??? ???????. Scr

WeChat ?? ?? ??? ???? ???? ?????? WeChat ?? ?? ??? ???? ???? ?????? Sep 19, 2023 pm 02:15 PM

WeChat ?? ?? ??? ???? ???? ?? ??, ?? ??, ?? ??, ????? ?? ? ??? ??? ????. ??? ??: 1. ?? ?? ??? ?? ??? ??? V ??? ?? ?? ??? ?? ???. ? ??? ?? ??? ???? ??? ??? ???? ?? ?? ?? ??? ? ?? ??? ? ?? ????. 2. ?? ??. ??? ?? ??? ??? ?? ???? ? ?? ??? ??? ????. ?? ??, ??? ?? ??? ??? ?? ? ?? ?? ?? ?? WeChat ?? ??? ???? ? ????.

Python? ?? ??? ??: WeChat ?? ?? ??? Python? ?? ??? ??: WeChat ?? ?? ??? Jun 10, 2023 am 09:01 AM

Python? ??? ??? ?? ? ? ??? ??? ?? ??? ????? ?????. ??? ??? ???? ??? ?? ???? ?? ? ???, ???? ???? ?? ??? ??? ?????. ??? ??? ?? ? ???? Python ???? ?? ?????. ? ????? Python ???? ???? WeChat ?? ?? ?? ??? ?? ??? ?????. WeChat ?? ??? ???? ??? ???? ?? ?? ?? ??? ????? ?? ??? ?? ???? ?? ? ???? ?? ??? ?????.

PHP? ???? WeChat ?? ?? API ????? ?? PHP? ???? WeChat ?? ?? API ????? ?? May 13, 2023 pm 12:01 PM

??? ??? ??? WeChat ?? ??? ?? ? ?? ??? ??? ??? ??? ?????. WeChat ?? ??? ? ?? ??? ????? ?? ?????? ???? ?? ??? ????. ? ????? PHP ??? ?? ?? WeChat ?? ?? API ?????? ???? ??? ?????. 1. ?? WeChat ?? ?? API ?????? ???? ?? ???? WeChat ?? ?? ??? ???? WeChat ?? ????? ??? ????? ??? ???? ???. ??? ????? ???? ?? ??? AppID ? AppSe? ?? ? ????.

Laravel? ???? WeChat ?? ?? ?? ??? ?? ???? ???? ?? Laravel? ???? WeChat ?? ?? ?? ??? ?? ???? ???? ?? Nov 02, 2023 am 09:42 AM

Laravel? ???? WeChat ?? ??? ???? ??? ?? ???? ???? ?? WeChat ?? ??? ?? ???? ?? ?? ? ?? ??? ?? ??? ???? ??? ??? ???? ??????. ???? ???? WeChat ?? ??? ???? ? ??? ?? ???? ???? ??? ???? ??? ???? ? ????. ? ???? Laravel ?????? ???? ??? ???? ???? ??? ???? ???? ?? ??? ?????. ???? ?? ?? ?? ??? Laravel ?????? ???? ??? ???? ???. ???

?? ??? ??? ? ?? ?? ?? ? ???? ?? ??? ??? ? ?? ?? ?? ? ???? Jun 16, 2023 pm 02:04 PM

?? ??? ??? ??? ??? ??? ? ?? ?? ??? ??? ?? 8?? ??? ??? ? ????. ?? ??? ???? ??: 1. ??? "?? ??"? ??? ? "? ??? ? ??? ??"? ?????. ? ?? ?? ??? ?????. 2. ? ?? ??? ??? ? ?? ? ?? ?? ??? ?? + ??? ???? "??? ???"? ???? ? ?? ??? ?????. 3. ?? ???? ???? ??? ? "??"? ?????. ???? ???'? ???? ?? ??? ??? ?????.

Go ?? ?????? ???? WeChat ?? ?? ?????? ?? Go ?? ?????? ???? WeChat ?? ?? ?????? ?? Jun 04, 2023 am 10:40 AM

???? ??? ??? ??? ???? ???? ?? WeChat ?? ??? ?? ???? ???? ?? ??? ?????. WeChat ?? ??? ?? ??? ???? ?? ??????, ??? ???? ????, ??? ???? ?? ? ????. WeChat ?? ?? ??????? ? ? ???? ?? ?? ? ?? ???? ??? Go ??? ???? WeChat ?? ?? ??????? ????? ???? ????. Go ??? Google? ??? ????? ???, ??? ???? ???, ???? ??? ??? ??????? ???? ? ?????. ?? ??? ????

??? '?? ??? ??? ?? ?? ??, ??, ?? ? ?? ???? ???? ?? ??'? ???? ??? ???? ??????. ??? '?? ??? ??? ?? ?? ??, ??, ?? ? ?? ???? ???? ?? ??'? ???? ??? ???? ??????. Aug 05, 2024 pm 10:26 PM

8? 1? ? ????? ??? ???, ?? ?? ??? ?? ??? ?? ??? ??????. ?????? ???? ??? ?? ??? ??? ??? ???? ?? ??, ??, ?? ? ?? ??? ??? ?? ??? ??? ???? ??? ????? ??????. ??? ??? ????? ??? ??????? ???? ??? ? ???? ?? ????. WeChat? ???? ??? ????, ?? ???? ???? ???? ?? ??? ?? ?? ??? ?? ????. ? ???? ??? ????? ??? ??? ??? ??, ??, ??, ?? ??? ???? ?? ??? ??? ???? ??? ???? ?? ????. ▲?? ?? ?? ?? ??? ????, ?? ?? ???? ?, ?, ? ? ??? ??? ?? ???? ???? ???, ??? ??, ?? ???? ?? ? ?? ??? ???? ??. ?? ??? ??? ???? ???? ????? ???? ???? ??

See all articles