亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Table of Contents
1. Payment
3. The backend accepts the data returned by the WeChat server
4. 前端發(fā)起支付
5.后端接受微信服務(wù)器回調(diào)
二.退款
一. 用戶(hù)發(fā)起退款請(qǐng)求
二. 商戶(hù)發(fā)起退款請(qǐng)求
三. 退款完成
Home WeChat Applet Mini Program Development Detailed explanation of mini program payment and refund process

Detailed explanation of mini program payment and refund process

Jul 03, 2020 am 11:10 AM
WeChat applet

The payment and refund process of the WeChat mini program

When I was working on the WeChat mini program recently, it involved the payment and refund process of the mini program, so I also roughly summarized this aspect. I’ve read everything over and over, and I’ll summarize it in this blog.


First of all, let me explain that the main logic of WeChat applet payment is concentrated on the backend. The frontend only needs to carry the data required for payment to request the backend interface and then handle the corresponding success or failure based on the returned results. I use PHP on the backend. Of course, in this blog I am not going to post a bunch of code to explain the specific implementation of payment, but will mainly focus on the entire payment process and some details. Therefore, friends who use other back-end languages ????can take a look if necessary. Many times, development needs and corresponding problem solutions really need to go beyond the language syntax level and be considered from the perspective of systems and processes. Okay, no more nonsense. Into the title.

1. Payment

Payment is mainly divided into several steps:

The front end carries the data required for payment (commodity id, purchase quantity, etc.) to initiate a payment request

After receiving the payment request, the backend processes the payment data, and then carries the processed data requestWeChat serverPayment unified order interface

The backend receives the return data from the previous request to the WeChat server, processes it again, and then returns to the frontend so that the frontend can start payment.

Front-end performs payment action

After the front-end payment is completed, the WeChat server will send a payment notification to the back-end (that is, WeChat wants to tell you that the customer has paid), and the back-end will act according to this notification Make sure the payment is completed, and then take the corresponding actions after the payment is completed, such as modifying the order status, adding transaction logs, etc.

從這幾個(gè)步驟可以看出,后端主要的作用就是將支付需要的數(shù)據(jù)傳給微信服務(wù)器,再根據(jù)微信服務(wù)器的響應(yīng)確定支付是否完成。

這個(gè)流程還是蠻容易理解的。形象的說(shuō),前端就是個(gè)顧客,后端就是店家,微信服務(wù)器的統(tǒng)一下單接口就像收銀員。顧客跟店家說(shuō),
我是誰(shuí)誰(shuí)誰(shuí),現(xiàn)在我要付多少多少錢(qián)給你買(mǎi)什么什么。店家就跟收銀員說(shuō),那個(gè)誰(shuí)誰(shuí)誰(shuí)要付多少錢(qián),你準(zhǔn)備收錢(qián)吧。收銀員收到錢(qián)
后,就去告訴店家,我已經(jīng)收到錢(qián)了,你給他東西吧。

The following is a detailed explanation of the specific implementation of each step.

1. Front-end request for payment

前端請(qǐng)求支付,就是簡(jiǎn)單的攜帶支付需要的數(shù)據(jù),例如用戶(hù)標(biāo)識(shí),支付金額,支付訂單?ID?等等跟?**你的業(yè)務(wù)邏輯有關(guān)**?或者跟
?**下一步請(qǐng)求微信服務(wù)器支付統(tǒng)一下單接口需要的數(shù)據(jù)有關(guān)**?的相關(guān)數(shù)據(jù),使用微信小程序的?wx.request(?)?去請(qǐng)求后端的支
?付接口。

2. Front-end request for payment

后端接收到前端發(fā)送的支付請(qǐng)求后,可以進(jìn)行一下相關(guān)驗(yàn)證,例如判斷一下用戶(hù)有沒(méi)有問(wèn)題,支付金額對(duì)不對(duì)等等。
在驗(yàn)證沒(méi)什么問(wèn)題,可以向微信服務(wù)器申請(qǐng)支付之后,后端需要使用?微信規(guī)定的數(shù)據(jù)格式?去請(qǐng)求微信的支付統(tǒng)一下單接口。

