uniapp之APP的支付宝支付

1.在uniapp的manifest.json文件中勾选

 

2.支付宝支付代码

    uni.request({
        method: "POST",
        url: this.httpUrl + '5fe',
        header: {
            'content-type': "application/x-www-form-urlencoded"
        },
        data: {
            user_id:this.user_id,
            goods_id:this.goods_id,
            pay_way:this.selectIndex,
            discounts_id:this.yh_id
        },
        success: (res) => {
            // 调起支付宝
            var data = res.data;
            uni.requestPayment({
                provider: 'alipay', //服务提供商(支付宝)(服务提供商,通过uni.getProvider获取)
                orderInfo: data,
                success(res) {
                    uni.showToast({
                        title: '支付成功',
                        icon: 'none'
                    })
                    setTimeout(function(){
                        uni.redirectTo({
                            url:'/pages/pay/peisong'
                        })
                    },1000)
                },
                fail(err) {
                    this.flag_submit=true
                    uni.showToast({
                        title: '支付失败',
                        icon: 'none'
                    })
                }
            });
        }
    });


 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