1.获取appleiap支付通道
var iap = null;
plus.payment.getChannels(function(channels) {
for (var i in channels) {
var channel = channels[i];
// 获取 id 为 'appleiap' 的 channel
if (channel.id === 'appleiap') {
iap = channel;
}
}
}, function(e) {
console.log("获取iap支付通道失败:" + e.message);
});
2.获取订单信息
var ids = [商品id1, 商品id2];
iap.requestOrder(ids, function(e) {
// 获取订单信息成功回调方法
console.log('requestOrder success: ' + JSON.stringify(e));
}, function(e) {
// 获取订单信息失败回调方法
console.log('requestOrder failed: ' + JSON.stringify(e));
});
在获取订单信息时,出现错误信息,输出日志为:
requestOrder failed: {"code":-100,"message":"Payment_appleiap:Error Domain=NSCocoaErrorDomain Code=4097 \"connection to service on pid 0 named com.apple.storekitservice\" UserInfo={NSDebugDescription=connection to service on pid 0 named com.apple.storekitservice},https://ask.dcloud.net.cn/article/282"}
从其他地方查了,也没查出什么原因
苹果的税务也配好了,APP管理里面也添加了内购项目
1 个回复
mengxinxuexi (作者)
现在已经找的原因了requestOrder传的ids,必须是字符串数组