Coder Social home page Coder Social logo

Comments (20)

0x5e avatar 0x5e commented on May 14, 2024

0.2.3只是更新了支付宝iOS SDK,你测试使用的是正确的支付参数吗?我这边没有条件,用错误的支付参数测试,确实存在这问题

from react-native-alipay.

fuxianwei avatar fuxianwei commented on May 14, 2024

参数是可以的,我0.2.2上使用一切是正常的,你试试用0.2.3在IOS下跳转支付然后取消看看能否收到正确的取消提示,目前我这边(0.2.3)是收不到用户正确取消的信息,但是0.2.2版本一切正常

from react-native-alipay.

fuxianwei avatar fuxianwei commented on May 14, 2024

目前是IOS下面取消支付不能正确提示‘支付取消,请返回重新支付!’
这里是支付代码:
`
async pay() {
try {
let {cartInfo, orderType, resParams} = this.props.navigation.state.params
let res = null, payResult = null

        this.setState({
            requesting: true
        })

        if(this.state.payType == 0) {
            res = await api.aliPay(resParams)
        } else if(this.state.payType == 1) {
            res = await api.weixinPay(resParams)
        }

        this.setState({
            requesting: false
        })

        if (res && res.data.status == 1) {
            if (orderType == 2) {
                this.props.dispatch(ShopActions.cartRemoveShop(id))
            }

            if(this.state.payType == 0) {
                payResult = await Alipay.pay(res.data.data)

                if(payResult.resultStatus == 9000) {
                    this.props.navigation.dispatch({
                        type: 'ReplaceCurrentScreen',
                        routeName: "PayResult",
                        params: {res: 'ok', msg: `${cartInfo.totalPrice} 元`}
                    })
                } else if(payResult.resultStatus == 6001) {
                    this.props.navigation.navigate('PayResult', {res: 'fail', msg: '支付取消,请返回重新支付!'})
                } else {
                    this.props.navigation.navigate('PayResult', {res: 'fail', msg: '支付失败,请返回重新支付!'})
                }
            } else if(this.state.payType == 1) {
                let payParam = {
                    partnerId: res.data.data.partnerid,  // 商家向财付通申请的商家id
                    prepayId: res.data.data.prepayid,   // 预支付订单
                    nonceStr: res.data.data.noncestr,   // 随机串,防重发
                    timeStamp: res.data.data.timestamp.toString(),  // 时间戳,防重发
                    package: res.data.data.package,    // 商家根据财付通文档填写的数据和签名
                    sign: res.data.data.sign        // 商家根据微信开放平台文档对数据做的签名
                }

                payResult = await WeChat.pay(payParam)

                if(payResult.type == 'PayReq.Resp') {
                    if(payResult.errCode == 0) {
                        this.props.navigation.dispatch({
                            type: 'ReplaceCurrentScreen',
                            routeName: "PayResult",
                            params: {res: 'ok', msg: `${cartInfo.totalPrice} 元`}
                        })
                    }
                }
            }
        } else {
            Alert.alert(
                '提示',
                res.data.err_msg || '订单提交失败!',
                [
                    {
                        text: '确定', onPress: () => {
                    }, style: 'cancel'
                    }
                ],
                {cancelable: false}
            )
        }
    } catch (e) {
        this.setState({
            requesting: false
        })
        if(e.name == 'WechatError') {
            if(e.code == -1) {
                this.props.navigation.navigate('PayResult', {res: 'fail', msg: '支付失败,请返回重新支付!'})
            } else if(e.code == -2) {
                this.props.navigation.navigate('PayResult', {res: 'fail', msg: '支付取消,请返回重新支付!'})
            }
        }
    }
}

`

from react-native-alipay.

woshizhoujie avatar woshizhoujie commented on May 14, 2024

退回了0.2.2版本。。。

from react-native-alipay.

fuxianwei avatar fuxianwei commented on May 14, 2024

目前只能回退版本了,等作者更新

from react-native-alipay.

0x5e avatar 0x5e commented on May 14, 2024

我用支付宝demo试下来的情况是 Alipay iOS SDK v15.5.0 的[AlipaySDK.defaultService payOrder:fromScheme:callback:]回调没有执行,而v15.4.1是正常的。。。先回退吧,我再确认下如果确实是这问题的话,等官方修复了😅

from react-native-alipay.

fuxianwei avatar fuxianwei commented on May 14, 2024

🙃哈哈只能这样了

from react-native-alipay.

woshizhoujie avatar woshizhoujie commented on May 14, 2024

image
求助

from react-native-alipay.

0x5e avatar 0x5e commented on May 14, 2024

@woshizhoujie 还有别的编译错误一起出现吗?试试删除node_modules/react-native/third-party目录重新编译一下,看下这个:facebook/react-native#14382

from react-native-alipay.

django-wong avatar django-wong commented on May 14, 2024

+1

from react-native-alipay.

dioxide avatar dioxide commented on May 14, 2024

sdk 升到15.5.3 实测支付回调还是不执行@0x5e

追加:
在 RCTAlipay.m 的 handleOpenURL 方法始终是执行的, 可以在这里调用resolve(),

from react-native-alipay.

0x5e avatar 0x5e commented on May 14, 2024

已经在develop分支更新了sdk并作了兼容,我电脑近期没有测试环境,几位方便的话帮忙测试一下 @dioxide @django-wong @fuxianwei ,谢谢了

from react-native-alipay.

evianzhow avatar evianzhow commented on May 14, 2024

@0x5e Tested on Android and iOS latest Alipay App (10.1.22), and works fine. But you have to fix this issue first #9

from react-native-alipay.

evianzhow avatar evianzhow commented on May 14, 2024

@0x5e Now that #9 is closed, I think it's time to release the new version.

from react-native-alipay.

0x5e avatar 0x5e commented on May 14, 2024

@evianzhow Sure, thanks😄

from react-native-alipay.

Micjoyce avatar Micjoyce commented on May 14, 2024

在最新版的 0.2.4 上,ios网页跳转支付完成之后,还是不会触发回调。

from react-native-alipay.

django-wong avatar django-wong commented on May 14, 2024

试了一下0.2.4的Alipay.pay()返回的Promise不会被Resolve, 我又downgrade到0.2.2了

[email protected]
[email protected]

from react-native-alipay.

Icacls avatar Icacls commented on May 14, 2024

试了0.2.4和0.2.2 都不能正确触发回调 代码如下:

async alipayLogin() {
// 快捷登录授权
try {
let response = await Alipay.authWithInfo(this.state.infoStr);
console.info('alipayLogin------>', response);
let { resultStatus, result, memo } = response;
// let { success, result_code, auth_code, user_id } = QueryString.parse(result);

} catch (error) {
  console.error(error);
}
}

另外native端iOS openURL也没有触发。有人有遇到类似问题么

from react-native-alipay.

0x5e avatar 0x5e commented on May 14, 2024

@Icacls 请试一下develop分支看看(0.2.5)

from react-native-alipay.

Icacls avatar Icacls commented on May 14, 2024

develop分支(0.2.5)测试OK 👌多谢了!

from react-native-alipay.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.