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
But i get:
Error occured during pruchase handling: an unknown error occured.
Any ideas?