PHP微信支付訂單通用查詢方法

2021-10-09 07:42:59 字數 2607 閱讀 6928

$res

=$this

->

orderquery

($request

->

order_num);

if($res

['return_code']==

'success'

)elseif

($res

['return_code']==

'fail'

)

/**

* 檢查訂單是否完成

* addtime 2023年9月9日 16:58:36

* @param [type] $out_trade_no

* @return void

*/public

function

orderquery

($out_trade_no

)else

}

/**

* [xmltoarray xml轉換成陣列]

* @param [type] $xml [description]

* @return [type] [description]

*/public

function

xmltoarray

($xml

)/**

* [arraytoxml 陣列轉換成xml]

* @param [type] $arr [description]

* @return [type] [description]

*/public

function

arraytoxml

($arr

)else

}$xml.=

"";return

$xml;}

/** * [nonce_str 32位隨機字串]

* @param integer $length [description]

* @return [type] [description]

*/public

function

nonce_str

($length=32

)return

$nonce_str;}

/** * [postxmlcurl post xml 傳送]

* @param [type] $xml [description]

* @param [type] $url [description]

* @param integer $second [description]

* @return [type] [description]

*/public

static

function

postxmlcurl

($xml

,$url

,$second=30

)}/** * [getsign 生成簽名]

* @param [type] $obj [description]

* @return [type] [description]

*/public

function

getsign

($obj

)//簽名步驟一:按字典序排序引數

ksort

($parameters);

$string

=$this

->

formatbizqueryparamap

($parameters

,false);

//簽名步驟二:在string後加入key

$string

=$string

."&key="

.$key

;//簽名步驟三:md5加密

$string

=md5

($string);

//簽名步驟四:所有字元轉為大寫

$result_

=strtoupper

($string);

return

$result_;}

/** * [formatbizqueryparamap [格式化引數,簽名過程需要使用]

* @param [type] $paramap [description]

* @param [type] $urlencode [description]

* @return [type] [description]

*/private

function

formatbizqueryparamap

($paramap

,$urlencode

)$buff.=

$k."=".$v.

"&";

}$reqpar;if

(strlen

($buff

)>0)

return

$reqpar

;}

php 支付寶訂單查詢 微信支付開發訂單查詢例項

因為某一方技術的原因,可能導致商戶在預期時間內都收不到最終支付通知,此時商戶可以通過該api來查詢訂單的詳細支付狀態。訂單查詢api的url為 package out trade no 11122 partner 1900090055 sign 4e8d0df3da0c3d0df38f timest...

php 支付寶訂單查詢 基於PHP的微信支付教程

訂單查詢 對應檔案管理中example資料夾下的orderquery.php檔案 1,標頭檔案引入 必須引入的標頭檔案,以sdk的路徑為例子 require once lib wxpay.api.php require once log.php 2,查詢條件 3,採用商戶訂單號查詢 首先我們要這這個...

PHP 微信支付

use think model 使用示例 options array 統一下單方法 params body 商品描述 商品描述 params out trade no 1217752501201407 自定義的訂單號 params total fee 100 訂單金額 只能為整數 單位為分 下單方法...