addPaymentByProductIdentifiers fail {"errMsg": "takeIAPAction:failapi addPaymentByProductIdentifiers fail Can't find SKProduct in cache by productIdentifier. Please make sure productsRequest has been invoked.", "err_code": "-2"}
下面是我的代码:
const requestObj = wx.miniapp.IAP.requestSKProducts({
productIdentifiers: [
'com.aizn.tech.mj.item1'
],
success(ret) {
console.log(ret.invalidProductIdentifiers)
console.log(ret.products)
wx.miniapp.IAP.addPaymentByProductIdentifiers({
productIdentifier: 'com.aizn.tech.mj.item1',
success: (args) => {
// addPayment调用成功,但是不代表交易完成。
console.log(`addPaymentByProductIdentifiers success`, args)
},
fail: (args) => {
// addPayment调用成功
console.error(`addPaymentByProductIdentifiers fail`, args)
}
})
},
fail(error) {
console.error(`requestSKProducts failed. ${error}`)
}
})
在调用 addPaymentByProductIdentifiers 前 productsRequest 的回调方法成功执行了吗