Request data specified by WeChat:
This requires more code accomplish. Because the amount of data required is large, it also needs to be encrypted and sent in XML format.
First of all, the following data are parameters that must be provided to the WeChat server when using mini program payment.

Mini program appid. There is probably no one who writes small programs who doesn’t know this. . .

User ID openid. That is the user's mini program ID. I explained how to obtain it in my last blog.

Merchant number mch_id. After successfully applying for WeChat payment merchant certification, the email sent to you by WeChat will contain

merchant order number out_trade_no. The order number

generated by the merchant for this payment is the total amount total_fee. The total amount of the order, a very important point is that the unit is cents, so pay special attention to it.

WeChat server callback notification interface address notify_url. After WeChat confirms that the money has arrived, it will send multiple messages to this address to tell you that the customer has paid.

You need to return a message to WeChat to indicate that you have received the notification. . This address cannot have a port number, and must be able to directly accept POST method requests.

Transaction type trade_type. The WeChat applet payment value is unified as JSAPI

Product Information Body. Similar to the format of "Tencent-Game"

Terminal IP address spbill_create_ip. Terminal address IP, which is the IP address requesting payment.

Random string nonce_str. A string randomly generated by the backend is required to ensure data security. WeChat requires no longer than 32 bits.

signature sign. Use all the above parameters to process the encryption and generate the signature accordingly. (The specific processing method can be seen in the code below, which can be reused directly.)

After processing all the above data, organize the data in XML format and send it to WeChat Payment Unification using the POST method Order interface https://api.mch.weixin.qq.com/pay/unifiedorder.

3. The backend accepts the data returned by the WeChat server

After the WeChat server receives the payment data, if there is no problem with the data, it will return the corresponding data for payment. The most important thing is The data field named prepay_id needs to return this data to the front end so that the front end can continue to pay.

Therefore, after the back-end receives the return data from the WeChat server, it needs to perform corresponding processing, and finally return the following data to the front-end:

  1. appid No Need to say more

  2. timeStamp current timestamp

  3. nonceStr random string

  4. package That’s it Mentioned prepay_id, but remember the format is like "prepay_id= prepay_id_item". Otherwise an error will result.

  5. signType Encryption method, generally should be MD5

  6. paySign Process and encrypt the above data accordingly.

到這里,后端的支付接口已經(jīng)完成了接收前端支付請(qǐng)求,并返回了前端支付所需數(shù)據(jù)的功能。

4. 前端發(fā)起支付

前端在接收到返回?cái)?shù)據(jù)后,使用 wx.requestPayment() 來(lái)請(qǐng)求發(fā)起支付。此 API 需要的對(duì)象參數(shù)各項(xiàng)值就是我們上一步返回的各個(gè)數(shù)據(jù)。

5.后端接受微信服務(wù)器回調(diào)

前端完成支付后,微信服務(wù)器確認(rèn)支付已經(jīng)完成。就會(huì)向第一步中設(shè)置的回調(diào)地址發(fā)送通知。后端的接收回調(diào)接口在接收到通知后,就可以判斷支付是否完成,從而決定后續(xù)動(dòng)作。

需要注意的是,在接收到微信服務(wù)器的回調(diào)通知后,根據(jù)通知的result_code字段判斷支付是否成功。在接受到成功的通知后,后端需要返回success數(shù)據(jù)向微信服務(wù)器告知已得到回調(diào)通知。否則微信服務(wù)器會(huì)不停的向后端發(fā)送消息。另外微信的通知是以XML格式發(fā)送的,在接受處理時(shí)需要注意。

微信的大概支付流程就是這樣。以下是PHP語(yǔ)法的微信支付類(lèi),可以比照上面的步驟介紹,加深理解。在需要支付時(shí),直接傳入?yún)?shù)實(shí)例化此類(lèi)再調(diào)用類(lèi)的 pay 方法即可。

//微信支付類(lèi)
class?WeiXinPay{

????//=======【基本信息設(shè)置】=====================================
????//微信公眾號(hào)身份的唯一標(biāo)識(shí)
????protected?$APPID?=?appid;//填寫(xiě)您的appid。微信公眾平臺(tái)里的
????protected?$APPSECRET?=?secret;
????//受理商ID,身份標(biāo)識(shí)
????protected?$MCHID?=?'11111111';//商戶(hù)id
????//商戶(hù)支付密鑰Key
????protected?$KEY?=?'192006250b4c09247ec02edce69f6a2d';
????//回調(diào)通知接口
????protected?$APPURL?=??????'https://smart.afei.com/receivesuc';
????//交易類(lèi)型
????protected?$TRADETYPE?=?'JSAPI';
????//商品類(lèi)型信息
????protected?$BODY?=?'wx/book';

????//微信支付類(lèi)的構(gòu)造函數(shù)
????function?__construct($openid,$outTradeNo,$totalFee){
????????$this->openid?=?$openid;?//用戶(hù)唯一標(biāo)識(shí)
????????$this->outTradeNo?=?$outTradeNo;?//商品編號(hào)
????????$this->totalFee?=?$totalFee;?//總價(jià)
????}
????
????//微信支付類(lèi)向外暴露的支付接口
????public?function?pay(){
????????$result?=?$this->weixinapp();
????????return?$result;
????}
?????
?????//對(duì)微信統(tǒng)一下單接口返回的支付相關(guān)數(shù)據(jù)進(jìn)行處理
?????private?function?weixinapp(){
?????????$unifiedorder=$this->unifiedorder();

?????????$parameters=array(
??????????'appId'=>$this->APPID,//小程序ID
??????????'timeStamp'=>''.time().'',//時(shí)間戳
??????????'nonceStr'=>$this->createNoncestr(),//隨機(jī)串
??????????'package'=>'prepay_id='.$unifiedorder['prepay_id'],//數(shù)據(jù)包
??????????'signType'=>'MD5'//簽名方式
?????????????);
?????????$parameters['paySign']=$this->getSign($parameters);

?????????return?$parameters;
?????}

????/*
?????*請(qǐng)求微信統(tǒng)一下單接口
?????*/
????private?function?unifiedorder(){
????????$parameters?=?array(
????????????'appid'?=>?$this->APPID,//小程序id
????????????'mch_id'=>?$this->MCHID,//商戶(hù)id
????????????'spbill_create_ip'=>$_SERVER['REMOTE_ADDR'],//終端ip
????????????'notify_url'=>$this->APPURL,?//通知地址
????????????'nonce_str'=>?$this->createNoncestr(),//隨機(jī)字符串
????????????'out_trade_no'=>$this->outTradeNo,//商戶(hù)訂單編號(hào)
????????????'total_fee'=>floatval($this->totalFee),?//總金額
????????????'open_id'=>$this->openid,//用戶(hù)openid
????????????'trade_type'=>$this->TRADETYPE,//交易類(lèi)型
????????????'body'?=>$this->BODY,?//商品信息
????????);
????????$parameters['sign']?=?$this->getSign($parameters);
????????$xmlData?=?$this->arrayToXml($parameters);
????????$xml_result?=?$this->postXmlCurl($xmlData,'https://api.mch.weixin.qq.com/pay/unifiedorder',60);
????????$result?=?$this->xmlToArray($xml_result);
????????return?$result;
????}

???//數(shù)組轉(zhuǎn)字符串方法
???protected?function?arrayToXml($arr){
????????$xml?=?"<xml>";
????????foreach?($arr?as?$key=>$val)
????????{
????????????if?(is_numeric($val)){
????????????????$xml.="<".$key.">".$val."</".$key.">";
????????????}else{
?????????????????$xml.="<".$key."><![CDATA[".$val."]]></".$key.">";
????????????}
????????}
????????$xml.="</xml>";
????????return?$xml;
????}

????protected?function?xmlToArray($xml){
????????$array_data?=?json_decode(json_encode(simplexml_load_string($xml,?'SimpleXMLElement',?LIBXML_NOCDATA)),?true);
????????return?$array_data;
????}
????
????//發(fā)送xml請(qǐng)求方法
????private?static?function?postXmlCurl($xml,?$url,?$second?=?30)
????{
????????$ch?=?curl_init();
????????//設(shè)置超時(shí)
????????curl_setopt($ch,?CURLOPT_TIMEOUT,?$second);
????????curl_setopt($ch,?CURLOPT_URL,?$url);
????????curl_setopt($ch,?CURLOPT_SSL_VERIFYPEER,?FALSE);
????????curl_setopt($ch,?CURLOPT_SSL_VERIFYHOST,?FALSE);?//嚴(yán)格校驗(yàn)
????????//設(shè)置header
????????curl_setopt($ch,?CURLOPT_HEADER,?FALSE);
????????//要求結(jié)果為字符串且輸出到屏幕上
????????curl_setopt($ch,?CURLOPT_RETURNTRANSFER,?TRUE);
????????//post提交方式
????????curl_setopt($ch,?CURLOPT_POST,?TRUE);
????????curl_setopt($ch,?CURLOPT_POSTFIELDS,?$xml);
????????curl_setopt($ch,?CURLOPT_CONNECTTIMEOUT,?20);
????????curl_setopt($ch,?CURLOPT_TIMEOUT,?40);
????????set_time_limit(0);
????????//運(yùn)行curl
????????$data?=?curl_exec($ch);
????????//返回結(jié)果
????????if?($data)?{
????????????curl_close($ch);
????????????return?$data;
????????}?else?{
????????????$error?=?curl_errno($ch);
????????????curl_close($ch);
????????????throw?new?WxPayException("curl出錯(cuò),錯(cuò)誤碼:$error");
????????}
????}


????/*
?????*?對(duì)要發(fā)送到微信統(tǒng)一下單接口的數(shù)據(jù)進(jìn)行簽名
?????*/
????protected?function?getSign($Obj){
?????????foreach?($Obj?as?$k?=>?$v){
??????????$Parameters[$k]?=?$v;
?????????}
?????????//簽名步驟一:按字典序排序參數(shù)
?????????ksort($Parameters);
?????????$String?=?$this->formatBizQueryParaMap($Parameters,?false);
?????????//簽名步驟二:在string后加入KEY
?????????$String?=?$String."&key=".$this->KEY;
?????????//簽名步驟三:MD5加密
?????????$String?=?md5($String);
?????????//簽名步驟四:所有字符轉(zhuǎn)為大寫(xiě)
?????????$result_?=?strtoupper($String);
?????????return?$result_;
?????}

????/*
?????*排序并格式化參數(shù)方法,簽名時(shí)需要使用
?????*/
????protected?function?formatBizQueryParaMap($paraMap,?$urlencode)
????{
????????$buff?=?"";
????????ksort($paraMap);
????????foreach?($paraMap?as?$k?=>?$v)
????????{
????????????if($urlencode)
????????????{
???????????????$v?=?urlencode($v);
????????????}
????????????//$buff?.=?strtolower($k)?.?"="?.?$v?.?"&";
????????????$buff?.=?$k?.?"="?.?$v?.?"&";
????????}
????????$reqPar;
????????if?(strlen($buff)?>?0)
????????{
????????????$reqPar?=?substr($buff,?0,?strlen($buff)-1);
????????}
????????return?$reqPar;
????}

????/*
?????*?生成隨機(jī)字符串方法
?????*/
????protected?function?createNoncestr($length?=?32?){
?????????$chars?=?"abcdefghijklmnopqrstuvwxyz0123456789";
?????????$str?="";
?????????for?(?$i?=?0;?$i?< $length; $i++ ) {
          $str.= substr($chars, mt_rand(0, strlen($chars)-1), 1);
         }
         return $str;
         }
}

