支付寶客戶端回調會在AppDelegate裏面:app
- (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; }
網頁支付寶回調在調起支付寶支付時:url
[[AlipaySDK defaultService] payOrder:orderString fromScheme:@"應用程序shemes" callback:^(NSDictionary *resultDic) { //沒有安裝支付寶,網頁支付寶回調 [self handleAlipayWith:resultDic]; }];