超碰中文网,91久久精品日日躁夜夜躁欧美,一区二区三区精品道,一区二区国产在线观看,亚洲精品中文字幕乱码一区二区,天天看片高清影视在线观看,久久99精品久久久久蜜桃,久久成人影视

VPS參考測評推薦
專注分享VPS主機優惠信息
衡天云優惠活動
熱網互聯2026年促銷活動
hostkvm優惠促銷活動
zji優惠促銷活動
QQGNET優惠促銷活動
QQGNET優惠促銷活動

詳細講解一下微信開發的信用卡支付的例子(微信開通信用卡支付)。

主機參考:VPS測評參考推薦/專注分享VPS服務器優惠信息!若您是商家可以在本站進行投稿,查看詳情!此外我們還提供軟文收錄、PayPal代付、廣告贊助等服務,查看詳情!
我們發布的部分優惠活動文章可能存在時效性,購買時建議在本站搜索商家名稱可查看相關文章充分了解該商家!若非中文頁面可使用Edge瀏覽器同步翻譯!PayPal代付/收錄合作

本文介紹了微信支付下信用卡支付的發展過程。微信信用卡支付是指用戶打開微信錢包的信用卡接口,商家掃碼提交完成支付的支付過程。

1.信用卡支付API接口地址api.mch.weixin.qq.com/pay/micropay需要證書嗎?

不需要。

輸入參數名稱變量名必需的類型示例值描述

對公賬戶IDappID為字符串(32)wx 888888888微信分配的對公賬戶ID(企業號corpid為appID),商戶號mch_id為字符串(32)1900000109微信支付分配的商戶號device_info無字符串(32)。013467007045764隨機字符串nonce_str是字符串(32)5k 8264 iltk ch 16 CQ 2502 si 8 znm TM 67 vs隨機字符串,長度不超過32位。推薦的隨機數生成算法簽名符號是字符串(32)c 380 bec 2 bfd 727 a 4b 6845133519 F3 ad 6的簽名。詳見簽名生成算法產品說明body is String(128)image形象店-深圳騰達- QQ娃娃產品簡單說明,此字段必須嚴格按照規范傳輸。具體請參考參數“產品明細無字符串(6000)”。商品詳細信息& quot:[{ & quot;商品id & quot:& quotiphone6s _ 16G & quot,& quotwxpay _ goods _ id & quot:& quot1001 & quot,& quot商品名稱& quot:& quotiPhone6s 16G & quot,& quot商品數量& quot:1 & quot;價格& quot:528800商品_類別& quot:& quot123456 & quot,& quotbody & quot:& quot蘋果手機“},{ & quot商品id & quot:& quotiphone6s _ 32G & quot,& quotwxpay _ goods _ id & quot:& quot1002 & quot,& quot商品名稱& quot:& quotiPhone6s 32G & quot,& quot數量& quot:1 & quot;價格& quot:608800商品_類別& quot:& quot123789 & quot,& quotbody & quot:& quot蘋果手機“}】}詳細的商品列表,JSON格式,在傳輸簽名之前一定要使用CDATA標簽保護Json文本字符串。

goods _ detail【】:└goods _ id字符串必填32產品編號└ wxpay_goods_id字符串可選32微信支付定義的統一產品編號└ goods_name字符串必填256產品名稱└ goods_num Int必填數量└ price Int必填單價,單位為分鐘└ goods_category字符串,可選32產品類別ID└ body字符串,可選1000個產品描述信息。

附加數據無字符串(127)表示附加數據,該數據按查詢API和付款通知中的格式返回。該字段主要用于商戶攜帶訂單的自定義數據。商家訂單號out_trade_no是字符串(32)121775250120140703323333368018,它在32個字符以內,可以包含字母。有關其他解釋,請參見商家訂單號、商品詳細信息、詳細信息、無字符串。

訂單金額total_fee是Int888的訂單總金額,單位是分鐘,只能是整數。詳細信息請參考付款金額貨幣類型fee _ type No String(16)CNY,三位數字母代碼符合ISO4217,默認人民幣:CNY。有關其他值的列表,請參考貨幣類型終端ipspbill_create_ip,它是字符串(16)8 . 8 . 8,機器IP商品標簽goods_tag no字符串(32),商品標簽、憑證或折扣功能的參數。詳情請參考代金券或折扣指定的付款方式。limit _ pay No String(32)No _ credit No _ credit --指定信用卡支付授權碼auth_code為String(128)120061098828009406掃碼支付授權碼。讀取用戶微信中條形碼或二維碼信息的設備示例如下:

& ltxml & gt& ltappid & gtwx 2421 B1 c 4370 EC 43 b & lt;/appid & gt;& lt附加& gt訂單附加描述