以上就是微信支付的相關(guān)流程。在理清思路后,流程還是比較清晰和簡(jiǎn)單的。重點(diǎn)在于需要注意一些細(xì)節(jié)問(wèn)題,例如數(shù)據(jù)格式,加密方法等。

下面說(shuō)一下微信小程序退款的具體實(shí)現(xiàn)

二.退款

小程序退款的流程和付款相似,但有一些細(xì)節(jié)上的不同。

首先退款的步驟通常如下:

  1. 用戶(hù)前端點(diǎn)擊退款按鈕后,后端接收到用戶(hù)的退款請(qǐng)求通過(guò)商城后臺(tái)呈現(xiàn)給商戶(hù),商戶(hù)確定允許退款后,后端再發(fā)起向微信退款接口的請(qǐng)求來(lái)請(qǐng)求退款。
  2. 后端向微信退款接口發(fā)送請(qǐng)求后,得到響應(yīng)信息,確定退款是否完成,根據(jù)退款是否完成再去進(jìn)行改變訂單狀態(tài)等業(yè)務(wù)邏輯。

退款的步驟相對(duì)微信支付來(lái)說(shuō)比較簡(jiǎn)單。

值得注意的有以下兩點(diǎn):
1.向微信退款接口請(qǐng)求退款后,根據(jù)得到的響應(yīng)是可以直接確定退款是否完成的。不再需要設(shè)置專(zhuān)門(mén)的回調(diào)接口等待微信通知。當(dāng)然如果需要也是可以在微信商戶(hù)平臺(tái)設(shè)置回調(diào)接口接受從而接受微信回調(diào)的,但并不是必須的。
2.退款請(qǐng)求需要在請(qǐng)求服務(wù)器安裝微信提供的安全證書(shū),也就是說(shuō),發(fā)起退款請(qǐng)求相比較支付請(qǐng)求在請(qǐng)求時(shí)請(qǐng)求方法不能復(fù)用,因?yàn)槲⑿磐丝钚枰獢y帶證書(shū)的請(qǐng)求,此證書(shū)可在申請(qǐng)微信商戶(hù)號(hào)成功后從微信商戶(hù)平臺(tái)自行下載,Linux下的PHP開(kāi)發(fā)環(huán)境的證書(shū)只需要放在網(wǎng)站根目錄的cert文件夾中即可。其他開(kāi)發(fā)環(huán)境可能需要導(dǎo)入操作。

