Micro-credit payment can only successfully invoke a problem solution (Android) _android

Source: Internet
Author: User

I've been using Android for a while, but I don't have a system, and I've been focusing on server development for years, and I've always felt that because the project needs to be in touch with Android mobile, it's just temporary, so I'm not too focused on it, it's a big problem. Finally by the experience of a small partner prompted a moment to solve the feeling of shame at the same time, and very secretly pleased, after all, crossed a one of the ridge, it grew up, here, such as a disgrace and so changed into a cow is also unknown, haha. Gossip on the ramble to here, hurriedly share:

The process of micro-credit payment calling interface as a whole it is necessary to briefly describe (most of the data on the web now are suitable for the old version of the micro-letter payment code, the latest micro-letter payment in the official document does not have the service side of the demo, and some interfaces have changed, parameter names have changed, I hope that the small partners will be able to note:
1. Micro-credit payment does not require access to obtain token that interface;
2. The direct access Https://api.mch.weixin.qq.com/pay/unifiedorder obtains the Prepayid, the parameter transmits in the XML format can;
3. With the Prepayid plus some other official website mentioned parameters can be adjusted to the client's micro-letter payment interface;

There is a problem at this point : The first call is very OK, see the micro-letter payment interface, have their own generated order number and amount, but give up the payment and then enter, even the micro-letter client can not call up, change the order is so, change the phone is also the first single to call the micro-letter client, Show the order number, the amount, but the second is nothing, fixed in their app's payment interface, no error, no response.

The reason is here: when we apply for a micro-letter payment, there is a place where you can fill in your application key:

After the application you see is the image of the application signature, how the signature is generated here are introduced: Https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=8_5
The problem is that this key is generated to be packaged for signature when it is officially released, and when we release the Android application it will be added as an application key to prevent malicious overwriting, etc. We are applying for registration of micro-letter applications must provide a formal generated this application key to the micro-letter website.

So this thing is ignored, so that in the process of development, we in our own local run packaging, access to the micro-trust server to pay, the first time the micro-letter to our application sent the request, as if the connection began to start the heartbeat,

In this case, the micro-letter will be asynchronously based on the retained application package name and application key to the package name and application key you are sending now to verify I believe that even if you make a payment for the first time, it is likely to be unsuccessful, but I have not verified it, because this time the verification results are back.

So with the operation of the staff took release when the key to the APK installation package of the command, carry out the package containing the official key, the order is as follows:

 "' Cordova build--release android
 
 jarsigner-verbose-sigalg sha256withrsa-digestalg sha1-keystore E:\android-rel Ease-key.keystore e:\ Project Name \platforms\android\build\outputs\apk\android-release-unsigned.apk Android-release-key.keystore

 //Run this command requires a password
 
 zipalign-v 4 e:\ project name \platforms\android\build\outputs\apk\ android-release-unsigned.apk a.apk
 
 ""

The problem is solved. Each visit will be able to successfully invoke the micro-letter payment. Have regrets, micro-credit this hand also strictly control the registration in his application, register a key with one, and then want to use, then go back to the process.

This article has been organized into the "Android micro-credit Payment tutorial summary," Welcome to learn to read.

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.