Android Micro-credit payment source sharing _android

Source: Internet
Author: User
Tags cdata

This article for everyone to share the Android micro-letter payment source code for your reference, the specific content as follows

Parameter configuration

public static final String app_id;
/**
registers the app on the micro-trust platform, **/the assigned ID to the public
static final String mch_id;
/**
apply for the opening of micro-letter payment, after the success of the micro-letter will send you an e-mail, to assign you a merchant platform account, in the information has a merchant ID
**/public
static final String api_key;
/** in the letter sent to you in the
e-mail, give you the distribution of the micro-letter merchant platform account, in which set a api_key
**/

Get to PREPAY_ID

All of the above configuration is correct and you will get the result that the micro-letter returns:

<xml><return_code><! [cdata[success]]></return_code>
<return_msg><![ Cdata[ok]]></return_msg>
<appid><![ Cdata[wx8760819e9228eab6]]></appid>
<mch_id><![ Cdata[1244336402]]></mch_id>
<nonce_str><![ Cdata[p7f4pu6kk8ci3vbi]]></nonce_str>
<sign><![ cdata[598ade81cdeefbef1e7a9e4f73b03cd4]]></sign><result_code><! [cdata[success]]></result_code>
<prepay_id><![ cdata[wx20151210110830853e5daa560147579483]]></prepay_id>//successfully fetched the prepaid ID
<trade_type><![ Cdata[app]]></trade_type>
</xml>

When you take the second step, you may have problems:

result_code><! [cdata[app_id does not match merchant ID]]></result_code>//Merchant ID is not correct
result_code><! [cdata[signature error]]></result_code>//in assembling product parameters, Chinese class, to specify the code, otherwise garbled, will report this error;

Successfully obtained, prepay_id, this time, the payment interface still can't adjust?

/*** Note:
1. If you are applying for a micro-letter payment app that is registered on a micro-trust platform and uses the Eclipse default signature, you can now adjust the payment page in the development environment
2. If, in an open platform app, the signature uses a custom signature, you need to use that signature to pack and then run up and you can tune its micro-mail payments
***/

Where is the callback for the micro-credit payment result?

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

/**
The place to paint, you need to change into your own app_id
**/

Attention:

/** 
This activity, is a transparent activity, the callback is over, you need to end it * 
2. Service-side 
**/

packageparams.add (New Basicnamevaluepair (" Notify_url "," http://121.40.35.3/test "));
/**
need to specify a callback interface for micro-mail calls, notify the server, modify the data
* *

Micro-Credit Payment available demo download: Http://xiazai.jb51.net/201608/yuanma/androidwxpay (jb51.net). rar

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.

Related Article

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.