|
2.微信小程序處理 .wxml
.js
3 后臺(tái)處理部分(博主使用PHP為例子)【其他語(yǔ)言參照修改就可以了】 以下參數(shù)不懂,可通過這個(gè)查看,微信文檔查看參數(shù)的名稱 https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_1
下面是實(shí)現(xiàn)的代碼:
//微信支付
public function Pay(){
$fee = 0.01;//舉例充值0.01
$appid = '微信小程序的appid【自己填寫】';//如果是公眾號(hào) 就是公眾號(hào)的appid
$body = '蝸牛充值【自己填寫】';
$mch_id = '你的商戶號(hào)【自己填寫】';
$nonce_str = $this->nonce_str();//隨機(jī)字符串
$notify_url = '回調(diào)的url【自己填寫】';
$openid = '用戶的openid【自己填寫】';
$out_trade_no = $this->order_number();//商戶訂單號(hào)
$spbill_create_ip = '服務(wù)器的ip【自己填寫】';
$total_fee = $fee*100;//因?yàn)槌渲到痤~最小是1 而且單位為分 如果是充值1
|