代码改变世界

支付宝支付成功后,假如后台还需要验证支付宝返回的数据

2016-01-08 11:14  可小猪  阅读(6560)  评论(0编辑  收藏  举报

支付宝支付成功后传的值{
memo = "";
result = "partner=\"\"&seller_id=\"\"&out_trade_no=\"A16010710154610000\"&subject=\"\U6930\U6c41\U6d41\U91cf-\U6d41\U91cf\U5145\U503c\"&total_fee=\"0.01\"&notify_url=\"http://zhaol\"&service=\"mobile.securi\"&payment_type=\"1\"&_input_charset=\"utf-8\"&it_b_pay=\"30m\"&show_url=\"m.alipay.com\"&success=\"true\"&sign_type=\"RSA\"&sign=\"L9589+qTkoM/yWz3xfH4o+CN52JG4rRfja4MmsOA7gnvBh8cbrXBQbnH1fo3dGaVFQreXQ+2CVOIZ6gM+yzrPEBtHM2EK1/BLJEnZu4K91nPFRWeEz45pWeQLmV4a7N2VaN4ReOoaLhVmiSXqPA46mA1ri5abc+JKRIhBZH0Bqk=\"";
resultStatus = 9000;
}

看到没这是返回的值,

你要用通知,记住告诉你们后台你要什么值就传过去,后台来处理,这样两个人就沟通好了,当初我们差点打起来

 

- (void)aliPaymentResult:(AlixPayResult *)resultd {

    

    if (resultd) {

                        if (resultd.statusCode == 9000 )

               {//支付成功

                   

      //  支付成功后,发送通知

        [[NSNotificationCenter defaultCenter] postNotificationName:@"chenggong" object:resultd.result];

  

//             *用公钥验证签名 严格验证请使用result.resultString与result.signString验签

//             */

//

            UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"付款成功" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];

            /**

             在这里可以跳转到相应的界面

            */

            [alertView show];

            

        }

        

        if (resultd.statusCode == 6001) {//用户中途取消

            

            UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您中途取消了订单" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];

            /**

             在这里可以跳转到相应的界面

             */

            [alertView show];

            

        }

        if (resultd.statusCode == 6002) {//网络连接出错

            UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"网络连接出错" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];

            /**

             在这里可以跳转到相应的界面

             */

            [alertView show];

        }

        

        if (resultd.statusCode == 4000) {//订单支付失败

            UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"您的订单支付失败" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];

            /**

             在这里可以跳转到相应的界面

             */

            [alertView show];

        }

 

        

    } else {

        

    }

}

 

- (void)paymentResult:(NSDictionary *)resultDict {

    

    AlixPayResult *result = [[AlixPayResult alloc] initWithDict:resultDict];

    NSLog(@"支付宝支付成功后传的值%@",resultDict);

    

    [[AliPayObject shareInstance] aliPaymentResult:result];

}

 

@end