Home > Article > Backend Development > About php providing mode 2 WeChat code scanning payment for ios
After downloading the official SDK, should I use the method in native.php to return the URL or use the method in native_notify.php to return the URL? I don’t know how to proceed. Please enlighten me
After downloading the official SDK, I use the method in native.php to return the URL or use the method in native_notify.php to return the URL. I don’t know how to proceed. Please enlighten me
native. php
Open it and take a look, you will know
Generate the QR code through code_url, and the payment page will appear after scanning it on WeChat
//模式一 /** * 流程: * 1、组装包含支付信息的url,生成二维码 * 2、用户扫描二维码,进行支付 * 3、确定支付之后,微信服务器会回调预先配置的回调地址,在【微信开放平台-微信支付-支付配置】中进行配置 * 4、在接到回调通知之后,用户进行统一下单支付,并返回支付信息以完成支付(见:native_notify.php) * 5、支付完成之后,微信服务器会通知支付成功 * 6、在支付成功通知中需要查单确认是否真正支付成功(见:notify.php) */ $notify = new NativePay(); $url1 = $notify->GetPrePayUrl("123456789"); //模式二 /** * 流程: * 1、调用统一下单,取得code_url,生成二维码 * 2、用户扫描二维码,进行支付 * 3、支付完成之后,微信服务器会通知支付成功 * 4、在支付成功通知中需要查单确认是否真正支付成功(见:notify.php) */ $input = new WxPayUnifiedOrder(); $input->SetBody("test"); $input->SetAttach("test"); $input->SetOut_trade_no(WxPayConfig::MCHID.date("YmdHis")); $input->SetTotal_fee("1"); $input->SetTime_start(date("YmdHis")); $input->SetTime_expire(date("YmdHis", time() + 600)); $input->SetGoods_tag("test"); $input->SetNotify_url("http://paysdk.weixin.qq.com/example/notify.php"); $input->SetTrade_type("NATIVE"); $input->SetProduct_id("123456789"); $result = $notify->GetPayUrl($input); $url2 = $result["code_url"];
The above is about the content of php providing mode 2 WeChat scan code payment for ios, more related Please pay attention to the PHP Chinese website (www.php.cn) for content!