Search code examples
phppayment-gatewaywechat

Wechat H5 payment does not work


I have successfully integrated qr code wechat payment. It is pretty much pointless for mobile website. Client wants something more usable. After some research I have found that H5 payment should do. The thing is I am getting error and can't find anything on the web regarding the issue. The support is probably the worst I have ever dealt with. They tried to point to wrong config being used but when got full payloads, request and responses haven't come back with anything useful.

endpoint: https://api.mch.weixin.qq.com/pay/unifiedorder

payload:

<xml>
  <appid><![CDATA[*appid*]]></appid>
  <mch_id>*merchantId*</mch_id>
  <body><![CDATA[Tickets]]></body>
  <detail><![CDATA[{"goods_detail":[[{"goods_id":"3_81","goods_name":"Wicked - 7 June 2018 07:30pm - STALLS K36","quantity":1,"price":1}]]}]]></detail>
  <out_trade_no>*11111*</out_trade_no>
  <fee_type><![CDATA[CNY]]></fee_type>
  <total_fee>1</total_fee>
  <spbill_create_ip><![CDATA[192.168.22.1]]></spbill_create_ip>
  <time_expire>20180602063844</time_expire>
  <notify_url><![CDATA[https://xyz2.local/wechat/confirmation/dfsdfs/erefdav]]></notify_url>
  <trade_type><![CDATA[MWEB]]></trade_type>
  <nonce_str><![CDATA[*nonce*]]></nonce_str>
  <sign><![CDATA[*sign*]]></sign>
</xml>

response:

<xml>
   <return_code><![CDATA[FAIL]]></return_code>
   <return_msg><![CDATA[商户号该产品权限预开通中,请等待产品开通后重试]]></return_msg>
</xml>

For wechat integration I am using this library: omnipay-wechat All the data between ** is correctly populated. Google translation doesn't make much sense to me. Tried to google for the error in Chinese but haven't found anything helpful.

Wasted already a lot of time.. Hope there is somebody witch wechat payment expierience that can point me to the right direction.


Solution

  • The H5 payment is NOT opened by default. You have to request the approval.