When Android, iOS app calls WeChat payment, the page appears blank. (PHP WeChat payment, app launched WeChat payment white screen)?

Source: Internet
Author: User
Tags cdata

The page appears blank when you make an Android or iOS app call
My backend was developed in PHP. I am the first to call the unified next order generation, generate prepay_id pre-paid order number, the code is as follows:


  config[' money ') *100; $notify _url= $this->config[' Notifyurl ']; Notification url//set the unified Payment interface parameters//settings required parameters//appid filled, the merchant does not need to fill in the//mch_id, the merchant does not need to fill in the//noncestr, the merchant does not need to fill in the//spbill_create_ip is filled, The merchant does not need to fill in the//sign, the merchant does not need to fill in the//iconv ("gb2312", "Utf-8//ignore", $unifiedOrder->setparameter ("Body", $this, config[' title ');//Commodity Description//Custom order number, here only for example $out_trade_no = $this->config[' code ']; $create _ip = $_server["REMOTE_ADDR" ]; $unifiedOrder->setparameter ("Out_trade_no", $out _trade_no);//Merchant Order number $unifiedOrder->setparameter ("Total_ Fee ", $amount);//Total Amount $unifiedorder->setparameter (" Notify_url ", $notify _url);//Notification address $unifiedOrder Setparameter ("Spbill_create_ip", $create _ip);//user-side actual ip$unifiedorder->setparameter ("Trade_type", "APP");// App Trading type $unifiedorder->setparameter ("Attach", "111");//Append Data//Get Unified Payment Interface Result $unifiedorderresult = $unifiedOrder GetResult ();//Merchant according to the actual situation to set the corresponding processing process if ($unifiedOrderResult ["return_code"] = = "FAIL") {//merchant to increase the processing process echo "Communication error:". $unifie dorderresult[' return_msg ']. "
";} ElseIf ($unifiedOrderResult ["result_code"] = = "FAIL") {//merchant to increase the processing process by itself echo iconv ("Utf-8", "Gb2312//ignore", "Error code:" $uni fiedorderresult[' Err_code ']. "
"); Echo iconv ("Utf-8", "Gb2312//ignore", "Error code Description:". $unifiedOrderResult [' Err_code_des ']. "
");} ElseIf ($unifiedOrderResult ["return_code"] = = "SUCCESS") {/** returns the following information after successful SUCCESS OK wx2421b1c4370ec43b 10000100 IITRi8Iabbblz1Jc 7921E432F65EB8ED0CE9755F0E86D72F SUCCESS wx201411101639507cbf6ffd8b0779950874 < c17/> **/$result = Array (); $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 ']; echo Json_encode ($result); Exit Merchants to increase their own processing process//...}? >

Send the following parameters 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, iOS over the call to pay when actually show blank, what error prompt is not, as follows:




When the above transaction class is changed to sweep code payment, the generated QR code can be paid successfully.
has been for one weeks, the card here has been unable to move, ask God to help see, this is what problem, thank you very much
Reference URL:
Http://www.cocoachina.com/bbs ...
Http://www.cnblogs.com/CrazyS ...
Http://www.xl779.com/news/zha ...

Reply content:

The page appears blank when you make an Android or iOS app call
My backend was developed in PHP. I am the first to call the unified next order generation, generate prepay_id pre-paid order number, the code is as follows:


  config[' money ') *100; $notify _url= $this->config[' Notifyurl ']; Notification url//set the unified Payment interface parameters//settings required parameters//appid filled, the merchant does not need to fill in the//mch_id, the merchant does not need to fill in the//noncestr, the merchant does not need to fill in the//spbill_create_ip is filled, The merchant does not need to fill in the//sign, the merchant does not need to fill in the//iconv ("gb2312", "Utf-8//ignore", $unifiedOrder->setparameter ("Body", $this, config[' title ');//Commodity Description//Custom order number, here only for example $out_trade_no = $this->config[' code ']; $create _ip = $_server["REMOTE_ADDR" ]; $unifiedOrder->setparameter ("Out_trade_no", $out _trade_no);//Merchant Order number $unifiedOrder->setparameter ("Total_ Fee ", $amount);//Total Amount $unifiedorder->setparameter (" Notify_url ", $notify _url);//Notification address $unifiedOrder Setparameter ("Spbill_create_ip", $create _ip);//user-side actual ip$unifiedorder->setparameter ("Trade_type", "APP");// App Trading type $unifiedorder->setparameter ("Attach", "111");//Append Data//Get Unified Payment Interface Result $unifiedorderresult = $unifiedOrder GetResult ();//Merchant according to the actual situation to set the corresponding processing process if ($unifiedOrderResult ["return_code"] = = "FAIL") {//merchant to increase the processing process echo "Communication error:". $unifie dorderresult[' return_msg ']. "
";} ElseIf ($unifiedOrderResult ["result_code"] = = "FAIL") {//merchant to increase the processing process by itself echo iconv ("Utf-8", "Gb2312//ignore", "Error code:" $uni fiedorderresult[' Err_code ']. "
"); Echo iconv ("Utf-8", "Gb2312//ignore", "Error code Description:". $unifiedOrderResult [' Err_code_des ']. "
");} ElseIf ($unifiedOrderResult ["return_code"] = = "SUCCESS") {/** returns the following information after successful SUCCESS OK wx2421b1c4370ec43b 10000100 IITRi8Iabbblz1Jc 7921E432F65EB8ED0CE9755F0E86D72F SUCCESS wx201411101639507cbf6ffd8b0779950874 < c17/> **/$result = Array (); $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 ']; echo Json_encode ($result); Exit Merchants to increase their own processing process//...}? >

Send the following parameters 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, iOS over the call to pay when actually show blank, what error prompt is not, as follows:




When the above transaction class is changed to sweep code payment, the generated QR code can be paid successfully.
has been for one weeks, the card here has been unable to move, ask God to help see, this is what problem, thank you very much
Reference URL:
Http://www.cocoachina.com/bbs ...
Http://www.cnblogs.com/CrazyS ...
Http://www.xl779.com/news/zha ...

  • 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.