下面講解一下退款的具體步驟

一. 用戶(hù)發(fā)起退款請(qǐng)求

用戶(hù)在前端發(fā)起退款請(qǐng)求,后端接收到退款請(qǐng)求,將相應(yīng)訂單標(biāo)記為申請(qǐng)退款,展示在后臺(tái).商戶(hù)查看后,如果同意退款再進(jìn)行相應(yīng)操作.
此后才進(jìn)入真正的退款流程.

二. 商戶(hù)發(fā)起退款請(qǐng)求

    商戶(hù)同意退款后,后端即向微信提供的退款 API 發(fā)起請(qǐng)求.
    同請(qǐng)求微信支付API一樣.退款請(qǐng)求也需要將需要的參數(shù)進(jìn)行簽名后以XML發(fā)送到微信的退款A(yù)PI 
    [https://api.mch.weixin.qq.com/pay/refund](https://api.mch.weixin.qq.com/pay/refund)

退款請(qǐng)求需要的參數(shù)如下(多個(gè)參數(shù)在支付API請(qǐng)求時(shí)也有使用):

  1. 小程序 appid。
  2. 商戶(hù)號(hào) mch_id 。申請(qǐng)開(kāi)通微信支付商戶(hù)認(rèn)證成功后微信發(fā)給你的郵件里有
  3. 商戶(hù)訂單號(hào) out_trade_no 。退款訂單在支付時(shí)生成的訂單號(hào)
  4. 退款訂單號(hào) out_refund_no 。由后端生成的退款單號(hào),需要保證唯一,因?yàn)槎鄠€(gè)同樣的退款單號(hào)只會(huì)退款一次。
  5. 總金額 total_fee 。訂單總金額,單位為分。
  6. 退款金額 refund_fee 需要退款的金額,單位同樣為分
  7. 操作員 op_user_id .與商戶(hù)號(hào)相同即可
  8. 隨機(jī)字符串 nonce_str 。同支付請(qǐng)求
  9. 簽名 sign 。使用上面的所有參數(shù)進(jìn)行相應(yīng)處理加密生成簽名。(具體處理方式與支付相同,可直接復(fù)用。)