返回結果名、變量名、所需類型、樣本值描述

返回狀態代碼return_code是字符串(16)成功/失敗。該字段是通信標識,而不是交易標識。交易是否成功需要檢查result_code以確定返回信息return_msg是否未能簽署字符串(128)返回信息。如果不為空,它將簽署錯誤原因。當return_code成功時,它還將包括以下字段:

名稱變量名必需的類型示例值描述

對公賬戶IDappID是String(32)wx 888888888調用接口提交的對公賬戶ID,商戶號mch_id是String(32)190000109調用接口提交的商戶號,device_info的設備號,String(32)0134670007045764調用接口提交的終端設備號。隨機字符串nonce_str為string(32)5k 8264 iltk ch 16 CQ 2502 si 8 znmtm 67 vs微信返回的隨機字符串簽名為string(32)c 380 be 2 bfd 727 a 4b 6845133519 F3 ad 6微信。有關詳細信息,請參見簽名生成算法。業務結果result_code為字符串(16)成功/失敗錯誤代碼err_code無字符串(32)system error以了解詳細信息。請參閱系統錯誤返回的錯誤列表錯誤代碼描述err _ code _ des No String(128)信息描述。當返回代碼和結果代碼都成功時,將包括以下字段:

名稱變量名必需的類型示例值描述

用戶ID openid是商家appid下字符串(128)Y的唯一ID。is_subscribe為字符串(1)Y用戶是否關注公眾賬號,僅在公眾賬號類型中有效,取值范圍為Y或n;Y-注意;N-未關注交易類型trade_type為字符串(16),小額支付支付類型為小額支付(即掃碼支付),支付銀行bank_type為字符串(16)CMC銀行類型,采用字符串類型的銀行標識。有關值列表,請參考銀行類型、貨幣類型、費用類型、無字符串(16)CNY、符合ISO 4217標準的三位數字母代碼。默認值為人民幣:CNY。有關其他值的列表,請參考貨幣類型。訂單金額total_fee是Int888的訂單總金額,單位是分鐘,只能是整數。詳情見付款金額。現金付款幣種類型cash_fee _ TypeNo字符串(16)CNY符合ISO 4217的三位數字母代碼。默認值為人民幣:CNY。有關其他值的列表,請參見貨幣類型。現金支付金額Cash _ Fee是Int100訂單的現金支付金額。詳情見付款金額。微信支付訂單號的transaction_id為字符串(32)121775250120140703323368018。商家訂單號out_trade_no為字符串(32)12177525012014070323368018,與請求一致。商家數據包不附加字符串(128)123456商家數據包,支付完成時間按原樣返回。time_end是字符串(14)20141030133525的訂單生成時間,格式為yyyyMMddHHmmss。例如,2009年12月25日9點10分是20091225091010。詳見時間規則。例子如下:

& ltxml & gt& ltreturn _ code & gt& lt!【CDATA【成功】】& gt& lt/return _ code & gt;& ltreturn _ msg & gt& lt!【CDATA【OK】】& gt;& lt/return _ msg & gt;& ltappid & gt& lt!【CDATA【wx 2421 B1 c 4370 EC 43 b】】& gt;& lt/appid & gt;& ltmch _ id & gt& lt!【CDATA【10000100】】& gt;& lt/mch _ id & gt;& lt設備信息& gt& lt!【CDATA【1000】】& gt;& lt/device _ info & gt;& ltnonce _ str & gt& lt!【CDATA【GOP 3 trymxzbmlkun】】& gt;& lt/nonce _ str & gt;& lt符號& gt& lt!【CDATA【d6c 76 CB 785 f 07992 CDE 05494 bb 7 df 7 FD】】& gt;& lt/sign & gt;& lt結果代碼& gt& lt!【CDATA【成功】】& gt& lt/result _ code & gt;& ltopenid & gt& lt!【CDATA【oupf 8un 95-PTA AGS 6 e _ ROP G7 ag 0】】& gt;& lt/OpenID & gt;& ltis _ subscribe & gt& lt!【CDATA【Y】】& gt;& lt/is _ subscribe & gt;& lttrade_type&gt& lt!【CDATA【MICROPAY】】& gt;& lt/trade_type&gt。& ltbank_type&gt。& lt!【CDATA【CCB _ DEBIT】】& gt;& lt/bank_type&gt。& lttotal _ fee & gt1 & lt/total _ fee & gt;& ltcoupon _ fee & gt0 & lt/coupon _ fee & gt;& lt費用類型& gt& lt!【CDATA【CNY】】& gt;& lt/fee _ type & gt;& lttransaction _ id & gt& lt!【CDATA【100845074020141110005820873】】& gt;& lt/transaction _ id & gt;& ltout _ trade _ no & gt& lt!【CDATA【1415757673】】& gt;& lt/out _ trade _ no & gt;& lt附加& gt& lt!【CDATA【訂單的附加說明】】& gt& lt/attach & gt;& lttime _ end & gt& lt!【CDATA【2014111170043】】& gt;& lt/time _ end & gt;& lt/XML & gt;二是實現了信用卡支付類。在微信支付原有的微信支付類文件中,新增信用卡支付類如下:

