If I’m consuming instantly, this is the code working in my Android/iOS project
with comment lines explaining the values being passed in the Android build
(note that the product ID values are more specific for Android than iOS):
if tPlatform = "android" then
put "com.midwestcoastmedia.dj3pm." into tProductIDbase
else if tPlatform = "iPhone" then
put EMPTY into tProductIDbase
end if
put tProductIDbase & pWhichProduct into tProductID
mobileStoreEnablePurchaseUpdates
## mobileStoreSetProductType "com.midwestcoastmedia.dj3pm.tip01", "inapp"
mobileStoreSetProductType tProductID, "inapp"
## mobileStoreMakePurchase "com.midwestcoastmedia.dj3pm.tip01", "1",
"Thanks for the buck!"
mobileStoreMakePurchase tProductID, "1", tMessage
## mobileStoreConsumePurchase "com.midwestcoastmedia.dj3pm.tip01"
mobileStoreConsumePurchase tProductID
put the result into tCatch
BUT you’ll also need to implement the on purchaseStateUpdate handler to
completely execute the purchase cycle. The lesson is sometimes hard to follow
when Android changes their branding/naming but
https://lessons.livecode.com/m/4069/l/184481-how-do-i-implement-in-app-purchases-in-livecode-google-play-store
<https://lessons.livecode.com/m/4069/l/184481-how-do-i-implement-in-app-purchases-in-livecode-google-play-store>
has a good example of this.
—Andrew Bell
> To: How to use LiveCode <[email protected]>
> Subject: Re: Consumable In App Purchases on Android
> Message-ID:
>
> <byapr12mb2709417d61c6292a2abab3d8b9...@byapr12mb2709.namprd12.prod.outlook.com>
>
> Content-Type: text/plain; charset="Windows-1252"
>
> Panos,
>
> Thank you for the reply. Unfortunately, this isn?t working for me? maybe
> I?m doing something wrong? Product ID is ?1001?. I was able to purchase
> that product no problem. If I attempt to purchase it again, I get
> ?alreadyEntitled?.
>
> In a button I put:
>
> on mouseUp
> mobileStoreConsumePurchase 1001
> answer the result
> end mouseUp
>
> The result is empty (I assume that is success). Then, I attempt to purchase
> 1001 and again I get ?alreadyEntitled?.
>
> I then tried (just guessing at what I need to do as the docs are very vague
> on how to use it):
>
> on mouseUp
> mobileStoreEnablePurchaseUpdates
> mobileStoreSetProductType 1001,"inapp"
> mobileStoreConsumePurchase 1001
> answer the result
> end mouseUp
>
> Again, result is empty and an attempt to purchase 1001 again, gets
> ?alreadyEntitled?.
>
> What am I doing wrong?
>
> -Dan
>
>
>
> From: use-livecode <[email protected]> on behalf of
> panagiotis m via use-livecode <[email protected]>
> Date: Tuesday, August 8, 2023 at 9:21 AM
> To: How to use LiveCode <[email protected]>
> Cc: panagiotis m <[email protected]>
> Subject: Re: Consumable In App Purchases on Android
> Hello Dan,
>
> I think Google no longer differentiates between consumables and
> non-consumables when setting up the in-app product - they are both marked
> as "In-App Products?. However, in LiveCode, you have to call
> mobileStoreConsumePurchase pProductID to be able to buy the product again -
> otherwise you get a "alreadyEntitled" status.
>
> If you do this, and still get "alreadyEntitled", then you have to ensure
> that the pProductID param passed to mobileStoreConsumePurchase indeed
> matches exactly the product id of the product you set up in the google dev
> console.
>
> Hope this helps.
>
> Kind regards,
> Panos
>
> On Tue, 8 Aug 2023 at 01:57, Dan Friedman via use-livecode <
> [email protected]> wrote:
>
>> Does anyone have any experience with consumable in-app purchases on
>> Android? I can?t seem to figure out how to (1) create a consumable
>> product, and (2) how to consume it. mobileStoreConsumePurchase pProductID
>> doesn?t seem to function right? I get back a result that is ?true?, but
>> attempting to purchase the same product, returns ?alreadyEntitled?.
>>
>> The ?How do I implement in-app purchases in LiveCode - Google Play Store??
>> lesson says: click "In-App Products? and click ?Add new product?. From
>> there, follow the instructions to create the type of in-app purchase you
>> wish to use.
>>
>> In Google Play Console > Monitize > In-App Products > Create Product,
>> there isn?t a place to select the type of in-app purchase.
>>
>> Any insight or instructions you may have would be greatly appreciated!!
>>
>> -Dan
>> _______________________________________________
>> use-livecode mailing list
>> [email protected]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
> _______________________________________________
> use-livecode mailing list
> [email protected]
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode