苹果支付,1.0

This commit is contained in:
@fawn-nine
2023-04-19 14:53:52 +08:00
parent 14ea3db691
commit ee74da48cc

View File

@@ -89,6 +89,9 @@
setPay,
setPayAssign
} from '@/config/utils';
const IAPOrders = [
'add69'
] // 根据这些ids获取到苹果app内商品信息这些ids就是你上面设置的产品id
export default {
data() {
return {
@@ -174,6 +177,7 @@
mask: true
})
plus.payment.getChannels((channels) => {
console.log(channels,'channels')
for (var i in channels) {
// 判断是否苹果支付
if (channels[i].id === 'appleiap') {
@@ -193,12 +197,13 @@
const that = this
console.log(that.stepsCj.priceTypeId,88888888)
// ['xxxxx'] 是平台申请拿到的内购商品的id
that.iapChannel.requestOrder(that.stepsCj.priceTypeId, function(event) {
console.log(IAPOrders,'IAPOrders')
that.iapChannel.requestOrder(IAPOrders, function(event) {
// uni.hideLoading()
console.log(event)
console.log(event,'event')
for (var index in event) {
var OrderItem = event[index]
console.log(OrderItem)
console.log(OrderItem, 'OrderItem')
that.topay(OrderItem.productid)
}
}, function(erroemsg) {
@@ -207,7 +212,7 @@
// })
uni.showToast({
title: "获取支付通道失败",
title: "获取订单失败,请重试",
icon: 'none'
})
})
@@ -223,9 +228,10 @@
orderInfo: {
productid: id,
username: 'ordersn', // 用户标识
optimize: true // 设置 optimize: true 解决丢单问题
optimize: false // 设置 optimize: true 解决丢单问题
},
success: (res => {
console.log(res,'成功的返回值1') // 成功的返回值
uni.hideLoading()
let data= {
receipt:res.transactionReceipt, // 校验体