国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home WeChat Applet WeChat Development WeChat payment development is released across the entire network

WeChat payment development is released across the entire network

Feb 28, 2017 am 09:53 AM

In this WeChat public platform development tutorial, we will introduce how to develop and implement the network-wide publishing function of WeChat payment.

Network-wide release refers to the detection and release of the rights protection function, alarm interface, and delivery interface in the last step of the WeChat payment background.

WeChat payment development is released across the entire network

This article is divided into the following three parts:

WeChat payment directory setting

Delivery interface adjustment

Adjustment of rights protection interface and alarm interface


1. WeChat payment directory setting

The setting of WeChat payment URL is closely related to the adjustment of WeChat payment. The several URL settings we use here are as follows:
Payment test URL: http://www.fangbei.org/wxpay/jsapi/index.php
Transaction notification URL: http://www.fangbei.org /wxpay/notify/index.php
Rights notification URL: http://www.fangbei.org/wxpay/rights/index.php
Alarm notification URL: http://www.fangbei.org/wxpay /alarm/index.php

2. Adjustment of the shipping interface

Before adjusting the shipping interface, the user needs to have a transaction before sending, so first Complete a jsapi payment, the code is as follows,

<?php
include_once("WxPayHelper.php");
$commonUtil = new CommonUtil();
$wxPayHelper = new WxPayHelper();
$wxPayHelper->setParameter("bank_type", "WX");
$wxPayHelper->setParameter("body", "方倍微信支付測(cè)試");
$wxPayHelper->setParameter("partner", PARTNERID);
$wxPayHelper->setParameter("out_trade_no", $commonUtil->create_noncestr());
$wxPayHelper->setParameter("total_fee", "1");
$wxPayHelper->setParameter("fee_type", "1");
$wxPayHelper->setParameter("notify_url", "http://www.fangbei.org/wxpay/notify/index.php");
$wxPayHelper->setParameter("spbill_create_ip", $_SERVER[&#39;REMOTE_ADDR&#39;]);
$wxPayHelper->setParameter("input_charset", "GBK");
$biz_package=$wxPayHelper->create_biz_package();
?>
<html>
<meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
<script language="javascript">
    function callpay()
    {
        WeixinJSBridge.invoke(&#39;getBrandWCPayRequest&#39;,<?php echo $biz_package;?>,function(res){
        WeixinJSBridge.log(res.err_msg);
        alert(res.err_code+res.err_desc+res.err_msg);
        });
    }
</script>
<body>
    <button type="button" onclick="callpay()">方倍微信支付測(cè)試</button>
</body>
</html>

When the above transaction is completed, the transaction notification interface will call back the URL with parameters, as follows

http://www.fangbei.org/wxpay/notify/index.php?discount=0&fee_type=1&input_charset=GBK&notify_id=aCi-cg4m1nr2bbg-De-MK6hQum8XVsw4mYfYnD5umAiEm_J6P_MalPvOisl2NJdurzTW-TJ9IPcnKmZm5TpKjrc8bXT6PEe0&out_trade_no=5DlIL2s5DGR8147c&partner=1219951701&product_fee=1&sign=A7AEF7AE3B70C54C3C0FF642DD2E2004&sign_type=MD5&time_end=20140808185647&total_fee=1&trade_mode=1&trade_state=0&transaction_id=1219951701201408083366666764&transport_fee=0

At the same time, POST sent the following XML data

<xml>
<OpenId><![CDATA[ocIywt7h42MwHxXx23sJdBpBV7Q8]]></OpenId>
<AppId><![CDATA[wxa8826d0c0c0b6d6a]]></AppId>
<IsSubscribe>1</IsSubscribe>
<TimeStamp>1407495408</TimeStamp>
<NonceStr><![CDATA[D6iywdqlcdUj8nDQ]]></NonceStr>
<AppSignature><![CDATA[a99a3cb4f5377dc30cca3f7b362412d7e468e0f4]]></AppSignature>
<SignMethod><![CDATA[sha1]]></SignMethod>
</xml>

Take out the

transaction_id=1219951701201408083366666764
out_trade_no=5DlIL2s5DGR8147c

in the url and the

<OpenId><![CDATA[ocIywt7h42MwHxXx23sJdBpBV7Q8]]></OpenId>

in the xml and fill the above 3 parameter values ??into the delivery interface. For the code, please refer to WeChat Payment Development Delivery Notice

Run it once and the delivery notification interface will be opened.

3. Adjustment of the rights protection interface and the alarm interface

The adjustment of the rights protection interface and the alarm interface is very simple, because the official only needs to receive a response. Therefore, success is returned directly in the corresponding index.php. The code is as follows:

<?php
echo "success";
?>

4. Effect diagram

After the above three interfaces are adjusted, it can be released to the entire network. The effect is as follows

WeChat payment development is released across the entire network

#For more articles related to WeChat payment development published across the entire network, please pay attention to the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)