typescript - 我应该如何退出应用内购买测试模式
问题描述
所以我决定实现in-app-purchases
using expo-in-app-purchases
,一切都很好。
现在我已经完成了我的工作,并希望它进入生产模式。
当我尝试在我的应用程序中购买东西时,它会显示test Card
。我应该如何退出这个?
我现在已经在 Google Play 控制台上发布了我的应用程序,并且正在审核中。我应该等到 Review 部分完成然后它自动存在测试模式吗?
这是我目前拥有的支付类。
import * as InAppPurchases from 'expo-in-app-purchases';
export default class payment {
private static finishTransactionCallback?: (purchase: any) => Promise<void>;
constructor() {
}
public static connectAsync = async () => {
await InAppPurchases.connectAsync();
InAppPurchases.setPurchaseListener(async ({ responseCode, results, errorCode }) => {
// Purchase was successful
if (responseCode === InAppPurchases.IAPResponseCode.OK) {
results.forEach(purchase => {
if (!purchase.acknowledged) {
console.log(`Successfully purchased ${purchase.productId}`);
// Process transaction here and unlock content...
// Then when you're done
payment.finishTransactionAsync(undefined, purchase);
}
});
} else
if (responseCode === InAppPurchases.IAPResponseCode.USER_CANCELED) {
console.log('User canceled the transaction');
} else if (responseCode === InAppPurchases.IAPResponseCode.DEFERRED) {
console.log('User does not have permissions to buy but requested parental approval (iOS only)');
} else {
console.warn(`Something went wrong with the purchase. Received errorCode ${errorCode}`);
}
});
}
public static async disconnectAsync() {
await InAppPurchases.disconnectAsync();
}
public static getPurchaseHistoryAsync = async () => {
var item = await InAppPurchases.getPurchaseHistoryAsync();
if (item && item.results && item.results.length > 0)
return item.results;
else return [] as (InAppPurchases.InAppPurchase | InAppPurchases.IAPItemDetails)[];
}
public static getProducts = async (itemList: string[]) => {
var item = await InAppPurchases.getProductsAsync(itemList);
if (item && item.results && item.results.length > 0)
return item.results;
else return [] as (InAppPurchases.InAppPurchase | InAppPurchases.IAPItemDetails)[];
}
public static finishTransactionAsync = async (callBack?: (purchase: any) => Promise<void>, purchase?: any) => {
try {
if (callBack)
payment.finishTransactionCallback = callBack;
else {
await InAppPurchases.finishTransactionAsync(purchase, false);
purchase.acknowledged = true;
if (payment.finishTransactionCallback)
await payment.finishTransactionCallback(purchase);
}
} catch (error) {
console.log(error);
}
}
public static async requestPayment(productId: string) {
try {
await InAppPurchases.purchaseItemAsync(productId);
return true;
}
catch (error) {
console.log("Something went wrong. with purchase:" + productId);
console.log(error);
}
return false;
}
}
更新
该应用程序现已发布到生产环境,并且仍处于测试模式。
我的应用名称是NovelManager
解决方案
推荐阅读
- r - 如何使用 R 将日期时间格式转换为“ddmmyyyy”?
- python - 如何使用 re.compile 格式化 split 函数
- jmeter - 使用 JMeter 在 Tibco JMS 端点上执行负载测试
- c++ - C++ 复制构造函数 - 指针分段错误的深度复制
- c# - Razor Pages @functions 块与代码块
- sql - SQLite - 迄今为止的时间戳
- oauth-2.0 - 如何获取令牌并同时隐藏 google drive 的 api 凭据?
- javascript - React-Router 不会渲染组件
- neo4j - 如何使用 Cypher 从 Neo4j 中的时间序列表构建折线图?
- android - 使用数据绑定后查看边距不起作用