Not all of the bat API is very useful, micro-credit payment has a lot of flaws, summed up the micro-credit payment in the implementation of the problems
Pit Point One:
The generation of payreq parameter sign
Payreq object has a parameter of Packagevalue
and sign generation to use the Packagevalue, but the corresponding key is package, the key here is easy to mistake
Copy Code code as follows:
list<namevaluepair> signparams = new linkedlist<namevaluepair> ();
Signparams.add (New Basicnamevaluepair ("AppID", Req.appid));
Signparams.add (New Basicnamevaluepair ("Noncestr", Req.noncestr));
Signparams.add (New Basicnamevaluepair ("package", Req.packagevalue));
Signparams.add (New Basicnamevaluepair ("Partnerid", Req.partnerid));
Signparams.add (New Basicnamevaluepair ("Prepayid", Req.prepayid));
Signparams.add (New Basicnamevaluepair ("timestamp", Req.timestamp));
Pit Point two:
Payment callback method
Micro-letters use reflection to find the corresponding class and implement the callback
The micro-credit official gave the following description:
Reference to the micro-trust SDK Sample, in the NET.SOURCEFORGE.SIMCPUX.WXAPI package path to implement the Wxpayentryactivity class (package name or class name inconsistency can cause no callback), Implementation of the ONRESP function in the Wxpayentryactivity class, after payment is completed, the micro-mail app will return to the Merchant app and callback the ONRESP function, the developer needs to receive a notification in the function, to determine the return error code, If payment is successful, go back and check the payment results to show the actual payment results.
The meaning is as follows:
1, you want to create a PACKAGENAME+.WXAPI package, such as: your project registration: COM.ANDROID.QQ, then you want to create a WXAPI package under the name of the package
2. Create an activity class named Wxpayentryactivity under the package, and implement the interface Iwxapieventhandler, the payment callback is performed in the Onresp (Baseresp resp) method of the interface
Copy Code code as follows:
Package Com.android.qq.wxapi;
public class Wxpayentryactivity extends activity implements Iwxapieventhandler {
@Override
public void Onresp (Baseresp resp) {
Processing payment Callbacks
}
}
Three: Signature test
This is not a pit, and a lot of third parties have to be tested.
The paid test must correspond to the signed package, otherwise the payment function cannot be tested
The above content is the Android micro-credit payment development problem, I hope to help.