iOS跳转支付宝 微信支付成功后一直不会返回

版权声明:本文为博主原创文章,转载请标明出处。 https://blog.csdn.net/chuan403082010/article/details/54377261

哎, 是后来改过一次Bundle id,URL Schemes 没改,  支付宝的话appScheme也要和 URL Schemes改一直

 



/*

 * 支付宝支付

 */

- (void)alipayOrderWithOrderNum:(NSString *)orderNum

                    productName:(NSString *)productName

             productDescription:(NSString *)productDescription

                         amount:(double)amount

{

    Order *order = [[Order alloc] init];

    order.partner = KAliPartner;

    order.seller = KAliSeller;

    order.tradeNO = orderNum; //订单号

    order.productName = productName; //商品标题

    order.productDescription = productDescription; //商品描述

    order.amount = [NSString stringWithFormat:@"%.2f", amount]; //支付总价

    order.notifyURLKAliNotifyURL; //回调URL

    

    order.service = @"mobile.securitypay.pay";

    order.paymentType = @"1";

    order.inputCharset = @"utf-8";

    order.itBPay = @"30m";

    order.showUrl = @"m.alipay.com";

    

    //应用注册scheme,AlixPayDemo-Info.plist定义URL types

    NSString *appScheme = @"BunldId";

    

    //将商品信息拼接成字符串

    NSString *orderSpec = [order description];

    

    //获取私钥并将商户信息签名,外部商户可以根据情况存放私钥和签名,只需要遵循RSA签名规范,并将签名字符串base64编码和UrlEncode

    id<DataSigner> signer = CreateRSADataSigner(KAliPrivateKey);

    NSString *signedString = [signer signString:orderSpec];

    //将签名成功字符串格式化为订单字符串,请严格按照该格式

    NSString *orderString = nil;

    if (signedString != nil)

    {

        orderString = [NSString stringWithFormat:@"%@&sign=\"%@\"&sign_type=\"%@\"",

                       orderSpec, signedString, @"RSA"];

        [[AlipaySDK defaultService] payOrder:orderString fromScheme:appScheme callback:^(NSDictionary *resultDic) {

            [MBProgressHUD hideMessage];

            NSLog(@"reslut = %@",resultDic);

        }];

    }

}



展开阅读全文

没有更多推荐了,返回首页