支付宝客户端回调会在AppDelegate里面:
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options{ //支付宝支付 if ([url.host isEqualToString:@"safepay"]) { [[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) { //利用代理监听支付宝回调, if (_alipayDelegate && [_alipayDelegate respondsToSelector:@selector(getAlipayPayResult:)]) { [_alipayDelegate getAlipayPayResult:resultDic]; } //充值回调 if (_alipayRechargeDelegate && [_alipayRechargeDelegate respondsToSelector:@selector(getAlipayRechargeResult:)]){ [_alipayRechargeDelegate getAlipayRechargeResult:resultDic]; } }]; return YES; }
网页支付宝回调在调起支付宝支付时:
[[AlipaySDK defaultService] payOrder:orderString fromScheme:@"应用程序shemes" callback:^(NSDictionary *resultDic) { //没有安装支付宝,网页支付宝回调 [self handleAlipayWith:resultDic]; }];