So I decided to implement in-app-purchases
using expo-in-app-purchases
, and everything worked great.
Now I have done my part and want it on production mode.
When I try to Buy things in my app it says test Card
. How should I exit this?
I have released now my app on Google Play console and it's in review. Should I just wait until the Review part is done and then it automatically exist the test mode?
Here is the payment class that I currently have.
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; }}
Update
The app now is released to production and it still in the test mode.
My app name is NovelManager