httpheaders headers = new httpheaders();
headers.add("host", "wx.tenpay.com");
headers.add("accept-language", "en, zh-cn; q=0.8,zh; q=0.6,en-us; q=0.4");
headers.add("upgrade-insecure-requests", "1");
headers.add("referer", "");
httpentityhttpentity = new httpentity<>(headers);
try// 通過正規表示式提取需要的字串
string pattern= "\"weixin(.*?)\"";
pattern p = pattern.compile(pattern);
matcher matcher = p.matcher(body);
if(matcher.find())
}catch (exception e)
return url;
需要注意的是使用這種方式就不要再將會回跳地址傳入了,同時需要自己做個是否支付成功的判斷。
# 安卓的(實際測試中,蘋果手機使用這個也可以拉起支付寶)
# 蘋果的
alipay://alipayclient/?o.ios
其中o.ios和o.android的內容是使用url encoder編碼了的;其中蘋果的內容是如下的json串:
安卓的只有一個datastring的值。通過欄位的值對比h5_route_token
其值就是html中的session的值;在返回的html**中有如下**:
這個就是上面需要的內容,同樣通過正規表示式將內容提取出來。
httpget httpget = new httpget(h5url);
httpget.setconfig(requestconfig.custom()
.setconnecttimeout(httpconstants.connect_timeout)
.setconnectionrequesttimeout(httpconstants.connection_request_timeout)
.setsockettimeout(httpconstants.socket_timeout).build());
closeablehttpclient httpclient = httpclientbuilder.create().build();
try (closeablehttpresponse response = httpclient.execute(httpget))
}else }}
system.out.println("請求返回內容:"+ body);
}else
} catch (ioexception e) finally catch (ioexception e)
}return null;
APP接入支付寶微信支付流程
登入企業賬號,進行企業資訊認證 開發中心 網頁 移動應用 支付接入,建立新的移動應用 加簽驗籤 為了支付過程的安全,支付寶開放平臺sdk封裝了簽名和驗簽過程,應用私鑰需填寫到 中供簽名時使用,應用公鑰需提供給支付寶賬號管理者上傳到支付寶開放平臺,對應換取支付寶公鑰下來。詳細參考支付寶開發文件...
App 中的 微信支付 支付寶支付
is weixn else handelpay this http.insidewechatpay data then res else elseif this wechatpaytype wxpay php this http.outsidewechatpay data then res else...
App 中的 微信支付 支付寶支付
is weixn else handelpay this http.insidewechatpay data then res else elseif this wechatpaytype wxpay php this http.outsidewechatpay data then res else...