提交 2b730510 编写于 作者: zhaofengliang920817's avatar zhaofengliang920817

调整uni-virtualPayment 示例

上级 8f312529
......@@ -2,7 +2,7 @@
<!-- #ifdef APP -->
<scroll-view style="flex: 1;">
<!-- #endif -->
<page-head title="苹果内购支付"></page-head>
<page-head title="苹果虚拟支付"></page-head>
<view style="padding-left: 20px; padding-right: 20px;">
<text>
requestVirtualPayment api 适用于消耗性类型、非消耗性类型、自动续期订阅类型、非自动续期订阅类型产品的购买。\n\n
......@@ -131,22 +131,22 @@
},
success: (res) => {
uni.hideLoading()
console.log("购买成功:该productId= " + res.apple?.payment.productId)
console.log("购买成功:该productId= " + res.apple?.productId)
//TODO: 开发者server验证逻辑
//经过开发者server验证成功后请结束该交易
uni.showToast({
title: "购买成功:" + res.apple?.payment.productId,
title: "购买成功:" + res.apple?.productId,
icon: 'success'
})
this.virtualPaymentContext.finishTransaction({
transaction: res.apple,
success: (r) => {
console.log("关单成功, 该productId= " + res.apple?.payment.productId)
console.log("关单成功, 该productId= " + res.apple?.productId)
},
fail: (e) => {
console.log("关单失败, 该productId= " + res.apple?.payment.productId)
console.log("关单失败, 该productId= " + res.apple?.productId)
}
})
},
......@@ -174,7 +174,7 @@
//TODO: 开发者server验证逻辑
console.log("restore成功的交易productId= " + transaction.payment.productId)
console.log("restore成功的交易productId= " + transaction.productId)
})
uni.showToast({
title: "restore成功的交易个数:" + res.transactions.length,
......@@ -203,7 +203,7 @@
console.log("获取未结束的订单列表个数:" + res.transactions.length)
res.transactions.forEach(transaction => {
console.log("getUnfinishedTransactions成功的交易productId= " + transaction.payment.productId)
console.log("getUnfinishedTransactions成功的交易productId= " + transaction.productId)
//TODO: 开发者server验证逻辑
uni.showToast({
......@@ -214,10 +214,10 @@
this.virtualPaymentContext.finishTransaction({
transaction: transaction,
success: (r) => {
console.log("关单成功, 该productId= " + transaction.payment.productId)
console.log("关单成功, 该productId= " + transaction.productId)
},
fail: (e) => {
console.log("关单失败, 该productId= " + transaction.payment.productId)
console.log("关单失败, 该productId= " + transaction.productId)
}
})
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册