DEV Community


Posted on

React-Native Glassfy SDK error "Items you are try to purchase could not be found"

Im a react-native developer using expo, I added Glassfy to my project for in app purchases I followed all the steps for the documentation, the skues for the my glassfy account are loading in my react native app. I created a purchase function

 // Load all offerings a user can purchase
  async function loadOfferings() {
    let offerings = await Glassfy.offerings();
    console.log(JSON.stringify(offerings.all, null, 2));

  // Purchase one SKU and handle a successful transaction
  async function purchase(sku: GlassfySku) {

    try {
      const transaction = await Glassfy.purchaseSku(sku);

      if (transaction.receiptValidated) {
        console.log("successfull purchase");
    } catch (error) {
Enter fullscreen mode Exit fullscreen mode

loading offering works just fine and the offerings include sku data that is only avalible fom my google playstore which I asume means there is a connection between my glassfy and my playstore.

when I run the the purchase function this is what happens on my mobile phones screen.

Image description

the error code printed in the console looks like this.

 LOG  [Error: GlassfyError(code=StoreError, description=Store error, debug=Requested product is not available for purchase. (ITEM_UNAVAILABLE))]
Enter fullscreen mode Exit fullscreen mode

the sku being supplied to the funtion is loaded from the glassfy SDK so that means it does exist. The console of the sku being fed to the purchase function looks like this.

 LOG  {"extravars": {}, "product": {"basePlanId": "", "currencyCode": "USD", "description": "300 livestock is at it.", "identifier": "com.suluuboi.farmtrack.large", "period": "", "price": 5, "title": "Large (com.suluuboi.farmtrack (unreviewed))"}, "productId": "com.suluuboi.farmtrack.large", "skuId": "large", "store": 2}
Enter fullscreen mode Exit fullscreen mode

I really need help debugging the the error. the app I am developing is still under internal tesing in the playstore development console. Im trying to use sandbox for my testing. Im suspecting this error has something to do with the sandbox testing as my purchase window does not say anything about sandbox. Any assistance would be much appreciated.

Top comments (0)