三. 退款完成

在發(fā)起退款請(qǐng)求后,就可以直接根據(jù)請(qǐng)求的響應(yīng)XML中的	result_code字段來(lái)判斷退款是否成功,
從而對(duì)訂單狀態(tài)進(jìn)行處理和后續(xù)操作。不需要像支付那樣等待另一個(gè)接口的通知來(lái)確定請(qǐng)求狀態(tài)。當(dāng)然如上文所說(shuō),
如果需要微信服務(wù)器發(fā)送通知到后端的話(huà),可以到微信商戶(hù)平臺(tái)進(jìn)行設(shè)置。

退款因?yàn)榱鞒膛c支付大同小異,因此退款的PHP類(lèi)我選擇了直接繼承支付類(lèi),
代碼如下,注意區(qū)分退款請(qǐng)求方法postXmlSSLCurl和支付請(qǐng)求方法postXmlCurl的區(qū)別,這也就是上文提到的退款需要的雙向證書(shū)的使用。

   
     class WinXinRefund extends WeiXinPay{
        protected \$SSLCERT_PATH = &#39;cert/apiclient_cert.pem&#39;;//證書(shū)路徑
        protected \$SSLKEY_PATH =  &#39;cert/apiclient_key.pem&#39;;//證書(shū)路徑
        protected \$opUserId = &#39;1234567899&#39;;//商戶(hù)號(hào)
        
    function __construct($openid,$outTradeNo,$totalFee,$outRefundNo,$refundFee){
        //初始化退款類(lèi)需要的變量
        $this->openid?=?$openid;
????????$this->outTradeNo?=?$outTradeNo;
????????$this->totalFee?=?$totalFee;
????????$this->outRefundNo?=?$outRefundNo;
????????$this->refundFee?=?$refundFee;
????}?

????public?function?refund(){
????????//對(duì)外暴露的退款接口
????????$result?=?$this->wxrefundapi();
????????return?$result;
????}

????private?function?wxrefundapi(){
????????//通過(guò)微信api進(jìn)行退款流程
????????$parma?=?array(
????????????'appid'=>?$this->APPID,
????????????'mch_id'=>?$this->MCHID,
????????????'nonce_str'=>?$this->createNoncestr(),
????????????'out_refund_no'=>?$this->outRefundNo,
????????????'out_trade_no'=>?$this->outTradeNo,
????????????'total_fee'=>?$this->totalFee,
????????????'refund_fee'=>?$this->refundFee,
????????????'op_user_id'?=>?$this->opUserId,
????????);
????????$parma['sign']?=?$this->getSign($parma);
????????$xmldata?=?$this->arrayToXml($parma);
????????$xmlresult?=?$this->postXmlSSLCurl($xmldata,'https://api.mch.weixin.qq.com/secapi/pay/refund');
????????$result?=?$this->xmlToArray($xmlresult);
????????return?$result;
????}

????//需要使用證書(shū)的請(qǐng)求
????function?postXmlSSLCurl($xml,$url,$second=30)
????{
????????$ch?=?curl_init();
????????//超時(shí)時(shí)間
????????curl_setopt($ch,CURLOPT_TIMEOUT,$second);
????????//這里設(shè)置代理,如果有的話(huà)
????????//curl_setopt($ch,CURLOPT_PROXY,?'8.8.8.8');
????????//curl_setopt($ch,CURLOPT_PROXYPORT,?8080);
????????curl_setopt($ch,CURLOPT_URL,?$url);
????????curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,FALSE);
????????curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,FALSE);
????????//設(shè)置header
????????curl_setopt($ch,CURLOPT_HEADER,FALSE);
????????//要求結(jié)果為字符串且輸出到屏幕上
????????curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
????????//設(shè)置證書(shū)
????????//使用證書(shū):cert?與?key?分別屬于兩個(gè).pem文件
????????//默認(rèn)格式為PEM,可以注釋
????????curl_setopt($ch,CURLOPT_SSLCERTTYPE,'PEM');
????????curl_setopt($ch,CURLOPT_SSLCERT,?$this->SSLCERT_PATH);
????????//默認(rèn)格式為PEM,可以注釋
????????curl_setopt($ch,CURLOPT_SSLKEYTYPE,'PEM');
????????curl_setopt($ch,CURLOPT_SSLKEY,?$this->SSLKEY_PATH);
????????//post提交方式
????????curl_setopt($ch,CURLOPT_POST,?true);
????????curl_setopt($ch,CURLOPT_POSTFIELDS,$xml);
????????$data?=?curl_exec($ch);
????????//返回結(jié)果
????????if($data){
????????????curl_close($ch);
????????????return?$data;
????????}
????????else?{
????????????$error?=?curl_errno($ch);
????????????echo?"curl出錯(cuò),錯(cuò)誤碼:$error"."<br>";
????????????curl_close($ch);
????????????return?false;
????????}
????}}

