Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use java to realize WeChat Pay's official account payment

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

< 32 ; i ++ ){ sb.append(str.charAt(rd.nextInt(str.length()))); } return sb.toString(); } /** * 插入XML标签 * @param sb * @param Key * @param value * @return */ public static StringBuilder setXmlKV(StringBuilder sb,String Key,String value){ sb.append(""); sb.append(value); sb.append(""); return sb; } /** * 解析XML 获得名称为para的参数值 * @param xml * @param para * @return */ public static String getXmlPara(String xml,String para){ int start = xml.indexOf(""); int end = xml.indexOf(""); if(start < 0 && end < 0){ return null; } return xml.substring(start + ("").length(),end).replace("",""); } /** * 获取ip地址 * @param request * @return */ public static String getIpAddr(HttpServletRequest request) { InetAddress addr = null; try { addr = InetAddress.getLocalHost(); } catch (UnknownHostException e) { return request.getRemoteAddr(); } byte[] ipAddr = addr.getAddress(); String ipAddrStr = ""; for (int i = 0; i < ipAddr.length; i++) { if (i >

0) {ipAddrStr + = ".";} ipAddrStr + = ipAddr [I] & 0xFF;} return ipAddrStr;}}

② constant class (set according to merchant information):

Public class WxPayConstants {/ / third-party user unique ID public static String APPID = ""; / / third-party user unique credential password public static String APP_SECRET = ""; / / Merchant ID public static String MCH_ID = ""; / / Wechat Merchant platform-account Settings-Security Settings-api Security, configure 32-bit key public static String KEY = ""; / / transaction type public static String TRADE_TYPE_JS = "JSAPI" / / WeChat Pay callback url public static String NOTIFY_URL = "";}

After reading this article, I believe you have a certain understanding of "how to use java to achieve WeChat Pay's official account payment". If you want to know more about it, welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report