美文网首页
iOS --- 支付宝支付成功返回字符串的处理操作

iOS --- 支付宝支付成功返回字符串的处理操作

作者: 鑫飞 | 来源:发表于2017-12-07 10:36 被阅读21次
支付宝返回数据
reslut = {    memo = "";    result = "partner=\"xxxxxxxxx\"&seller_id=\"[xxxxxxxxxx@qq.com](mailto:xxxxxxxxxx@qq.com)\"&out_trade_no=\"xxxxxxxxxx\"&subject=\"1\U5143\"&body=\"\U5145\U503c1\U5143\"&total_fee=\"0.01\"&notify_url=\"http://www.xxx.com\"&service=\"mobile.securitypay.pay\"&payment_type=\"1\"&_input_charset=\"utf-8\"&it_b_pay=\"30m\"&show_url=\"m.alipay.com\"&success=\"true\"&sign_type=\"RSA\"&sign=\"xxxxxxxxxxxxxxxxxxx\"";    resultStatus = 9000;}
只判断  resultStatus = 9000
 [[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) {
      NSInteger orderState=[resultDic[@"resultStatus"]integerValue];
      if (orderState==9000) {
        NSString *allString=resultDic[@"result"];
        NSString * FirstSeparateString=@"\"&";
        NSString * SecondSeparateString=@"=\"";
        NSMutableDictionary *dic=[CommonToolsVEComponentsStringToDic:allString withSeparateString:FirstSeparateString AndSeparateString:SecondSeparateString];
        NSLog(@"ali=%@",dic);
        if ([dic[@"success"]isEqualToString:@"true"]) {
           [[NSNotificationCenter defaultCenter] postNotificationName:@"AliPaySucceed" object:nil userInfo:dic];
        }
      }else{
        NSString *returnStr;
        switch (orderState) {
          case 8000:
            returnStr=@"订单正在处理中";
            break;
          case 4000:
            returnStr=@"订单支付失败";
            break;
          case 6001:
            returnStr=@"订单取消";
            break;
          case 6002:
            returnStr=@"网络连接出错";
            break;
          default:
            break;
        }
        [HUDTooles showTextHUD:returnStr];
        [HUDTooles removeHUD:4];
      }
    }];

相关文章

网友评论

      本文标题:iOS --- 支付宝支付成功返回字符串的处理操作

      本文链接:https://www.haomeiwen.com/subject/xwnmrxtx.html