本文整理汇总了Java中com.tencent.mm.sdk.modelpay.PayReq类的典型用法代码示例。如果您正苦于以下问题:Java PayReq类的具体用法?Java PayReq怎么用?Java PayReq使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PayReq类属于com.tencent.mm.sdk.modelpay包,在下文中一共展示了PayReq类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: a
import com.tencent.mm.sdk.modelpay.PayReq; //导入依赖的package包/类
public void a(JSONObject jSONObject) {
String string = jSONObject.getString("appId");
this.c.registerApp(string);
this.c.handleIntent(this.a.getIntent(), this);
BaseReq payReq = new PayReq();
payReq.appId = string;
payReq.partnerId = jSONObject.getString("partnerId");
payReq.prepayId = jSONObject.getString("prepayId");
payReq.nonceStr = jSONObject.getString("nonceStr");
if (jSONObject.get("timeStamp") instanceof String) {
payReq.timeStamp = jSONObject.getString("timeStamp");
} else {
payReq.timeStamp = jSONObject.getInt("timeStamp") + "";
}
payReq.packageValue = jSONObject.getString("packageValue");
payReq.sign = jSONObject.getString("sign");
this.c.sendReq(payReq);
}
示例2: weChatPay
import com.tencent.mm.sdk.modelpay.PayReq; //导入依赖的package包/类
private void weChatPay(MPayWeChatModel mPayWeChatModel) {
try {
PayReq req = new PayReq();
req.appId = mPayWeChatModel.getAppId();
req.partnerId = mPayWeChatModel.getPartnerId();
req.prepayId = mPayWeChatModel.getPrepayId();
req.nonceStr = mPayWeChatModel.getNonceStr();
req.timeStamp = mPayWeChatModel.getTimeStamp();
req.packageValue = mPayWeChatModel.getPackageValue();
req.sign = mPayWeChatModel.getSign();
req.extData = mPayWeChatModel.getExtData(); // optional
getIwxapiInstance().registerApp(mPayWeChatModel.getAppId());// 在支付之前,如果应用没有注册到微信,应该先调用IWXMsg.registerApp将应用注册到微信
getIwxapiInstance().sendReq(req);
} catch (Exception e) {
Log.e(TAG, "error:" + e.getMessage());
MWeChatListenerUtil.instance().notifyPayFailure("支付失败");
}
}
示例3: wxPayJs
import com.tencent.mm.sdk.modelpay.PayReq; //导入依赖的package包/类
/**
* JS调用微信支付接口
*
* @param orderInfo
*/
private void wxPayJs(String orderInfo) {
try {
WxPayInfo info = GsonUtil.fromJson(orderInfo, WxPayInfo.class);
mWxPrePayId = info.getPrepayid();
PayReq req = new PayReq();
req.appId = info.getAppid();
req.partnerId = info.getPartnerid();
req.prepayId = info.getPrepayid();
req.nonceStr = info.getNoncestr();
req.timeStamp = info.getTimestamp();
req.packageValue = "Sign=WXPay";
req.sign = info.getSign();
WChatManager.getInstance().WXAPI.sendReq(req);
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: sendPayRequestByWechat
import com.tencent.mm.sdk.modelpay.PayReq; //导入依赖的package包/类
private void sendPayRequestByWechat(PayInfo payInfo) {
if(payInfo == null) {
return;
}
IWXAPI api = WXAPIFactory.createWXAPI(mContext, payInfo.getAppId());
PayReq payReq = new PayReq();
payReq.appId = payInfo.getAppId();
payReq.partnerId = payInfo.getPartnerId();
payReq.prepayId = payInfo.getPrepayId();
payReq.nonceStr = payInfo.getNonceStr();
payReq.timeStamp = payInfo.getTimeStamp();
payReq.packageValue = payInfo.getPackageValue();
payReq.sign = payInfo.getSign();
api.sendReq(payReq);
}
示例5: genPayReq
import com.tencent.mm.sdk.modelpay.PayReq; //导入依赖的package包/类
private PayReq genPayReq(String prepayId) {
PayReq payReq = new PayReq();
payReq.appId = mInit.getPartner();
payReq.partnerId = mInit.getSeller();
payReq.prepayId = prepayId;
payReq.packageValue = "prepay_id="+prepayId;
payReq.nonceStr = WeChatProduct.getNonce();
payReq.timeStamp = String.valueOf(WeChatProduct.genTimeStamp());
List<NameValuePair> signParams = XmlUtils.getRequestParams(payReq);
payReq.sign = XmlUtils.getAppSign(mInit, signParams);
Log.e("orion", payReq.sign);
Log.e("orion", signParams.toString());
return payReq;
}
示例6: sendToWeixinPay
import com.tencent.mm.sdk.modelpay.PayReq; //导入依赖的package包/类
private void sendToWeixinPay(String prepay_id) {
String randomStr = UUID.randomUUID().toString();
if (randomStr.length() > 32) {
randomStr = randomStr.substring(0, 32);
}
PayReq req = new PayReq();
req.appId = SdkFactory.PayConfig.sWeixin_app_Id;
req.partnerId = SdkFactory.PayConfig.sWeixin_merchant_id;
req.prepayId = prepay_id;
req.packageValue = "Sign=WXPay";
req.nonceStr = randomStr;
req.timeStamp = String.valueOf(System.currentTimeMillis() / 1000);//秒
List<NameValuePair> params = new ArrayList<>();
params.add(new NameValuePair("appid", req.appId));
params.add(new NameValuePair("noncestr", req.nonceStr));
params.add(new NameValuePair("package", req.packageValue));
params.add(new NameValuePair("partnerid", req.partnerId));
params.add(new NameValuePair("prepayid", req.prepayId));
params.add(new NameValuePair("timestamp", req.timeStamp));
req.sign = WeixinUtil.sign(params, false);
logIfNeed("PayReq_sign = " + req.sign);
mWxApi.sendReq(req);
}
示例7: BuildCallAppParams
import com.tencent.mm.sdk.modelpay.PayReq; //导入依赖的package包/类
private PayReq BuildCallAppParams(String prepayId) {
PayReq req=new PayReq();
req.appId = KeyLibs.weixin_appId;
req.partnerId = KeyLibs.weixin_mchId;
req.prepayId = prepayId;
req.packageValue = "Sign=WXPay";
req.nonceStr = GetNonceStr();
req.timeStamp = String.valueOf(GetTimeStamp());
List<NameValuePair> signParams = new LinkedList<NameValuePair>();
signParams.add(new BasicNameValuePair("appid", req.appId));
signParams.add(new BasicNameValuePair("noncestr", req.nonceStr));
signParams.add(new BasicNameValuePair("package", req.packageValue));
signParams.add(new BasicNameValuePair("partnerid", req.partnerId));
signParams.add(new BasicNameValuePair("prepayid", req.prepayId));
signParams.add(new BasicNameValuePair("timestamp", req.timeStamp));
req.sign = Sign(signParams);
return req;
}
示例8: onCreate
import com.tencent.mm.sdk.modelpay.PayReq; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
submitButton=(Button) findViewById(R.id.bt_submit_order);
confirmButton=(Button) findViewById(R.id.bt_corfirm);
textView=(TextView) findViewById(R.id.tv_prepay_id);
submitButton.setOnClickListener(this);
confirmButton.setOnClickListener(this);
sb=new StringBuffer();
req=new PayReq();
}
示例9: sendPayReq
import com.tencent.mm.sdk.modelpay.PayReq; //导入依赖的package包/类
private void sendPayReq(String result) {
WXModel model = WXModel.jsonData(result);
PayReq request = new PayReq();
request.appId = model.getAppId();
request.partnerId = model.getPartnerId();
request.prepayId = model.getPrepayId();
request.packageValue = model.getPackageValue();
request.nonceStr = model.getNonceStr();
request.timeStamp = model.getTimeStamp();
request.sign = model.getSign();
this.api.registerApp(model.getAppId());
LOG.logI("[T]" + model.toString());
Log.e("Ta", "sendReq: " + this.api.sendReq(request));
}
示例10: doPay
import com.tencent.mm.sdk.modelpay.PayReq; //导入依赖的package包/类
public void doPay(PayReq req,WXPayResultCallBack callBack){
this.callBack = callBack;
if(!check()){
if(callBack != null) {
callBack.onError(ERROR_NOT_SUPPORT, App.getInstance().getString(R.string.pay_not_support_wx));
}
return;
}
mWXApi.sendReq(req);
}
示例11: pay
import com.tencent.mm.sdk.modelpay.PayReq; //导入依赖的package包/类
public void pay(PayResult result) {
PayReq request = new PayReq();
request.appId = "wxa8213dc827399101";
request.partnerId = result.getPartnerid();
request.prepayId = result.getPrepayid();
request.packageValue = "Sign=WXPay";
request.nonceStr = result.getNoncestr();
request.timeStamp = result.getTimestamp();
request.sign = result.getSign();
msgApi.sendReq(request);
}
示例12: pay
import com.tencent.mm.sdk.modelpay.PayReq; //导入依赖的package包/类
@Override
public void pay(Activity activity, WXPayInfoImpli payInfo, IPayCallback payCallback) {
this.payInfoImpli = payInfo;
sPayCallback = payCallback;
if(!check()) {
if(payCallback != null) {
payCallback.failed();
}
return;
}
if(payInfoImpli == null || TextUtils.isEmpty(payInfoImpli.getAppid()) || TextUtils.isEmpty(payInfoImpli.getPartnerid())
|| TextUtils.isEmpty(payInfoImpli.getPrepayId()) || TextUtils.isEmpty(payInfoImpli.getPackageValue()) ||
TextUtils.isEmpty(payInfoImpli.getNonceStr()) || TextUtils.isEmpty(payInfoImpli.getTimestamp()) ||
TextUtils.isEmpty(payInfoImpli.getSign())) {
if(payCallback != null) {
payCallback.failed();
}
return;
}
PayReq req = new PayReq();
req.appId = payInfoImpli.getAppid();
req.partnerId = payInfoImpli.getPartnerid();
req.prepayId = payInfoImpli.getPrepayId();
req.packageValue = payInfoImpli.getPackageValue();
req.nonceStr = payInfoImpli.getNonceStr();
req.timeStamp = payInfoImpli.getTimestamp();
req.sign = payInfoImpli.getSign();
mWXApi.sendReq(req);
}
示例13: wxPay
import com.tencent.mm.sdk.modelpay.PayReq; //导入依赖的package包/类
/**
* 微信支付
*/
public void wxPay() {
PayReq req = new PayReq();
req.appId = mWxPayInfo.getAppid();
req.partnerId = mWxPayInfo.getPartnerid();
req.prepayId = mWxPayInfo.getPrepayid();
req.nonceStr = mWxPayInfo.getNoncestr();
req.timeStamp = mWxPayInfo.getTimestamp();
req.packageValue = "Sign=WXPay";
req.sign = mWxPayInfo.getSign();
WChatManager.getInstance().WXAPI.sendReq(req);
}
示例14: wxPay
import com.tencent.mm.sdk.modelpay.PayReq; //导入依赖的package包/类
public void wxPay() {
PayReq req = new PayReq();
req.appId = mWxPayInfo.getAppid();
req.partnerId = mWxPayInfo.getPartnerid();
req.prepayId = mWxPayInfo.getPrepayid();
req.nonceStr = mWxPayInfo.getNoncestr();
req.timeStamp = mWxPayInfo.getTimestamp();
req.packageValue = "Sign=WXPay";
req.sign = mWxPayInfo.getSign();
WChatManager.getInstance().WXAPI.sendReq(req);
}
示例15: WeChatPayDirector
import com.tencent.mm.sdk.modelpay.PayReq; //导入依赖的package包/类
public WeChatPayDirector(Activity activity) {
this.activity = activity;
msgApi = WXAPIFactory.createWXAPI(activity, null);
req = new PayReq();
sb = new StringBuffer();
msgApi.registerApp(WeChatConfig.APP_ID);
}