WeChat public account payment development issues, public issues

Source: Internet
Author: User
Tags openid

Public Account Payment and development issues

1. An error occurred while calling the unified order interface.

Https://pay.weixin.qq.com/wiki/doc/api/app.php? Chapter = 9_1

The parameter is entered in string Format at the beginning. An error is returned. Later, I read other blogs and demos and learned that I should write them like this:

// Add data to the dictionary SortedDictionary <string, string> m_values = new SortedDictionary <string, string> (); m_values.Add ("appid", appID ); m_values.Add ("body", bodymsg); m_values.Add ("mch_id", mch_id); m_values.Add ("nonce_str", nonce_str); m_values.Add ("notify_url", notify_url ); m_values.Add ("openid", openID); m_values.Add ("out_trade_no", orderId); m_values.Add ("spbill_create_ip", region); m_values.Add ("total_region", Region ()); m_values.Add ("trade_type", "JSAPI"); string signkey = WXDes. totUrl (m_values); // concatenate data
// Splice string key = value public static string TotUrl (SortedDictionary <string, string> m_values) {int I = 0; StringBuilder sb = new StringBuilder (); foreach (KeyValuePair <string, string> temp in m_values) {if (temp. value = "" | temp. value = null | temp. key. toLower () = "sign") {continue;} I ++; sb. append (temp. key. trim () + "=" + temp. value. trim () + "&");} sb. append ("key =" + ConfigHelp. APISign); string signkey = sb. toString (); return signkey ;}

2.Question about calling uniform single body Encoding

At the beginning of the writing is the direct body = "hello" direct value, but the return code says there is no UTF-8 encoding, and then HttpUtility. urlEncode ("member recharge", Encoding. getEncoding ("UTF-8"), the result of the payment page shows the encoded text, and then see the post said direct assignment is OK, and has been, really !!!!

Body = "direct assignment"

3. the API Password box page cannot be displayed.

Get the returned prepay_id and access the API interface. The generated json is returned to the front end. If alert (json string) has no problem, a parameter is missing when it is passed in. After several twists and turns

In this way, the returned json is converted.JSON. parse (json)

 

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.