Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter IOS 从支付宝跳转回app 收不到回调 #128

Open
Time-lass opened this issue Jul 8, 2022 · 3 comments
Open

Flutter IOS 从支付宝跳转回app 收不到回调 #128

Time-lass opened this issue Jul 8, 2022 · 3 comments

Comments

@Time-lass
Copy link

支付成功之后,在安卓平台正常。
在iOS平台,支付宝可以跳回app,但app收不到支付宝的成功失败回调。
试了改了url scheme,还是不起作用。
URL Scheme设置:

CFBundleTypeRole
Editor
CFBundleURLName
alipay
CFBundleURLSchemes

alipaytobias


支付代码:
// 支付宝支付
var rst = await createOrderAliPay({
"orderNum": orderid,
});
tobias.aliPay(rst).then((val) {
这么什么都没有返回,好像就没有进到这个里面。
print(val['resultStatus']);
EasyLoading.dismiss();
if (val['resultStatus'] == '6001') {
EasyLoading.showToast("取消支付");
// Get.back();
}
if (val['resultStatus'] == '9000') {
_productInfoController.onDeleteCart();
EasyLoading.showSuccess('支付成功');
Get.toNamed("/paySuccessPage");
}
});
这个是什么问题,着急已经好长时间了,URL Scheme的设置也改了好几次了依旧不知道是什么问题
有哪位知道的吗?

@zhengmin4516
Copy link

你好,你Flutter版本还有tobias版本是多少啊,我ios支付都走不通,点击支付直接闪退, T.T

@wl386123298
Copy link

info.plist中有加这个么,而且URL Scheme不能有下划线

@Handyzzz
Copy link

tobias.aliPay(rst).then((val) {
此处仅仅在支付宝网页版本wap支付时会受到回调(是网页支付,而非跳转支付宝APP支付)
});
如果是从支付宝APP支付,想要获取支付回调需要从AppDelegate.m获取,再传给flutter模块。

  • (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
    if ([url.host isEqualToString:@"safepay"]) {
    此处仅仅是是支付宝APP版本支付回调
    //同步“支付结果给flutter
    NSString *channelName = @"fnyx.flutter.cn/noti";
    FlutterMethodChannel *channel = [FlutterMethodChannel methodChannelWithName:channelName binaryMessenger:[FlutterManager sharedInstance].flutterVC.binaryMessenger];
    [channel invokeMethod:@"alipay" arguments:resultDic];
    }];
    }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants