When Android and iosAPP call WeChat Payment, the page is blank. (Php WeChat Payment, the app initiates WeChat payment white screen )?

Source: Internet
Author: User
When Android and iosAPP call payment, the page is blank and my backend is developed with php. I first called the unified order generation and generated the prepay_id pre-payment order number. the code is as follows: {code ...} send the following parameters generated to Android and ios: {code ...} but...

When the Android or ios APP calls the payment, the page is blank
My backend is developed using php. I first called the unified order generation and generated the prepay_id pre-payment order number. the code is as follows:


  Config ['Money']) * 100; $ policy_url = $ this-> config ['policyurl']; // notification URL // Set the unified payment interface parameters // set the required parameters // appid is filled, and merchants do not need to enter the required parameters // mch_id is filled, the merchant does not need to fill in the fields // noncestr already filled in, and the merchant does not need to fill in the fields // spbill_create_ip already filled in, and the merchant does not need to fill in the fields // sign already filled in, merchants do not need to enter // iconv ("gb2312", "UTF-8 // IGNORE", $ unifiedOrder-> setParameter ("body ", $ this-> config ['title']); // product description // custom order number. for example, $ out_trade_no = $ this-> config ['code']; $ create_ip = $ _ SERVER ["REMOTE_ADDR"]; $ unifiedOrder-> setParameter ("out_trade_no", $ out_trade_no); // merchant Order No. $ unifiedOrder-> setParameter ("total_detail ", $ amount); // Total amount $ unifiedOrder-> setParameter ("yy_url", $ notify_url); // notification address $ unifiedOrder-> setParameter ("spbill_create_ip", $ create_ip ); // the actual ip address of the client $ unifiedOrder-> setParameter ("trade_type", "APP"); // The transaction type of the APP $ unifiedOrder-> setParameter ("attach", "111 "); // additional data // Obtain the unified payment interface result $ unigiedorderresult = $ unigiedorder-> getResult (); // The merchant sets the corresponding processing flow based on the actual situation if ($ unifiedOrderResult ["return_code"] = "FAIL") {// The Merchant adds the processing flow echo by himself "communication error: ". $ unifiedOrderResult ['return _ msg ']."
";} Elseif ($ unifiedOrderResult [" result_code "] =" FAIL ") {// The Merchant adds the processing process echo iconv (" UTF-8 "," gb2312 // IGNORE ", "Error code :". $ unifiedOrderResult ['err _ Code']."
"); Echo iconv (" UTF-8 "," gb2312 // IGNORE "," error code description: ". $ unifiedOrderResult ['err _ code_des ']."
");} Elseif ($ unifiedOrderResult [" return_code "] =" SUCCESS ") {/** returns the following message after the request is successful: SUCCESS OK wx2421b1c4370ec43b 10000100 IITRi8Iabbblz1Jc 7921E432F65EB8ED0CE9755F0E86D72F SUCCESS wx201411101639507cbf6ffd8b0779950874 APP **/$ Result = array (); $ result ['appid '] = $ unifiedOrderResult ['appid']; $ result ['ererid'] = $ unifiedOrderResult ['mch _ id']; $ result ['prepayid'] = $ unifiedOrderResult ['prepay _ id']; $ result ['noncestr'] = $ unifiedOrderResult ['nonce _ str']; $ result ['timestamp'] = time (); $ result ['package'] = "Sign = WXPay"; // 'sign = wxpa' $ result ['sign'] = $ unigiedorderresult ['sign']; echo json_encode ($ result); exit ;// The merchant adds the processing process // ......}?>

Send the following parameters generated to Android and ios:

$result['appid'] = $unifiedOrderResult['appid'];$result['partnerid'] = $unifiedOrderResult['mch_id'];$result['prepayid'] = $unifiedOrderResult['prepay_id'];$result['noncestr'] = $unifiedOrderResult['nonce_str'];$result['timestamp'] = time();$result['package'] = "Sign=WXPay"; //'Sign=WXPay'$result['sign'] = $unifiedOrderResult['sign'];

However, Android and ios do not display any error prompts when calling and paying, as shown below:




When you change the above transaction class to scan the QR code for payment, the generated QR code can be successfully paid.
It has been more than a week, and it cannot be moved here. please help me to see what the problem is. thank you very much.
Reference URL:
Http://www.cocoachina.com/bbs...
Http://www.cnblogs.com/CrazyS...
Http://www.xl779.com/news/zha...

Reply content:

When the Android or ios APP calls the payment, the page is blank
My backend is developed using php. I first called the unified order generation and generated the prepay_id pre-payment order number. the code is as follows:


  Config ['Money']) * 100; $ policy_url = $ this-> config ['policyurl']; // notification URL // Set the unified payment interface parameters // set the required parameters // appid is filled, and merchants do not need to enter the required parameters // mch_id is filled, the merchant does not need to fill in the fields // noncestr already filled in, and the merchant does not need to fill in the fields // spbill_create_ip already filled in, and the merchant does not need to fill in the fields // sign already filled in, merchants do not need to enter // iconv ("gb2312", "UTF-8 // IGNORE", $ unifiedOrder-> setParameter ("body ", $ this-> config ['title']); // product description // custom order number. for example, $ out_trade_no = $ this-> config ['code']; $ create_ip = $ _ SERVER ["REMOTE_ADDR"]; $ unifiedOrder-> setParameter ("out_trade_no", $ out_trade_no); // merchant Order No. $ unifiedOrder-> setParameter ("total_detail ", $ amount); // Total amount $ unifiedOrder-> setParameter ("yy_url", $ notify_url); // notification address $ unifiedOrder-> setParameter ("spbill_create_ip", $ create_ip ); // the actual ip address of the client $ unifiedOrder-> setParameter ("trade_type", "APP"); // The transaction type of the APP $ unifiedOrder-> setParameter ("attach", "111 "); // additional data // Obtain the unified payment interface result $ unigiedorderresult = $ unigiedorder-> getResult (); // The merchant sets the corresponding processing flow based on the actual situation if ($ unifiedOrderResult ["return_code"] = "FAIL") {// The Merchant adds the processing flow echo by himself "communication error: ". $ unifiedOrderResult ['return _ msg ']."
";} Elseif ($ unifiedOrderResult [" result_code "] =" FAIL ") {// The Merchant adds the processing process echo iconv (" UTF-8 "," gb2312 // IGNORE ", "Error code :". $ unifiedOrderResult ['err _ Code']."
"); Echo iconv (" UTF-8 "," gb2312 // IGNORE "," error code description: ". $ unifiedOrderResult ['err _ code_des ']."
");} Elseif ($ unifiedOrderResult [" return_code "] =" SUCCESS ") {/** returns the following message after the request is successful: SUCCESS OK wx2421b1c4370ec43b 10000100 IITRi8Iabbblz1Jc 7921E432F65EB8ED0CE9755F0E86D72F SUCCESS wx201411101639507cbf6ffd8b0779950874 APP **/$ Result = array (); $ result ['appid '] = $ unifiedOrderResult ['appid']; $ result ['ererid'] = $ unifiedOrderResult ['mch _ id']; $ result ['prepayid'] = $ unifiedOrderResult ['prepay _ id']; $ result ['noncestr'] = $ unifiedOrderResult ['nonce _ str']; $ result ['timestamp'] = time (); $ result ['package'] = "Sign = WXPay"; // 'sign = wxpa' $ result ['sign'] = $ unigiedorderresult ['sign']; echo json_encode ($ result); exit ;// The merchant adds the processing process // ......}?>

Send the following parameters generated to Android and ios:

$result['appid'] = $unifiedOrderResult['appid'];$result['partnerid'] = $unifiedOrderResult['mch_id'];$result['prepayid'] = $unifiedOrderResult['prepay_id'];$result['noncestr'] = $unifiedOrderResult['nonce_str'];$result['timestamp'] = time();$result['package'] = "Sign=WXPay"; //'Sign=WXPay'$result['sign'] = $unifiedOrderResult['sign'];

However, Android and ios do not display any error prompts when calling and paying, as shown below:




When you change the above transaction class to scan the QR code for payment, the generated QR code can be successfully paid.
It has been more than a week, and it cannot be moved here. please help me to see what the problem is. thank you very much.
Reference URL:
Http://www.cocoachina.com/bbs...
Http://www.cnblogs.com/CrazyS...
Http://www.xl779.com/news/zha...

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.