##?三.?總結(jié)
????以上就是關(guān)于微信支付和退款的流程及相關(guān)知識(shí)的介紹。文中的?PHP類(lèi)?均封裝直接可用。
????因?yàn)槲⑿胖Ц逗屯丝钌婕暗臇|西較為繁雜,很多人直接看官方文檔可能會(huì)一頭霧水,所以看過(guò)此文了解流程和要點(diǎn)后,再去看微信官方文檔。一方面可以更清晰的了解小程序的支付和退款流程。另一方面,本文因?yàn)槠邢藜白髡吣芰τ邢?,肯定有無(wú)暇顧及或有所紕漏之處。為求穩(wěn)妥,還是需要多看看官方開(kāi)發(fā)文檔。畢竟事涉支付,出個(gè)BUG可不是小事。
????最后扯點(diǎn)閑話(huà)吧。這篇博客本來(lái)應(yīng)該在三個(gè)月前就發(fā)表的,也算當(dāng)時(shí)我從一無(wú)所知到獨(dú)立完成微信小程序商城前后端的總結(jié)系列的第一篇。但是公司突然出現(xiàn)人員和項(xiàng)目的變動(dòng),導(dǎo)致管理和項(xiàng)目上都混亂不堪,再加上個(gè)人的惰性,導(dǎo)致此篇博客一直拖到三個(gè)月后的今天才斷斷續(xù)續(xù)寫(xiě)完。這三個(gè)月我的心態(tài)因?yàn)楦鞣N事起起伏伏,也頗有一番風(fēng)味。
????借用李志的一句歌詞結(jié)束這篇博客吧。下一篇是什么時(shí)候也說(shuō)不定了,我苦笑。
????
>我再也不會(huì)把自己,愚蠢的交給過(guò)去。我的生活和我的想法,從此相隔萬(wàn)里。

推薦教程:《微信小程序

The above is the detailed content of Detailed explanation of mini program payment and refund process. For more information, please follow other related articles on 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)

Hot Topics

PHP Tutorial
1488
72
Xianyu WeChat mini program officially launched Xianyu WeChat mini program officially launched Feb 10, 2024 pm 10:39 PM

Xianyu's official WeChat mini program has quietly been launched. In the mini program, you can post private messages to communicate with buyers/sellers, view personal information and orders, search for items, etc. If you are curious about what the Xianyu WeChat mini program is called, take a look now. What is the name of the Xianyu WeChat applet? Answer: Xianyu, idle transactions, second-hand sales, valuations and recycling. 1. In the mini program, you can post idle messages, communicate with buyers/sellers via private messages, view personal information and orders, search for specified items, etc.; 2. On the mini program page, there are homepage, nearby, post idle, messages, and mine. 5 functions; 3. If you want to use it, you must activate WeChat payment before you can purchase it;

Implement image filter effects in WeChat mini programs Implement image filter effects in WeChat mini programs Nov 21, 2023 pm 06:22 PM

Implementing picture filter effects in WeChat mini programs With the popularity of social media applications, people are increasingly fond of applying filter effects to photos to enhance the artistic effect and attractiveness of the photos. Picture filter effects can also be implemented in WeChat mini programs, providing users with more interesting and creative photo editing functions. This article will introduce how to implement image filter effects in WeChat mini programs and provide specific code examples. First, we need to use the canvas component in the WeChat applet to load and edit images. The canvas component can be used on the page

