uniapp苹果内购获取不到苹果的iap支付通道

  uni官网的苹果支付代码,整体复制过来,打印支付通道却只有微信和支付宝支付。

      plusReady() {
                plus.payment.getChannels(function(channels) {
                    console.log('ios:', channels)
                    for (var i in channels) {
                        if (channels[i].id == 'appleiap') {  
                            iapChannel = channels[i];  
                            iapChannel.requestOrder(IAPOrders, function(event) {  
                                for (var index in event) {  
                                    var OrderItem = event[index];  
                                    console.log("Title:" + OrderItem.title + "Price:" + OrderItem.price + "Description:" + OrderItem.description + "ProductID:" + OrderItem.productid);  
                                }
                            }, function(errormsg) {  
                                console.log("获取支付通道失败:" + errormsg.message)
                            })
                        }
                    }
                }, function(e) {  
                    console.log("获取支付通道失败:" + e.message)
                })
            }

  根据描述,我们需求打自定义基座包。打了之后发现还是获取不到,这里自定义基座包采用的是发布证书和发布profile,这里是一个问题,测试的基座包需要使用开发证书和开发profile才行。

  所以通过AU软件申请开发证书和开发profile。这里跟发布证书和发布profile有个区别的地方就是需要“添加设备”

  选择添加测试设备,如果你电脑连接了iphone手机,那么UDID和name会自动填入:UDID就是IOS设备的唯一id、name就是设备型号

  选择ok,然后下载描述文件。再到HbuilderX里打自定义基座包即可。之后运行自定义基座包,就可以打印出apple pay支付通道了。

原文地址:https://www.cnblogs.com/goloving/p/14326702.html