Details about the android WeChat payment instance code

Source: Internet
Author: User
This article mainly introduces the android payment source code in detail, which has certain practicability and reference value, interested friends can refer to this article for you to introduce in detail the http://www.php.cn/wiki/1502.html "target =" _ blank "> android payment source code, has a certain practical and reference value, for more information, see

This article shares the android payment source code for your reference. the specific content is as follows:

Parameter configuration

Public static final String APP_ID;/** register the app on the open platform and assign the assigned id **/public static final String MCH_ID;/** apply to activate the payment, after success, an email will be sent to you, assigning you a merchant platform account with the merchant ID **/public static final String API_KEY in the information; /** in the email you sent, set an api_key for the account assigned to the merchant's platform **/

Get prepay_id

The above configuration is correct. you will receive the result after running the command. the returned result is as follows:

 
  SUCCESS
  
  OK
  wx8760819e9228eab6
  1244336402
  
  p7F4pU6Kk8Ci3vbi
  
  598ADE81CDEEFBEF1E7A9E4F73B03CD4
  
  SUCCESS
  
  wx20151210110830853e5daa560147579483
  // The prepaid is obtained successfully.
  APP
  
 

When you take step 2, you may encounter the following problems:

Result_code>APP_ID与商户ID不匹配// Incorrect merchant id
Result_code>签名错误// When assembling the product parameters, specify the encoding for the Chinese class. Otherwise, this error will be reported;

The prepay_id is obtained successfully. Why can't the payment interface be called at this time?

/*** NOTE:
1. if the app you apply to activate payment is registered on the open platform and you use the default signature of eclipse, you can now call the payment page in the development environment.
2. if the app on the open platform uses a custom signature for the signature, you need to use this signature for packaging and then run it to make the payment.
***/

Where is the payment result callback?

1. app client. we accept the callback result of the payment in this class.

Note:

/** This activity is a transparent activity. after the callback is complete, you need to end it. * 2. server **/packageParams. add (new BasicNameValuePair ("yy_url", "http: // 121.40.35.3/test");/** you must specify a callback interface to call and notify the server, modify data */

The above describes the details of the android payment instance code. For more information, see other related articles on php Chinese network!

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.