(精品)微信支付android端

丈夫欲遂平生志,一载寒窗一举汤。这篇文章主要讲述(精品)微信支付android端相关的知识,希望能为你提供帮助。
PayingActivity.java

public void WxPay(){ //new Thread(new Runnable() { //@Override //public void run() { // //// Button appayBtn = (Button) findViewById(R.id.appay_btn); ////appayBtn.setOnClickListener(new View.OnClickListener() { ////@Override //// public void onClick(View v) { ////final Button payBtn = (Button) findViewById(R.id.appay_btn); ////payBtn.setEnabled(false); // //} //}).start(); Toast.makeText(PayingActivity.this, "获取订单中...", Toast.LENGTH_SHORT).show(); HttpUtils httpUtils = new HttpUtils(); httpUtils.send(HttpRequest.HttpMethod.GET, "http://wxpay.weixin.qq.com/pub_v2/app/app_pay.php?plat=android", new RequestCallBack< String> () { @Override public void onSuccess(ResponseInfo< String> responseInfo) { String content = responseInfo.result; Log.e("get server pay params:", content); try { JSONObject json = new JSONObject(content); if (null != json & & !json.has("retcode")) { PayReq req = new PayReq(); //req.appId = "wxf8b4f85f3a794e77"; // 测试用appId req.appId = json.getString("appid"); req.partnerId = json.getString("partnerid"); req.prepayId = json.getString("prepayid"); req.nonceStr = json.getString("noncestr"); req.timeStamp = json.getString("timestamp"); req.packageValue = https://www.songbingjia.com/android/json.getString("package"); req.sign = json.getString("sign"); req.extData = "https://www.songbingjia.com/android/app data"; // optional Toast.makeText(PayingActivity.this, "正常调起支付", Toast.LENGTH_SHORT).show(); // 在支付之前,如果应用没有注册到微信,应该先调用IWXMsg.registerApp将应用注册到微信 //api.registerApp("wx3c08ef3862b18c98"); api.sendReq(req); } else { Log.d("PAY_GET", "返回错误" + json.getString("retmsg")); Toast.makeText(PayingActivity.this, "返回错误" + json.getString("retmsg"), Toast.LENGTH_SHORT).show(); } } catch (Exception e) { e.printStackTrace(); } //payBtn.setEnabled(true); }@Override public void onFailure(HttpException e, String s) { Log.d("PAY_GET", "服务器请求错误"); e.printStackTrace(); Toast.makeText(PayingActivity.this, "服务器请求错误", Toast.LENGTH_SHORT).show(); //payBtn.setEnabled(true); } }); //} //}); }

【(精品)微信支付android端】 

    推荐阅读