Android Micro-credit payment development problem _android

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.