马小力
马小力
  • 发布:2019-03-04 18:45
  • 更新:2021-09-06 18:54
  • 阅读:3010

plus.payment.request 调用苹果支付失效

分类:uni-app
IAP

<form @submit="applePay" >
<view class="btn-index-apple">
<button formType="submit">Apple支付</button>
</view>
</form>

<script>
var iapChannel;
var IAPOrders = ['5078739907929812'];
export default {
data() {
return {
}
},
onLoad() {
// 获取支付通道
plus.payment.getChannels((channels) => {
for(var i in channels){
var channel=channels[i];
console.log(JSON.stringify(channel))
if(channel.id==='appleiap'){
iapChannel=channel;
iapChannel.requestOrder(IAPOrders, function(event) {
console.log(JSON.stringify(event))
for (var index in event) {
var OrderItem = event[index];
var title='Title:' + OrderItem.title + 'Price:' + OrderItem.price + 'ProductID:' + OrderItem.productid
console.log(title);
}
}, function(errormsg) {
console.log("获取支付通道失败:" + errormsg.message);
});
}
}
},function(e){
console.log("获取支付通道失败:"+e.message);
});
},
methods: {

       /**  
        * 苹果支付  
        */  
       applePay(){  
        var  orderInfo = { productid: “5078739907929812” };  
            plus.payment.request(iapChannel, orderInfo, function(e){  
               //这里的e包括了验证数据,可以发送到服务器端进行验证  
               console.log(JSON.stringify(e));  
            }, function(){  
                console.log("支付失败")  
            });  
       }  

    }  
}  

</script>

2019-03-04 18:45 负责人:无 分享
已邀请:
马小力

马小力 (作者) - AI技术AI生活

plus.payment.request(iapChannel, orderInfo, function(e){}) 执行这段log没有输出

  • 梦亦

    兄弟 解决了吗?

    2019-11-25 14:47

1***@qq.com

1***@qq.com

var order = {
"productid": 'owl_silvercoin_60000',
"username": "Test2",
"quantity": "2"
};
console.log("channel==11=:" JSON.stringify(channel));
console.log("order=:" JSON.stringify(order));
plus.payment.request(channel,order,function(paymentResult){
console.log("result===支付完成====:");
},function(err){
console.log("获取支付失败:" JSON.stringify(err));
})

我调用了 plus.payment.request后,没有响应。不知那里弄错了?请大神回答下,谢谢

  • 1***@qq.com

    请问这个问题解决了吗?

    2020-09-09 13:30

  • 1***@qq.com

    回复 1***@qq.com: 记得好像是我在苹果平台上配置的商品id弄错了,并且在苹果平台上删除的商品id,下次新的商品ID不要与删除的一致,否则可能会有问题。

    2021-03-03 14:33

p***@gsdata.cn

p***@gsdata.cn

解决问题了吗

该问题目前已经被锁定, 无法添加新回复