#pragma mark - 使用微信支付订阅(提问)
- (void)makePayWeChatPayRequest:(NSDictionary *)productInfo baseHttpBoolBlock:(BaseHttpBoolBlock)baseHttpBoolBlock{
NSString *money = productInfo[@"money"];
//创建支付签名对象
payRequsestHandler *req = [[payRequsestHandler alloc]init];
//初始化支付签名对象
[req init:APP_ID mch_id:MCH_ID];
//设置密钥
[req setKey:PARTNER_ID];
//获取到实际调起微信支付的参数后,在app端调起支付
NSMutableDictionary *dict = [req sendPay_demoWithMoney:money isCharge:NO];
// 传回的订单号
NSString *orderStr = [req getOrderStr];
ZJLog(@"tradeOrderStr==============%@",orderStr);
NSMutableDictionary *orderDict = [[NSMutableDictionary alloc] initWithDictionary:productInfo];
NSDictionary *tempDic = [NSDictionary dictionaryWithObjectsAndKeys:orderStr,@"tradeNO", nil];
[orderDict addEntriesFromDictionary:tempDic];
ZJLog(@"支付宝订阅支付参数 = %@",orderDict);
NSDictionary *parmasDic = (NSDictionary *)orderDict;
if(dict == nil){
//错误提示
[SVProgressHUDManager showErrorWithStatus:@"系统繁忙,稍后再试"];
if(baseHttpBoolBlock) baseHttpBoolBlock(NO,nil,1,@"系统繁忙,稍后再试");
}else{
ZJLog(@"==%@\n\n",[req getDebugifo]);
// NSString *wxOpenId = [dict objectForKey:@"appid"];
NSMutableString *stamp = [dict objectForKey:@"timestamp"];
//调起微信支付
PayReq* req = [[PayReq alloc] init];
req.openID = [dict objectForKey:@"appid"];
req.partnerId = [dict objectForKey:@"partnerid"];
req.prepayId = [dict objectForKey:@"prepayid"];
req.nonceStr = [dict objectForKey:@"noncestr"];
req.timeStamp = stamp.intValue;
req.package = [dict objectForKey:@"package"];
req.sign = [dict objectForKey:@"sign"];
[self beforePayRemarkWithType:PayType_WeChat orderDict:parmasDic baseHttpBoolBlock:^(BOOL isSuccess, NSMutableArray *resultArr, NSInteger flagVaule, NSString *infoMessage) {
if (isSuccess)
{
NSMutableDictionary *paysDic = orderDict;
[paysDic setObject:[resultArr firstObject] forKey:@"PayID"];
[paysDic setObject:[resultArr lastObject] forKey:@"questionid"];
NSMutableArray *resArr = [NSMutableArray arrayWithObjects:paysDic, nil];
if(baseHttpBoolBlock) baseHttpBoolBlock(YES,resArr,10000,@"");
[WXApi sendReq:req];
}else
{
if(baseHttpBoolBlock) baseHttpBoolBlock(NO,nil,flagVaule,infoMessage);
}
}];
}
}
wechat pay
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 最近小米又放新消息,一言不合就要搞发布。 看到这条消息,想必入了小米5的米粉们可以放心了:买了这么久,NFC功能终...
- 朋友圈作为社交分享的主阵地,应该是大家平时分享内容的首选。我自己平时就经常从 Safari 分享一些非常实用的网页...
- Mozilla/5.0 (Linux; Android 4.4.4; HM NOTE 1LTEW Build/KT...
- 入手这本书,是因为2016年柯布西耶和他分布在7个国家的17个作品被联合国教科文组织入选了世界遗产名录; 而世界遗...