微信小程序 企業付款到零錢 PHP版|燃情出品

需求:

我們在做商城或者其他和用戶賬戶,金錢相關功能的時候基本都會有提現的功能,所以我也逃不過,這個支付的坑,來跟我一起來填坑:

編寫前置條件:

已開通微信支付;
連續30日正常交易流水;
其他見文檔;
——————————————————————————————
所有接口調用都遵循一個原則:
輸入參數:
appid 應用id
mchid 商戶id
secret key 支付密鑰
ip 調用端ip,需要微信支付後臺配置
openid 用戶id
輸出參數:
結果:

牢記以上幾點,估計就離成功不遠了;

<?php
//企業付款到微信零錢,PHP接口調用方法
define("APPID", "yourappid"); // 商戶賬號appid
define("MCHID", "yourbesenisecode");      // 商戶號
define("SECRECT_KEY", "yourkey");  //支付密鑰簽名
define("IP", "106.37.80.155");   //IP
 
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;
}
 
    
function unicode() {
    $str = uniqid(mt_rand(),1);
    $str=sha1($str);
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章