/* * *信用卡支付接口class */class micropay _ pub擴展wx pay _ client _ pub { function _ _ construct(){//設置接口鏈接$ this -& gt;url = & quothttps://api.mch.weixin.qq.com/pay/micropay";//設置卷曲超時$ this -& gt;CURL _ time out = WxPayConf _ pub::CURL _ time out;}/* * *生成接口參數XML */Function Create XML(){ Try {//檢測所需參數if($ this -& gt;參數【& quotout _ trade _ no & quot】= = null){ throw new SDKRuntimeException(& quot;統一支付接口必需參數out_trade_no缺失!"。"& ltbr & gt");} else if($ this -& gt;參數【& quotbody & quot】= = null){ throw new SDKRuntimeException(& quot;統一支付接口必選參數體缺失!"。"& ltbr & gt");} else if($ this -& gt;參數【& quot總費用& quot】= = null){ throw new SDKRuntimeException(& quot;統一支付接口必需參數total_fee缺失!"。"& ltbr & gt");} else if($ this -& gt;參數【& quot授權代碼& quot】= = null){ throw new SDKRuntimeException(& quot;統一支付接口必需參數auth_code缺失!"。"& ltbr & gt");} $ this -& gt;參數【& quotappid & quot】= WxPayConf _ pub::APPID;//公共帳戶ID $ this -& gt;參數【& quotmch _ id & quot】= WxPayConf _ pub::MC hid;//商家編號$ this -& gt;參數【& quotspbill _ create _ ip & quot】= $ _ SERVER【& amp;#39;遠程ADDR & amp;#39;];//終端IP $ this -& gt;參數【& quotnonce _ str & quot】= $ this -& gt;createnoncentr();//隨機字符串$ this -& gt;參數【& quot簽名& quot】= $ this -& gt;get sign($ this -& gt;參數);//簽名//var _ dump($ this -& gt;參數);return $ this -& gt;arrayToXml($ this -》;參數);} catch(SDKRuntimeException $ e){ die($ E-& gt;error message());}}}原始的基本類和請求類也如下所示:

/* * *所有接口的基類*/class common _ util _ pub { function _ _ construct(){ }函數修整字符串($ value){ $ ret = null;if (null!= $ value){ $ ret = $ value;if(strlen($ ret)= = 0){ $ ret = null;} } return $ ret}/* * *函數:生成長度不超過32位的隨機字符串*/public Function createnoncentr($ length = 32){ $ chars =“abcdefghijklmnopqrstuvwxyz 0123456789 & quot;;$ str = & quot";for($ I = 0;$ i & lt$ length$ i++){ $ str。= substr($ chars,mt _ rand(0,strlen($ chars)-1),1);} return $ str}/* * *函數:格式參數,簽名過程需要使用*/Function formatbizqueryparamap($ paramap,$ urlencode){ $ buff =“& quot;;ksort($ paraMap);foreach($ paraMap as $ k = & gt;$ v){ if($ URL encode){ $ v = URL encode($ v);} //$buff= strtolow($ k)。"= & quot。$ v . & quot& amp";$buff。= $k。= & quot。$ v . & quot& amp";} $ reqParif(strlen($ buff)》0){ $ req par = substr($ buff,0,strlen($ buff)-1);} return $ reqPar}/* * *函數:生成簽名*/公共函數get sign($ obj){ foreach($ objas $ k =》$ v){ $ Parameters【$ k】= $ v;}//簽名第一步:按字典順序對參數ksort($ Parameters)進行排序;$ String = $ this -& gt;formatBizQueryParaMap($ Parameters,false);//echo & amp;#39;【字符串1】& amp;#39;。$String。& amp#39;& lt/br & gt;& amp#39;;//簽名第二步:在字符串后添加key $ string = $ string。& ampkey = & quot。WxPayConf _ pub::KEY;//echo & quot;【string 2】& quot;。$String。"& lt/br & gt;";//簽名第三步:MD5加密$ String = MD5($ String);//echo & quot;【字符串3】& quot;。$String。"& lt/br & gt;";//簽名第四步:所有字符都大寫$ result _ = strtop($ string);//echo & quot;【結果】& quot。$result_。"& lt/br & gt;";返回$ result _;}/* * * Function:array to XML */Function arraytoxml($ arr){ $ XML =“& lt;xml & gt";foreach($ arr as $ key = & gt;$ val){ if(is _ numeric $ val)){ $ XML。= & quot& lt"。$key。"& gt"。瓦爾。"& lt/& quot;。$key。"& gt";} else $xml。= & quot& lt"。$key。"& gt& lt!【CDATA【& quot;。瓦爾。"】】》;& lt/& quot;。$key。"& gt";} $xml。= & quot& lt/XML & gt;";返回$ xml}/* * *函數:將xml轉換為數組*/公共函數xmlto array($ XML){//將XML轉換為數組$ array _ data = JSON _ decode(JSON _ encode(SimpleXML _ load _ string($ XML,&;#39;SimpleXMLElement & amp#39;,LIBXML_NOCDATA),true);返回$ array _ data}/* * *函數:將xml提交到對應的接口URL */公共函數postxmlurl($ XML,$ URL,$ second = 30){//初始化curl $ ch = curl _ init();//設置超時curl _ setopt($ ch,curl _ timeout,$ second);//在此設置代理(如果有的話)//curl _ Set opt($ ch,curl _ proxy,&;#39;8.8.8&amp。#39;);//curl _ setopt($ ch,CURLOPT_PROXYPORT,8080);curl _ setopt($ ch,CURLOPT_URL,$ URL);curl _ setopt($ ch,CURLOPT_SSL_VERIFYPEER,FALSE);curl _ setopt($ ch,CURLOPT_SSL_VERIFYHOST,FALSE);//Set header curl _ setopt($ ch,curl opt _ header,false);//要求結果為字符串并輸出到屏幕curl _ set opt($ ch,curl opt _ return transfer,true);//post提交方法curl _ set opt($ ch,curl opt _ post,true);curl _ setopt($ ch,CURLOPT_POSTFIELDS,$ XML);//運行curl $ data = curl _ exec($ ch);curl _ close($ ch);//返回結果if($ data){ curl _ close($ ch);返回$ data} else { $ error = curl _ errno($ ch);回聲& quot卷曲錯誤,錯誤代碼:$ error & quot。"& ltbr & gt";回聲& quot& lta href = & amp#39;http://curl.haxx.se/libcurl/c/libcurl-errors.html&第39名;& gt錯誤原因查詢

其他參數自動生成或手動指定。

調用函數如下

//介紹微信支付類廠商(& amp global(&;#39;Wxpay。WxPayPubHelper . WxPayPubHelper & amp;#39;);//使用統一支付接口$ microPay = new \ microPay _ pub();//設置統一支付接口參數$ micropay -& gt;設置參數(& quotbody & quot,& quot方時報商戶刷卡支付”);//產品描述$ micropay -》;設置參數(& quotout _ trade _ no & quot,& quot$ out _ trade _ no & quot);//商家訂單號$ micropay -》;設置參數(& quot總費用& quot,$ total _ fee);//總金額$ micropay -》;設置參數(& quot授權代碼& quot,$ authcode);//授權碼//獲取統一支付接口結果$ microPayResult = $ micropay -& gt;getResult();//3.判斷異常if(!isset($ microPayResult【& quot;結果代碼& quot】)| |($ microPayResult【& quot;結果代碼& quot】= = = & quot;失敗&quot)){ $ this -》;resRpcError(isset($ microPayResult【& amp;#39;結果代碼& amp#39;]) ?$ microPayResult【& amp;#39;錯誤代碼。#39;】:$ microPayResult【& amp;#39;return _ msg & amp#39;】,& quot21000&quot);}【相關推薦】

1.下載微信微信官方賬號平臺源代碼。

2.分享微信微信官方賬號開發信用卡支付的實例教程。

3.微信開發的微信支付

4.詳細講解微信小程序支付功能開發的錯誤總結。

這幾篇文章你可能也喜歡:

  • 暫無相關推薦文章

本文由主機參考刊發,轉載請注明:詳細講解一下微信開發的信用卡支付的例子(微信開通信用卡支付)。 http://m.k2270.com/113307.html

【騰訊云】領8888元采購禮包,搶爆款云服務器 每月 9元起,個人開發者加享折上折!
打賞
轉載請注明原文鏈接:主機參考 » 詳細講解一下微信開發的信用卡支付的例子(微信開通信用卡支付)。
主機參考僅做資料收集,不對商家任何信息及交易做信用擔保,購買前請注意風險,有交易糾紛請自行解決!請查閱:特別聲明

評論 搶沙發

評論前必須登錄!