PHP微信支付開發
1.開發環境
Thinkphp 3.2.3
微信:服務號,已認證
開發域名:http://test.paywechat.com (自定義的域名,外網不可訪問)
3.開發
下載好微信支付PHP版本的SDK,檔案目錄為下圖:
把微信支付SDK的Cert和Lib目錄放入Thinkphp,目錄為
現在介紹微信支付授權目錄問題,首先是微信支付開發配置裡面的支付授權目錄填寫,
然後填寫JS介面安全域。
最後設定網頁授權
這些設定完,基本完成一半,注意設定的目錄和我thinkphp裡面的目錄。
4.微信支付配置
把相關配置填寫正確。
/**
* 配置賬號資訊
*/
class WxPayConfig
{
//=======【基本資訊設定】=====================================
//
/**
* TODO: 修改這裡配置為您自己申請的商戶資訊
* 微信公眾號資訊配置
*
* APPID:繫結支付的APPID(必須配置,開戶郵件中可檢視)
*
* MCHID:商戶號(必須配置,開戶郵件中可檢視)
*
* KEY:商戶支付金鑰,參考開戶郵件設定(必須配置,登入商戶平臺自行設定)
* 設定地址:https://pay.weixin.qq.com/index.php/account/api_cert
*
* APPSECRET:公眾帳號secert(僅JSAPI支付的時候需要配置, 登入公眾平臺,進入開發者中心可設定),
* 獲取地址:https://mp.weixin.qq.com/advanced/advanced?action=dev&t=advanced/dev&token=2005451881&lang=zh_CN
* @var string
*/
const APPID = '';
const MCHID = '';
const KEY = '';
const APPSECRET = '';
//=======【證書路徑設定】=====================================
/**
* TODO:設定商戶證書路徑
* 證書路徑,注意應該填寫絕對路徑(僅退款、撤銷訂單時需要,可登入商戶平臺下載,
* API證書下載地址:https://pay.weixin.qq.com/index.php/account/api_cert,下載之前需要安裝商戶操作證書)
* @var path
*/
const SSLCERT_PATH = '../cert/apiclient_cert.pem';
const SSLKEY_PATH = '../cert/apiclient_key.pem';
//=======【curl代理設定】===================================
/**
* TODO:這裡設定代理機器,只有需要代理的時候才設定,不需要代理,請設定為0.0.0.0和0
* 本例程通過curl使用HTTP POST方法,此處可修改代理伺服器,
* 預設CURL_PROXY_HOST=0.0.0.0和CURL_PROXY_PORT=0,此時不開啟代理(如有需要才設定)
* @var unknown_type
*/
const CURL_PROXY_HOST = "0.0.0.0";//"10.152.18.220";
const CURL_PROXY_PORT = 0;//8080;
//=======【上報資訊配置】===================================
/**
* TODO:介面呼叫上報等級,預設緊錯誤上報(注意:上報超時間為【1s】,上報無論成敗【永不丟擲異常】,
* 不會影響介面呼叫流程),開啟上報之後,方便微信監控請求呼叫的質量,建議至少
* 開啟錯誤上報。
* 上報等級,0.關閉上報; 1.僅錯誤出錯上報; 2.全量上報
* @var int
*/
const REPORT_LEVENL = 1;
}
現在開始貼出程式碼:
namespace Wechat\Controller;
use Think\Controller;
/**
* 父類控制器,需要繼承
* @file ParentController.class.php
* @author Gary <[email protected]>
* @date 2015年8月4日
* @todu
*/
class ParentController extends Controller {
protected $options = array (
'token' => '', // 填寫你設定的key
'encodingaeskey' => '', // 填寫加密用的EncodingAESKey
'appid' => '', // 填寫高階呼叫功能的app id
'appsecret' => '', // 填寫高階呼叫功能的金鑰
'debug' => false,
'logcallback' => ''
);
public $errCode = 40001;
public $errMsg = "no access";
/**
* 獲取access_token
* @return mixed|boolean|unknown
*/
public function getToken(){
$cache_token = S('exp_wechat_pay_token');
if(!empty($cache_token)){
return $cache_token;
}
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s';
$url = sprintf($url,$this->options['appid'],$this->options['appsecret']);
$result = $this->http_get($url);
$result = json_decode($result,true);
if(empty($result)){
return false;
}
S('exp_wechat_pay_token',$result['access_token'],array('type'=>'file','expire'=>3600));
return $result['access_token'];
}
/**
* 傳送客服訊息
* @param array $data 訊息結構{"touser":"OPENID","msgtype":"news","news":{...}}
*/
public function sendCustomMessage($data){
$token = $this->getToken();
if (empty($token)) return false;
$url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=%s';
$url = sprintf($url,$token);
$result = $this->http_post($url,self::json_encode($data));
if ($result)
{
$json = json_decode($result,true);
if (!$json || !empty($json['errcode'])) {
$this->errCode = $json['errcode'];
$this->errMsg = $json['errmsg'];
return false;
}
return $json;
}
return false;
}
/**
* 傳送模板訊息
* @param unknown $data
* @return boolean|unknown
*/
public function sendTemplateMessage($data){
$token = $this->getToken();
if (empty($token)) return false;
$url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=%s";
$url = sprintf($url,$token);
$result = $this->http_post($url,self::json_encode($data));
if ($result)
{
$json = json_decode($result,true);
if (!$json || !empty($json['errcode'])) {
$this->errCode = $json['errcode'];
$this->errMsg = $json['errmsg'];
return false;
}
return $json;
}
return false;
}
public function getFileCache($name){
return S($name);
}
/**
* 微信api不支援中文轉義的json結構
* @param array $arr
*/
static function json_encode($arr) {
$parts = array ();
$is_list = false;
//Find out if the given array is a numerical array
$keys = array_keys ( $arr );
$max_length = count ( $arr ) - 1;
if (($keys [0] === 0) && ($keys [$max_length] === $max_length )) { //See if the first key is 0 and last key is length - 1
$is_list = true;
for($i = 0; $i < count ( $keys ); $i ++) { //See if each key correspondes to its position
if ($i != $keys [$i]) { //A key fails at position check.
$is_list = false; //It is an associative array.
break;
}
}
}
foreach ( $arr as $key => $value ) {
if (is_array ( $value )) { //Custom handling for arrays
if ($is_list)
$parts [] = self::json_encode ( $value ); /* :RECURSION: */
else
$parts [] = '"' . $key . '":' . self::json_encode ( $value ); /* :RECURSION: */
} else {
$str = '';
if (! $is_list)
$str = '"' . $key . '":';
//Custom handling for multiple data types
if (!is_string ( $value ) && is_numeric ( $value ) && $value<2000000000)
$str .= $value; //Numbers
elseif ($value === false)
$str .= 'false'; //The booleans
elseif ($value === true)
$str .= 'true';
else
$str .= '"' . addslashes ( $value ) . '"'; //All other things
// :TODO: Is there any more datatype we should be in the lookout for? (Object?)
$parts [] = $str;
}
}
$json = implode ( ',', $parts );
if ($is_list)
return '[' . $json . ']'; //Return numerical JSON
return '{' . $json . '}'; //Return associative JSON
}
/**
+----------------------------------------------------------
* 生成隨機字串
+----------------------------------------------------------
* @param int $length 要生成的隨機字串長度
* @param string $type 隨機碼型別:0,數字+大小寫字母;1,數字;2,小寫字母;3,大寫字母;4,特殊字元;-1,數字+大小寫字母+特殊字元
+----------------------------------------------------------
* @return string
+----------------------------------------------------------
*/
static public function randCode($length = 5, $type = 2){
$arr = array(1 => "0123456789", 2 => "abcdefghijklmnopqrstuvwxyz", 3 => "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 4 => "[email protected]#$%^&*(){}[]|");
if ($type == 0) {
array_pop($arr);
$string = implode("", $arr);
} elseif ($type == "-1") {
$string = implode("", $arr);
} else {
$string = $arr[$type];
}
$count = strlen($string) - 1;
$code = '';
for ($i = 0; $i < $length; $i++) {
$code .= $string[rand(0, $count)];
}
return $code;
}
/**
* GET 請求
* @param string $url
*/
private function http_get($url){
$oCurl = curl_init();
if(stripos($url,"https://")!==FALSE){
curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($oCurl, CURLOPT_SSLVERSION, 1); //CURL_SSLVERSION_TLSv1
}
curl_setopt($oCurl, CURLOPT_URL, $url);
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 );
$sContent = curl_exec($oCurl);
$aStatus = curl_getinfo($oCurl);
curl_close($oCurl);
if(intval($aStatus["http_code"])==200){
return $sContent;
}else{
return false;
}
}
/**
* POST 請求
* @param string $url
* @param array $param
* @param boolean $post_file 是否檔案上傳
* @return string content
*/
private function http_post($url,$param,$post_file=false){
$oCurl = curl_init();
if(stripos($url,"https://")!==FALSE){
curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($oCurl, CURLOPT_SSLVERSION, 1); //CURL_SSLVERSION_TLSv1
}
if (is_string($param) || $post_file) {
$strPOST = $param;
} else {
$aPOST = array();
foreach($param as $key=>$val){
$aPOST[] = $key."=".urlencode($val);
}
$strPOST = join("&", $aPOST);
}
curl_setopt($oCurl, CURLOPT_URL, $url);
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($oCurl, CURLOPT_POST,true);
curl_setopt($oCurl, CURLOPT_POSTFIELDS,$strPOST);
$sContent = curl_exec($oCurl);
$aStatus = curl_getinfo($oCurl);
curl_close($oCurl);
if(intval($aStatus["http_code"])==200){
return $sContent;
}else{
return false;
}
}
}
namespace Wechat\Controller;
use Wechat\Controller\ParentController;
/**
* 微信支付測試控制器
* @file TestController.class.php
* @author Gary <[email protected]>
* @date 2015年8月4日
* @todu
*/
class TestController extends ParentController {
private $_order_body = 'xxx';
private $_order_goods_tag = 'xxx';
public function __construct(){
parent::__construct();
require_once ROOT_PATH."Api/lib/WxPay.Api.php";
require_once ROOT_PATH."Api/lib/WxPay.JsApiPay.php";
}
public function index(){
//①、獲取使用者openid
$tools = new \JsApiPay();
$openId = $tools->GetOpenid();
//②、統一下單
$input = new \WxPayUnifiedOrder();
//商品描述
$input->SetBody($this->_order_body);
//附加資料,可以新增自己需要的資料,微信回非同步回撥時會附加這個資料
$input->SetAttach('xxx');
//商戶訂單號
$out_trade_no = \WxPayConfig::MCHID.date("YmdHis");
$input->SetOut_trade_no($out_trade_no);
//總金額,訂單總金額,只能為整數,單位為分
$input->SetTotal_fee(1);
//交易起始時間
$input->SetTime_start(date("YmdHis"));
//交易結束時間
$input->SetTime_expire(date("YmdHis", time() + 600));
//商品標記
$input->SetGoods_tag($this->_order_goods_tag);
//通知地址,接收微信支付非同步通知回撥地址 SITE_URL=http://test.paywechat.com/Charge
$notify_url = SITE_URL.'/index.php/Test/notify.html';
$input->SetNotify_url($notify_url);
//交易型別
$input->SetTrade_type("JSAPI");
$input->SetOpenid($openId);
$order = \WxPayApi::unifiedOrder($input);
$jsApiParameters = $tools->GetJsApiParameters($order);
//獲取共享收貨地址js函式引數
$editAddress = $tools->GetEditAddressParameters();
$this->assign('openId',$openId);
$this->assign('jsApiParameters',$jsApiParameters);
$this->assign('editAddress',$editAddress);
$this->display();
}
/**
* 非同步通知回撥方法
*/
public function notify(){
require_once ROOT_PATH."Api/lib/notify.php";
$notify = new \PayNotifyCallBack();
$notify->Handle(false);
//這裡的IsSuccess是我自定義的一個方法,後面我會貼出這個檔案的程式碼,供參考。
//不建議這麼寫,儘量使用官方的重寫NotifyProcess方法,並把事務邏輯寫在裡面。
$is_success = $notify->IsSuccess();
$bdata = $is_success['data'];
//支付成功
if($is_success['code'] == 1){
$news = array(
'touser' => $bdata['openid'],
'msgtype' => 'news',
'news' => array (
'articles'=> array (
array(
'title' => '訂單支付成功',
'description' => "支付金額:{$bdata['total_fee']}\n".
"微信訂單號:{$bdata['transaction_id']}\n"
'picurl' => '',
'url' => ''
)
)
)
);
//傳送微信支付通知
$this->sendCustomMessage($news);
}else{//支付失敗
}
}
/**
* 支付成功頁面
* 不可靠的回撥
* 可以在這裡顯示一下支付成功跳轉,不建議在這裡直接寫後臺支付成功邏輯。
*/
public function ajax_PaySuccess(){
//訂單號
$out_trade_no = I('post.out_trade_no');
//支付金額
$total_fee = I('post.total_fee');
/*相關邏輯處理*/
}
貼上模板HTML
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>微信支付樣例-支付</title>
<script type="text/javascript">
//呼叫微信JS api 支付
function jsApiCall()
{
WeixinJSBridge.invoke(
'getBrandWCPayRequest',
{$jsApiParameters},
function(res){
WeixinJSBridge.log(res.err_msg);
//取消支付
if(res.err_msg == 'get_brand_wcpay_request:cancel'){
//處理取消支付的事件邏輯
}else if(res.err_msg == "get_brand_wcpay_request:ok"){
/*使用以上方式判斷前端返回,微信團隊鄭重提示:
res.err_msg將在使用者支付成功後返回 ok,但並不保證它絕對可靠。
這裡可以使用Ajax提交到後臺,處理一些日誌,如Test控制器裡面的ajax_PaySuccess方法。
*/
}
alert(res.err_code+res.err_desc+res.err_msg);
}
);
}
function callpay()
{
if (typeof WeixinJSBridge == "undefined"){
if( document.addEventListener ){
document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
}else if (document.attachEvent){
document.attachEvent('WeixinJSBridgeReady', jsApiCall);
document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
}
}else{
jsApiCall();
}
}
//獲取共享地址
function editAddress()
{
WeixinJSBridge.invoke(
'editAddress',
{$editAddress},
function(res){
var value1 = res.proviceFirstStageName;
var value2 = res.addressCitySecondStageName;
var value3 = res.addressCountiesThirdStageName;
var value4 = res.addressDetailInfo;
var tel = res.telNumber;
alert(value1 + value2 + value3 + value4 + ":" + tel);
}
);
}
window.onload = function(){
if (typeof WeixinJSBridge == "undefined"){
if( document.addEventListener ){
document.addEventListener('WeixinJSBridgeReady', editAddress, false);
}else if (document.attachEvent){
document.attachEvent('WeixinJSBridgeReady', editAddress);
document.attachEvent('onWeixinJSBridgeReady', editAddress);
}
}else{
editAddress();
}
};
</script>
</head>
<body>
<br/>
<font color="#9ACD32"><b>該筆訂單支付金額為<span style="color:#f00;font-size:50px">1分</span>錢</b></font><br/><br/>
<div align="center">
<button style="width:210px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer; color:white; font-size:16px;" type="button" onclick="callpay()" >立即支付</button>
</div>
</body>
</html>
notify.php檔案程式碼,這裡有在官方檔案裡新新增的一個自定義方法。
require_once ROOT_PATH."Api/lib/WxPay.Api.php";
require_once ROOT_PATH.'Api/lib/WxPay.Notify.php';
require_once ROOT_PATH.'Api/lib/log.php';
//初始化日誌
$logHandler= new \CLogFileHandler(ROOT_PATH."/logs/".date('Y-m-d').'.log');
$log = \Log::Init($logHandler, 15);
class PayNotifyCallBack extends WxPayNotify
{
protected $para = array('code'=>0,'data'=>'');
//查詢訂單
public function Queryorder($transaction_id)
{
$input = new \WxPayOrderQuery();
$input->SetTransaction_id($transaction_id);
$result = \WxPayApi::orderQuery($input);
\Log::DEBUG("query:" . json_encode($result));
if(array_key_exists("return_code", $result)
&& array_key_exists("result_code", $result)
&& $result["return_code"] == "SUCCESS"
&& $result["result_code"] == "SUCCESS")
{
return true;
}
$this->para['code'] = 0;
$this->para['data'] = '';
return false;
}
//重寫回調處理函式
public function NotifyProcess($data, &$msg)
{
\Log::DEBUG("call back:" . json_encode($data));
$notfiyOutput = array();
if(!array_key_exists("transaction_id", $data)){
$msg = "輸入引數不正確";
$this->para['code'] = 0;
$this->para['data'] = '';
return false;
}
//查詢訂單,判斷訂單真實性
if(!$this->Queryorder($data["transaction_id"])){
$msg = "訂單查詢失敗";
$this->para['code'] = 0;
$this->para['data'] = '';
return false;
}
$this->para['code'] = 1;
$this->para['data'] = $data;
return true;
}
/**
* 自定義方法 檢測微信端是否回撥成功方法
* 不建議這麼寫,儘量使用官方的重寫NotifyProcess方法,並把事務邏輯寫在裡面。
* @return multitype:number string
*/
public function IsSuccess(){
return $this->para;
}
}
相關推薦
PHP微信支付開發例項
1.開發環境 Thinkphp 3.2.3 微信:服務號,已認證 開發域名:http://test.paywechat.com (自定義的域名,外網不可訪問) 2.需要相關檔案和許可權 微信支付需申請開通 微信公眾平臺開發者文件:htt
php 微信支付開發 呼叫支付jsapi缺少引數 appid
原文來自 https://blog.csdn.net/eclothy/article/details/73639578字串轉物件JSON.parse(data)post返回結果得到的是一個字串,看上去沒有錯,但是實際是用不了了,轉換一下錯誤就沒有提示了。
PHP微信支付開發
1.開發環境 Thinkphp 3.2.3 微信:服務號,已認證 開發域名:http://test.paywechat.com (自定義的域名,外網不可訪問) 3.開發 下載好微信支付PHP版本的SDK,檔案目錄為下圖: 把微信支付SD
中篇: php 微信支付 基於Thinkphp3.2開發
onf .cn main 回調 eip font 由於 lib ora ⑤ 微信支付接口的使用 a.微信公眾平臺文檔:https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115 b.微信支付
php微信支付接口開發的實現程序
etc 內容 網站 ati eat xxx 通過 發微信 ood 微信支付接口現在也慢慢的像支付寶一個可以利用api接口來實現第三方網站或應用進行支付了,下文是我公司的技術人員整理了一個php微信支付接口開發程序並且己測試,有興趣的朋友可進入參考。 必要條件: ap
php微信支付介面開發,獲取php微信掃碼支付返回結果,php開發微信支付demo原始碼
現在很多網站都是用php開發的, 一些觀看了子恆老師微信公眾號運營視訊後, 想要更加深入的學習, 留言說“php怎麼做微信支付介面開發呢?” “有沒有php微信支付介面開發的demo例項” 下面來詳細談談… 一、 php微信支付介面開發要做的準備 只有你先準備配置好, 然後才能正確
php微信支付(僅Jsapi支付)詳細步驟.----僅適合第一次做微信開發的程式設計師
本人最近做了微信支付開發,是第一次接觸.其中走了很多彎路,遇到的問題也很多.為了讓和我一樣的新人不再遇到類似的問題,我把我的開發步驟和問題寫出來,以供參考. 開發時間是2016/8/2,所以微信支付的版本也是對應此時的版本. 一.前期準備: 首先你們公司開通微信支付功能後
PHP微信支付介面開發
在開始之前先看下功能 然後選擇刷卡支付 輸入手機微信錢包的授權碼,成功執行 方法步驟: 需要先下一個DEMO,下DEMO的地方有兩個: 一個是微信官方開發者文件地址 但是官方的DEMO有個缺陷
快速接入PHP微信支付
其他 授權 true unifi 寫到 nbsp 多人 商品 attach 微信支付是微信開發中坑最多的一個功能,本文旨在幫助有開發基礎的人快速接入微信支付,如果要詳細了解微信支付,請看微信支付的開發文檔。 再說把開發文檔搬到這裏來就沒必要了。想要快速跑通微信支付的可以繼續
微信支付開發 微信支付 微信商戶免充值代金券 沙箱密鑰
width tran 產生 img 安全 原理 性能 正式 固定 一、仿真測試系統 為降低商戶測試門檻,微信支付團隊開發了一套獨立的仿真測試系統。該系統根據驗收用例金額的不同返回不同的響應報文,以滿足商戶正常功能測試、安全/異常測試及性能測試的需求。 圖1 微信支付仿真
微信支付開發:10分鐘幫你開通微信支付免充值代金券和免充值立減與折扣 申請微信免充值代金券
付費 wid 不存在 返回 adb ota 粉絲 影響 OS 功能介紹: 商戶不需要預先充值營銷經費,即可創建和激活免充值代金券活動。活動生效後,用戶到店使用微信支付,當訂單符合優惠規則時,會直接扣減核銷優惠商戶的訂單實收金額。 免充值,營銷資金“0”占用不需要預充值營銷
微信支付開發:10分鐘幫你開通微信支付免充值代金券和免充值立減與折扣,申請微信免充值代金券,社交立減金
進行 功能介紹 log 聯系 alt 步驟 www tro -c ---恢復內容開始--- 功能介紹: 商戶不需要預先充值營銷經費,即可創建和激活免充值代金券活動。活動生效後,用戶到店使用微信支付,當訂單符合優惠規則時,會直接扣減核銷優惠商戶的訂單實收金額。 免充值,營銷
微信支付開發:10分鐘幫你開通微信支付微信免充值代金券和微信免充值立減與折扣,申請微信免充值代金券,社交立減金
www. 查詢 5.5 輸入 bubuko nbsp blog 等待 ota 功能介紹: 商戶不需要預先充值營銷經費,即可創建和激活免充值代金券活動。活動生效後,用戶到店使用微信支付,當訂單符合優惠規則時,會直接扣減核銷優惠商戶的訂單實收金額。 免充值,營銷資金“0”占用
微信支付開發:開通微信免充值代金券和開通微信免充值立減與折扣,申請微信免充值代金券,接口升級驗收步驟
支付 生效 upload 設置 target title 調用 box 基礎 功能介紹: 商戶不需要預先充值營銷經費,即可創建和激活免充值代金券活動。活動生效後,用戶到店使用微信支付,當訂單符合優惠規則時,會直接扣減核銷優惠商戶的訂單實收金額。 免充值,營銷資金“0”占用
公眾號微信支付開發
The 部署 func else ldr 發包 ati 處理 fig 公眾號微信支付開發 1.第一步:設置微信支付目錄,這個地址指到支付頁面的上一級即可。 例如:支付頁面的地址是http://www.baidu.com/wechat/pay/shopping,只需填寫htt
微信支付開發初體驗
這段時間由於要進行微信公眾號相關的開發,故而接觸到了微信支付。老版本的V2公眾號微信支付比較難搞,有些東西不夠規範。新版本的微信支付統一了介面,文件也比較齊全,全部接入商戶平臺(pay.weixin.qq.com)。下面簡述一下微信公眾號現金支付的開發過程。 申請微信支付
微信支付開發(7) 刷卡支付
關鍵字:微信支付 微信支付v3 刷卡支付 統一支付 prepay_id 作者:方倍工作室 本文介紹微信支付下的刷卡支付的開發過程。微信刷卡支付是指使用者開啟微信錢包的刷卡的介面,商戶掃碼後提交完成支付的支付過程。 一、刷卡支付API
微信支付開發(7) 收貨地址共享介面V2
在這篇微信公眾平臺開發教程中,我們將介紹如何在網頁中實現獲取收貨地址的功能。 收貨地址共享介面 在2016年4月13日 進行過升級,2016年5月20日之後只能使用新介面,本教程為新版介面的教程! 本文分為以下二個部分: 生成JS-SDK許可權驗證簽名 實現獲取共享收貨地址
Java微信支付開發之掃碼支付模式一
官方文件 準備工作:已通過微信認證的公眾號, 必須通過ICP備案域名(否則會報支付失敗) 借鑑了很多大神的文章,在此先謝過了 大體過程:先掃碼(還沒有確定實際要支付的金額),這個碼是商品的二維碼,再生成訂單,適用於自動販賣機之類固定金額的。 模式一支付的流程如下圖,稍微有點複雜
php微信網頁開發實現自動登入註冊功能例項
功能:自動登入註冊功能 描述:php實現微信網頁自動登入註冊功能 範圍:適用於所有php版本 thinkphp5.0例項 $token = cookie('token'); if($token){ //這裡寫登入後的邏輯 }else{ $