uni-app x ios 虚拟支付 appstore 调用失败 sandbox 环境可以
uni-app x ios 虚拟支付 appstore 调用失败 sandbox 环境可以
# 产品分类
uniapp/App
# PC开发环境操作系统
Mac
# PC开发环境操作系统版本号
macOS Monterey 12.7.5
# HBuilderX类型
正式
# HBuilderX版本号
4.45
# 手机系统
iOS
# 手机系统版本号
iOS 18
# 手机厂商
苹果
# 手机机型
iPhone iPad
# 页面类型
nvue
# vue版本
vue3
# 打包方式
云端
# 项目创建方式
HBuilderX
## 示例代码
```javascript
uni.requestVirtualPayment({
apple: {
productId: this.productId,
appAccountToken: onceStr,
quantity: 1
},
success: function(res) {
//经过开发者server验证成功后请结束该交易
const virtualPaymentManager = uni.getVirtualPaymentManager()
virtualPaymentManager.finishTransaction({
transaction: res.apple,
success: (r) => {
// console.log("关单成功, 该productId= " + res.apple?.productId)
uni.hideLoading()
_this.isShowName = true;
uni.showToast({
icon: "none",
title: "pay success"
})
},
fail: (e) => {
// console.log("关单失败, 该productId= " + res.apple?.productId)
uni.hideLoading()
uni.showToast({
icon: "none",
title: "Payment finish transaction failed,"+e.errMsg+","+e.errSubject
})
}
})
},
fail: function(e) {
uni.hideLoading()
// console.log("购买失败:errSubject= " + e.errSubject + ", errCode= " + e.errCode + ", errMsg= " + e.errMsg)
uni.showToast({
icon: "none",
title: "Payment failed,"+e.errMsg+","+e.errSubject
})
}
})
操作步骤
uni.requestVirtualPayment({
apple: {
productId: this.productId,
appAccountToken: onceStr,
quantity: 1
},
success: function(res) {
//经过开发者server验证成功后请结束该交易
const virtualPaymentManager = uni.getVirtualPaymentManager()
virtualPaymentManager.finishTransaction({
transaction: res.apple,
success: (r) => {
// console.log("关单成功, 该productId= " + res.apple?.productId)
uni.hideLoading()
_this.isShowName = true;
uni.showToast({
icon: "none",
title: "pay success"
})
},
fail: (e) => {
// console.log("关单失败, 该productId= " + res.apple?.productId)
uni.hideLoading()
uni.showToast({
icon: "none",
title: "Payment finish transaction failed,"+e.errMsg+","+e.errSubject
})
}
})
},
fail: function(e) {
uni.hideLoading()
// console.log("购买失败:errSubject= " + e.errSubject + ", errCode= " + e.errCode + ", errMsg= " + e.errMsg)
uni.showToast({
icon: "none",
title: "Payment failed,"+e.errMsg+","+e.errSubject
})
}
})
预期结果
uni.requestVirtualPayment({
apple: {
productId: this.productId,
appAccountToken: onceStr,
quantity: 1
},
success: function(res) {
//经过开发者server验证成功后请结束该交易
const virtualPaymentManager = uni.getVirtualPaymentManager()
virtualPaymentManager.finishTransaction({
transaction: res.apple,
success: (r) => {
// console.log("关单成功, 该productId= " + res.apple?.productId)
uni.hideLoading()
_this.isShowName = true;
uni.showToast({
icon: "none",
title: "pay success"
})
},
fail: (e) => {
// console.log("关单失败, 该productId= " + res.apple?.productId)
uni.hideLoading()
uni.showToast({
icon: "none",
title: "Payment finish transaction failed,"+e.errMsg+","+e.errSubject
})
}
})
},
fail: function(e) {
uni.hideLoading()
// console.log("购买失败:errSubject= " + e.errSubject + ", errCode= " + e.errCode + ", errMsg= " + e.errMsg)
uni.showToast({
icon: "none",
title: "Payment failed,"+e.errMsg+","+e.errSubject
})
}
})
实际结果
uni.requestVirtualPayment({
apple: {
productId: this.productId,
appAccountToken: onceStr,
quantity: 1
},
success: function(res) {
//经过开发者server验证成功后请结束该交易
const virtualPaymentManager = uni.getVirtualPaymentManager()
virtualPaymentManager.finishTransaction({
transaction: res.apple,
success: (r) => {
// console.log("关单成功, 该productId= " + res.apple?.productId)
uni.hideLoading()
_this.isShowName = true;
uni.showToast({
icon: "none",
title: "pay success"
})
},
fail: (e) => {
// console.log("关单失败, 该productId= " + res.apple?.productId)
uni.hideLoading()
uni.showToast({
icon: "none",
title: "Payment finish transaction failed,"+e.errMsg+","+e.errSubject
})
}
})
},
fail: function(e) {
uni.hideLoading()
// console.log("购买失败:errSubject= " + e.errSubject + ", errCode= " + e.errCode + ", errMsg= " + e.errMsg)
uni.showToast({
icon: "none",
title: "Payment failed,"+e.errMsg+","+e.errSubject
})
}
})
bug描述
uni-app x 中,调用 iOS 虚拟支付,美国appstore 审核员总是 Payment failed, 我本地的sandbox 环境可以支付
更多关于uni-app x ios 虚拟支付 appstore 调用失败 sandbox 环境可以的实战教程也可以访问 https://www.itying.com/category-93-b0.html
2 回复
只得到了这个错误信息,Payment failed,Other payment errors., uni-RequestVirtualPayment
更多关于uni-app x ios 虚拟支付 appstore 调用失败 sandbox 环境可以的实战教程也可以访问 https://www.itying.com/category-93-b0.html
地区:美国,appstore审核人员那边的错误信息:Payment failed,Other payment errors., uni-RequestVirtualPayment