Implement the drop-down menu effect in WeChat applet Implement the drop-down menu effect in WeChat applet Nov 21, 2023 pm 03:03 PM

To implement the drop-down menu effect in WeChat Mini Programs, specific code examples are required. With the popularity of mobile Internet, WeChat Mini Programs have become an important part of Internet development, and more and more people have begun to pay attention to and use WeChat Mini Programs. The development of WeChat mini programs is simpler and faster than traditional APP development, but it also requires mastering certain development skills. In the development of WeChat mini programs, drop-down menus are a common UI component, achieving a better user experience. This article will introduce in detail how to implement the drop-down menu effect in the WeChat applet and provide practical

What is the name of Xianyu WeChat applet? What is the name of Xianyu WeChat applet? Feb 27, 2024 pm 01:11 PM

The official WeChat mini program of Xianyu has been quietly launched. It provides users with a convenient platform that allows you to easily publish and trade idle items. In the mini program, you can communicate with buyers or sellers via private messages, view personal information and orders, and search for the items you want. So what exactly is Xianyu called in the WeChat mini program? This tutorial guide will introduce it to you in detail. Users who want to know, please follow this article and continue reading! What is the name of the Xianyu WeChat applet? Answer: Xianyu, idle transactions, second-hand sales, valuations and recycling. 1. In the mini program, you can post idle messages, communicate with buyers/sellers via private messages, view personal information and orders, search for specified items, etc.; 2. On the mini program page, there are homepage, nearby, post idle, messages, and mine. 5 functions; 3.

WeChat applet implements image upload function WeChat applet implements image upload function Nov 21, 2023 am 09:08 AM

WeChat applet implements picture upload function With the development of mobile Internet, WeChat applet has become an indispensable part of people's lives. WeChat mini programs not only provide a wealth of application scenarios, but also support developer-defined functions, including image upload functions. This article will introduce how to implement the image upload function in the WeChat applet and provide specific code examples. 1. Preparatory work Before starting to write code, we need to download and install the WeChat developer tools and register as a WeChat developer. At the same time, you also need to understand WeChat

Implement image rotation effect in WeChat applet Implement image rotation effect in WeChat applet Nov 21, 2023 am 08:26 AM

To implement the picture rotation effect in WeChat Mini Program, specific code examples are required. WeChat Mini Program is a lightweight application that provides users with rich functions and a good user experience. In mini programs, developers can use various components and APIs to achieve various effects. Among them, the picture rotation effect is a common animation effect that can add interest and visual effects to the mini program. To achieve image rotation effects in WeChat mini programs, you need to use the animation API provided by the mini program. The following is a specific code example that shows how to

Use WeChat applet to achieve carousel switching effect Use WeChat applet to achieve carousel switching effect Nov 21, 2023 pm 05:59 PM

Use the WeChat applet to achieve the carousel switching effect. The WeChat applet is a lightweight application that is simple and efficient to develop and use. In WeChat mini programs, it is a common requirement to achieve carousel switching effects. This article will introduce how to use the WeChat applet to achieve the carousel switching effect, and give specific code examples. First, add a carousel component to the page file of the WeChat applet. For example, you can use the &lt;swiper&gt; tag to achieve the switching effect of the carousel. In this component, you can pass b

Implement the sliding delete function in WeChat mini program Implement the sliding delete function in WeChat mini program Nov 21, 2023 pm 06:22 PM

Implementing the sliding delete function in WeChat mini programs requires specific code examples. With the popularity of WeChat mini programs, developers often encounter problems in implementing some common functions during the development process. Among them, the sliding delete function is a common and commonly used functional requirement. This article will introduce in detail how to implement the sliding delete function in the WeChat applet and give specific code examples. 1. Requirements analysis In the WeChat mini program, the implementation of the sliding deletion function involves the following points: List display: To display a list that can be slid and deleted, each list item needs to include

See all articles