Page 1 of 1

In-App purchase testing

Posted: Wed Jan 01, 2025 11:26 pm
by Aduro91
Hey all,

I am looking to test in-app purchases.

1. I have set up a non-consumable purchase in the app store
2. I have reworded the following code:

In a button:

Code: Select all

on mouseUp
   mobileStoreEnablePurchaseUpdates
   mobileStoreSetProductType "com.runrev.sampleapp.nonconsumable" ((changed to "com.mydomain.myapp.myproductID" to match my internal app ID and product ID on Apple Connect)), "inapp"
   mobileStoreMakePurchase "com.runrev.sampleapp.nonconsumable" ((changed to "com.mydomain.myapp.myproductID" to match my internal app ID and product ID on Apple Connect)), "1", "This belongs to me"
end mouseUp

 
And in the stack script:

on purchaseStateUpdate pPurchaseID, pProductID, pState
   switch pState
      case "paymentReceived" 
         answer "payment received!"
         offerPurchasedProduct pProductID
         mobileStoreConfirmPurchase pProductID
         mobileStoreDisablePurchaseUpdates
         break
      case "error"
         answer "Error occured during purchase handling:" & return & return & mobileStorePurchaseError(pPurchaseID)
         mobileStoreDisablePurchaseUpdates
         break
      case "invalidSKU"
         answer "Invalid SKU."
         mobileStoreDisablePurchaseUpdates
         break
      case "alreadyEntitled"
         answer "Already Owned."
         mobileStoreDisablePurchaseUpdates
         break
      case "restored"
         answer "restored"
         offerPurchasedProduct pProductID
         mobileStoreConfirmPurchase pProductID
         mobileStoreDisablePurchaseUpdates
         break
      case "cancelled"
         answer "Purchase Cancelled:" && pProductID
         mobileStoreDisablePurchaseUpdates
         break     
   end switch
end purchaseStateUpdate

 

on offerPurchasedProduct pProductID
   if pProductID is "com.runrev.sampleapp.nonconsumable" ((changed to "com.mydomain.myapp.myproductID" to match my internal app ID and product ID on Apple Connect)) then
      put "success" into field result
end if
end offerPurchasedProduct	
I use a sandbox account that I didn't log into the app store with seperately and first logged in through the app.

But i get:

Error occured during pruchase handling: an unknown error occured.

Any ideas?

Re: In-App purchase testing

Posted: Fri Jan 03, 2025 8:36 pm
by Aduro91
SOLVED: The problem was that I needed to add bank details in order to complete the Paid App agreement, which was stuck on pending user info.