更新记录
1.0.2(2024-09-26)
修复开始链接后持续信息回掉异常的问题。
1.0.1(2024-03-08)
调整interface.uts文件中接口导出信息。
1.0.0(2024-03-07)
初始化版本发布
查看更多平台兼容性
Vue2 | Vue3 |
---|---|
√ | √ |
App | 快应用 | 微信小程序 | 支付宝小程序 | 百度小程序 | 字节小程序 | QQ小程序 |
---|---|---|---|---|---|---|
HBuilderX 3.6.8,Android:4.4,iOS:不支持,HarmonyNext:不确定 | × | × | × | × | × | × |
钉钉小程序 | 快手小程序 | 飞书小程序 | 京东小程序 |
---|---|---|---|
× | × | × | × |
H5-Safari | Android Browser | 微信浏览器(Android) | QQ浏览器(Android) | Chrome | IE | Edge | Firefox | PC-Safari |
---|---|---|---|---|---|---|---|---|
× | × | × | × | × | × | × | × | × |
概述
XF-googleBillingUTS封装了google内购V6支付功能。
插件接口
startConnection
开始连接
uni-app项目中(nvue)调用示例:
import { startConnection } from "@/uni_modules/XF-googleBillingUTS"
startConnection({
complete: (res) => {
console.log(res)
}
});
uni-app x项目(uvue)中调用示例:
import { startConnection } from "@/uni_modules/XF-googleBillingUTS";
import { StateListenerOptions } from "@/uni_modules/XF-googleBillingUTS/utssdk/interface.uts";
let options = {
complete: (res : any) => {
console.log(res)
}
} as StateListenerOptions;
startConnection(options);
可用性
Android系统
可提供的1.0.0及更高版本
isReady
是否准备好
uni-app项目中(nvue)调用示例:
import { isReady } from "@/uni_modules/XF-appGrayUTS"
isReady();
uni-app x项目(uvue)中调用示例:
import { isReady } from "@/uni_modules/XF-appGrayUTS";
isReady();
可用性
Android系统
可提供的1.0.0及更高版本
stopConnection
断开连接
uni-app项目中(nvue)调用示例:
import { stopConnection } from "@/uni_modules/XF-googleBillingUTS"
stopConnection({
complete: (res) => {
console.log(res)
}
});
uni-app x项目(uvue)中调用示例:
import { stopConnection } from "@/uni_modules/XF-googleBillingUTS";
import { StopConnectionOptions } from "@/uni_modules/XF-googleBillingUTS/utssdk/interface.uts";
let options = {
complete: (res : any) => {
console.log(res)
}
} as StopConnectionOptions;
stopConnection(options);
可用性
Android系统
可提供的1.0.0及更高版本
queryProductDetails
查询产品详细信息
uni-app项目中(nvue)调用示例:
import { queryProductDetails } from "@/uni_modules/XF-googleBillingUTS"
queryProductDetails({
productType : "inapp",
productList : [''],
complete: (res) => {
console.log(res)
}
});
uni-app x项目(uvue)中调用示例:
import { queryProductDetails } from "@/uni_modules/XF-googleBillingUTS";
import { ProductDetailsOptions } from "@/uni_modules/XF-googleBillingUTS/utssdk/interface.uts";
let options = {
productType : "inapp",
productList : [''],
complete: (res : any) => {
console.log(res)
}
} as ProductDetailsOptions;
queryProductDetails(options);
可用性
Android系统
可提供的1.0.0及更高版本
launchBillingFlow
拉起来支付界面
uni-app项目中(nvue)调用示例:
import { launchBillingFlow } from "@/uni_modules/XF-googleBillingUTS"
launchBillingFlow({
product : "",
complete: (res) => {
console.log(res)
}
});
uni-app x项目(uvue)中调用示例:
import { launchBillingFlow } from "@/uni_modules/XF-googleBillingUTS";
import { BillingFlowOptions } from "@/uni_modules/XF-googleBillingUTS/utssdk/interface.uts";
let options = {
product : "",
complete: (res : any) => {
console.log(res)
}
} as BillingFlowOptions;
launchBillingFlow(options);
可用性
Android系统
可提供的1.0.0及更高版本
queryPurchases
查询购买记录
uni-app项目中(nvue)调用示例:
import { queryPurchases } from "@/uni_modules/XF-googleBillingUTS"
queryPurchases({
productType : "inapp",
complete: (res) => {
console.log(res)
}
});
uni-app x项目(uvue)中调用示例:
import { queryPurchases } from "@/uni_modules/XF-googleBillingUTS";
import { QueryPurchasesOptions } from "@/uni_modules/XF-googleBillingUTS/utssdk/interface.uts";
let options = {
productType : "inapp",
complete: (res : any) => {
console.log(res)
}
} as QueryPurchasesOptions;
queryPurchases(options);
可用性
Android系统
可提供的1.0.0及更高版本
queryPurchaseHistory
查询购买历史记录
uni-app项目中(nvue)调用示例:
import { queryPurchaseHistory } from "@/uni_modules/XF-googleBillingUTS"
queryPurchaseHistory({
productType : "inapp",
complete: (res) => {
console.log(res)
}
});
uni-app x项目(uvue)中调用示例:
import { queryPurchaseHistory } from "@/uni_modules/XF-googleBillingUTS";
import { QueryPurchasesOptions } from "@/uni_modules/XF-googleBillingUTS/utssdk/interface.uts";
let options = {
productType : "inapp",
complete: (res : any) => {
console.log(res)
}
} as QueryPurchasesOptions;
queryPurchaseHistory(options);
可用性
Android系统
可提供的1.0.0及更高版本
consume
消耗商品
uni-app项目中(nvue)调用示例:
import { consume } from "@/uni_modules/XF-googleBillingUTS"
consume({
purchaseToken : "",
complete: (res) => {
console.log(res)
}
});
uni-app x项目(uvue)中调用示例:
import { consume } from "@/uni_modules/XF-googleBillingUTS";
import { ConsumeOptions } from "@/uni_modules/XF-googleBillingUTS/utssdk/interface.uts";
let options = {
purchaseToken : "",
complete: (res : any) => {
console.log(res)
}
} as ConsumeOptions;
consume(options);
可用性
Android系统
可提供的1.0.0及更高版本
acknowledgePurchase
确认购买
uni-app项目中(nvue)调用示例:
import { acknowledgePurchase } from "@/uni_modules/XF-googleBillingUTS"
acknowledgePurchase({
purchaseToken : "",
complete: (res) => {
console.log(res)
}
});
uni-app x项目(uvue)中调用示例:
import { acknowledgePurchase } from "@/uni_modules/XF-googleBillingUTS";
import { ConsumeOptions } from "@/uni_modules/XF-googleBillingUTS/utssdk/interface.uts";
let options = {
purchaseToken : "",
complete: (res : any) => {
console.log(res)
}
} as ConsumeOptions;
acknowledgePurchase(options);
可用性
Android系统
可提供的1.0.0及更高版本
isFeatureSupported
该功能是否支持
uni-app项目中(nvue)调用示例:
import { isFeatureSupported } from "@/uni_modules/XF-googleBillingUTS"
isFeatureSupported({
feature : "",
complete: (res) => {
console.log(res)
}
});
uni-app x项目(uvue)中调用示例:
import { isFeatureSupported } from "@/uni_modules/XF-googleBillingUTS";
import { FeatureSupportedOptions } from "@/uni_modules/XF-googleBillingUTS/utssdk/interface.uts";
let options = {
feature : "",
complete: (res : any) => {
console.log(res)
}
} as FeatureSupportedOptions;
isFeatureSupported(options);
可用性
Android系统
可提供的1.0.0及更高版本
showInAppMessages
应用内消息
uni-app项目中(nvue)调用示例:
import { showInAppMessages } from "@/uni_modules/XF-googleBillingUTS"
showInAppMessages({
categoryId : 1,
complete: (res) => {
console.log(res)
}
});
uni-app x项目(uvue)中调用示例:
import { showInAppMessages } from "@/uni_modules/XF-googleBillingUTS";
import { InAppMessagesOptions } from "@/uni_modules/XF-googleBillingUTS/utssdk/interface.uts";
let options = {
categoryId : 1,
complete: (res : any) => {
console.log(res)
}
} as InAppMessagesOptions;
showInAppMessages(options);
可用性
Android系统
可提供的1.0.0及更高版本