Can I test my in app subscriptions when app is only in internal testing track?

604 Views Asked by At

I have:

  • configured subscriptions
    • 2 products each 2 base plans - every plan is active
  • license testers
  • internal track testers
  • have the same build number in internal track as in my Android studio
  • I did release build and installed it to my device via adb
  • same signing keys
  • I can list my subscriptions by providing skus

But unfortunately, I still can't get over the error when doing purchase:

error {
  "message": "That item is unavailable.",
  "debugMessage": "",
  "code": "E_ITEM_UNAVAILABLE",
  "responseCode": 4
}

I'm using react-native-iap library and this is my code(simplyfied):

  const {subscriptions, currentPurchase, finishTransaction, getSubscriptions, getPurchaseHistory} = useIAP()

  const subscribe = async (productId: string, offerToken: string) => {
    console.log('product id', productId, 'offertoken', offerToken)
    try {
      await requestSubscription({
        sku: productId,
        ...(offerToken && {
          subscriptionOffers: [{sku: productId, offerToken}],
        }),
      })
    } catch (err: any) {
      console.warn(err.code, err.message)
    }
  }

  useEffect(() => {
    const subscription = purchaseUpdatedListener((purchase: Purchase) => {
      console.log('purchase', JSON.stringify(purchase, null, 2))
    })
    return () => {
      subscription.remove()
    }
  }, [])

  useEffect(() => {
    const subscription = purchaseErrorListener((error: PurchaseError) => {
      console.log('error', JSON.stringify(error, null, 2))
    })
    return () => {
      subscription.remove()
    }
  }, [])

  const finish = () => {
    if (currentPurchase) {
      finishTransaction({purchase: currentPurchase, isConsumable: false})
    }
  }

...

{subscriptions.map((subscription) =>
              subscription.subscriptionOfferDetails.map((offer) => (
                <Text
                  key={offer.basePlanId}
                  onPress={() => subscribe(subscription.productId, offer.offerToken)}
                >
                  {subscription.name}
                </Text>
              )),
            )}

  • Do I have to release app to closed testing to be able to proceed with testing?
  • Do I have something misconfigured?

Any tips&tricks welcomed

1

There are 1 best solutions below

1
Babu On

...well...I found it (☝ ՞ਊ ՞)☝ ... in 2023 for testing subscription for Android you need these boxes to be ticked:

  • ✅ you have one Google Account on the device
  • ✅ your Google Account email is in licensed users - Google Play Console > License testing
  • your-app.aab uploaded to internal track
  • ✅ your Google Account is listed as a tester for the internal track - Your App > Internal testing > Testers
  • ✅ you have accepted to be internal tester via link (from ☝) <- this was my problem (ᗒᗣᗕ)՞
  • ✅ you have configured subscriptions and at least one base plan is active

not needed:

  • ❌ release in closed/production track
  • ❌ release build (I can run it with metro in debug mode)
  • ❌ your build is signed with the same keys as your-app.aab in store