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

Table of Contents
WeChat scan code payment (Mode 1)
Home WeChat Applet WeChat Development WeChat scan code payment mode

WeChat scan code payment mode

Apr 04, 2017 am 11:30 AM

WeChat scan code payment (Mode 1)


Problems encountered by WeChat scan code payment

  • Native payment URL parameter error

  • CallbackInterfaceThe URL has a callback, but the parameters cannot be received

  • Merchant backend The returned data field structure is illegal

  • Timed out to obtain merchant order information or the httpcode returned by the merchant was not 200

Solution to the problem

  • Native payment URL parameter error
    This error generally occurs when the QR code is generated and scanned on WeChat after obtaining the QR code URL. If you encounter this type of problem, please check

1. Whether there are errors in the parameters in the parameter list required to generate the QR code (case sensitive)
2. Sign in the parameters Correct signature algorithm at the time Signature verification tool


The following is the code to generate the QR code URL

/**
?*?
?*?@author?Javen
?*?2016年5月14日
?*?掃碼支付獲取二維碼URL(模式一)
?*/
public?String?getCodeUrl(){
????String?url="weixin://wxpay/bizpayurl?sign=XXXXX&appid=XXXXX&mch_id=XXXXX&product_id=XXXXX&time_stamp=XXXXX&nonce_str=XXXXX";
????String?product_id="001";
????String?timeStamp=Long.toString(System.currentTimeMillis()?/?1000);
????String?nonceStr=Long.toString(System.currentTimeMillis());
????Map<String, String>?packageParams?=?new?HashMap<String, String>();
????packageParams.put("appid",?appid);
????packageParams.put("mch_id",?partner);
????packageParams.put("product_id",product_id);
????packageParams.put("time_stamp",?timeStamp);
????packageParams.put("nonce_str",?nonceStr);
????String?packageSign?=?PaymentKit.createSign(packageParams,?paternerKey);
????return?StringUtils.replace(url,?"XXXXX",?packageSign,appid,partner,product_id,timeStamp,nonceStr);
}
  • The callback interface URL has a callback , but the parameters cannot be received

    Enumeration en=getParaNames();

    ??while?(en.hasMoreElements())?{
    ??????Object?o=?en.nextElement();
    ??????System.out.println(o.toString()+"="+getPara(o.toString()));
    ??}

The parameters output in the above code are all NULL

Since the official document description is not very clear, everyone thinks that the callback request will take the productid and user's openid and other parameters as ordinary parameters. In fact, the parameter returned by this callback is an XMLInput stream

HttpServletRequest?request?=?getRequest();
?????????/**
?????????*?獲取用戶掃描二維碼后,微信返回的信息
?????????*/
????????InputStream?inStream?=?request.getInputStream();
????????ByteArrayOutputStream?outSteam?=?new?ByteArrayOutputStream();
????????byte[]?buffer?=?new?byte[1024];
????????int?len?=?0;
????????while?((len?=?inStream.read(buffer))?!=?-1)?{
????????????outSteam.write(buffer,?0,?len);
????????}
????????outSteam.close();
????????inStream.close();
????????String?result??=?new?String(outSteam.toByteArray(),"utf-8");

resultThe result is



< ;return_msg>

< ;![CDATA[1322117501]]>



<![CDATA[wx2016051 51311568e801d50fb0555050106]] ></prepay_id><br><trade_type><![CDATA[NATIVE]]></trade_type><br><code_url>![CDATA[weixin://wxpay/bizpayurl?pr =Gj3ZF2b]]</code_url><br></xml></p> <p>If the returned return_code result_code is not SUCCESS and the callback interface does not return any data or the returned data is illegal, the following error will occur </p> <ul class=" list-paddingleft-2"> <li><p>The data field structure returned by the merchant's background is illegal (the format of the returned data packet is incorrect) </p></li> <li><p>Timed out to obtain the merchant's order information or the merchant returned The httpcode is not 200 (no returned data packet)</p></li> </ul> <p>If there are no problems with the above, the last step is left. The merchant's backend system returns the prepay_id to the WeChat payment system. The following is the details Code </p> <pre class="brush:php;toolbar:false">/** ?*?@author?Javen ?*?2016年5月14日 ?*?掃碼支付回調(diào)(模式一) ?*/

Public void wxpay () {
Try {
httpservletRequest Request = getRequest () /** ## r 代

##

The above is the detailed content of WeChat scan code payment mode. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1502
276