Re: Consumable In App Purchases on Android

2023-08-09 Thread Dan Friedman via use-livecode
Panos,

Again, thank you for your help!   mobileStoreProductProperty works beautifully! 
  As for the lesson, it’s not that it could have been better, it’s actually 
pretty good (as most LC lessons are).  It’s just that it needs to be updated to 
reflect newer methods and procedures.

Given how long your todo list is, I appreciate the time you always take to help 
me, and all the others out.  It’s GREATLY appreciated!

-Dan


From: use-livecode  on behalf of 
panagiotis m via use-livecode 
Date: Wednesday, August 9, 2023 at 12:46 PM
To: How to use LiveCode 
Cc: panagiotis m 
Subject: Re: Consumable In App Purchases on Android
Hello Dan,

Thanks for the update.

RE 1, I *think* yes, but I would suggest you double check this anyway.

RE 2, I would suggest not using mobilePurchaseGet(). This function is from
the older API for in-app purchases, and we have kept it for backwards
compatibility. I suggest using mobileStoreProductProperty (productID,
propertyName) instead. In fact, using mobileStoreProductProperty
(productID, "purchaseToken") is what you need in this use-case.

RE the lessons, yes, they could have been better. I'll add this to my
(long!) todo list :)

Kind regards,
Panos

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Consumable In App Purchases on Android

2023-08-09 Thread panagiotis m via use-livecode
Hello Dan,

Thanks for the update.

RE 1, I *think* yes, but I would suggest you double check this anyway.

RE 2, I would suggest not using mobilePurchaseGet(). This function is from
the older API for in-app purchases, and we have kept it for backwards
compatibility. I suggest using mobileStoreProductProperty (productID,
propertyName) instead. In fact, using mobileStoreProductProperty
(productID, "purchaseToken") is what you need in this use-case.

RE the lessons, yes, they could have been better. I'll add this to my
(long!) todo list :)

Kind regards,
Panos
--



On Wed, 9 Aug 2023 at 22:29, Dan Friedman via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Panos and others…
>
> First, thank you for your assistance and advise with this.   Panos’
> suggestions were spot on!Restoring the purchases, then calling
> mobileStoreConsumePurchase worked for consumption.   And, adding a
> “complete” case to purchaseStateUpdate and handeling the
> mobilePurchaseGet() as well as the mobileStoreConsumePurchase worked
> beautifully.   A couple of follow up questions…
>
> 1 - Does the “complete” case get returned with the Apple Store as well?
> 2 – Is there a way to get the purchase token from mobilePurchaseGet() on
> Android?   The “transactionIdentifier” returns the order number, not the
> purchase token.  The purchase token is needed to verify the purchase server
> side.
>
> Lastly, it would be terrific if the lesson on the LC website was updated
> to these options/methods.   It might save the next guy some grief.
>
> -Dan
>
>
> From: use-livecode  on behalf of
> panagiotis m via use-livecode 
> Date: Wednesday, August 9, 2023 at 7:51 AM
> To: How to use LiveCode 
> Cc: panagiotis m 
> Subject: Re: Consumable In App Purchases on Android
> Hello all,
>
> Also, it might be worth trying this as well - add a new button with this
> code:
>
> on mouseUp
>mobileStoreEnablePurchaseUpdates
>mobileStoreRestorePurchases
> end mouseUp
>
> Then press the button, and *then* call mobileStoreConsumePurchase
> pProductID .
> Hopefully now it should be properly consumed, and you should be able to buy
> it (and consume it) again.
>
> Cheers,
> Panos
> --
>
> On Wed, 9 Aug 2023 at 11:37, panagiotis m  wrote:
>
> > Hello Dan,
> >
> > The call to mobileStoreConfirmPurchase pProductID  causes the
> > purchaseStateUpdate message to be sent again with status=complete.
> >
> > So I would not suggest putting the call to mobileStoreConsumePurchase
> > pProductID just after mobileStoreConfirmPurchase.
> >
> > You could either put it in a separate button and see if it works,
> > otherwise add a [case "complete"] in the purchaseStateUpdate msg and
> there
> > consume the product and disable purchase updates, i.e.:
> >
> > on purchaseStateUpdate pPurchaseID, pProductID, pState
> >switch pState
> >   case "paymentReceived"
> >  answer "Payment received!"
> >  offerPurchasedProduct pProductID
> >  mobileStoreConfirmPurchase pProductID
> >  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"
> >  put "Restored: " & pProductID & cr after field "restored"
> >  offerPurchasedProduct pProductID
> >  mobileStoreConfirmPurchase pProductID
> >  break
> >   case "cancelled"
> >  answer "Purchase Cancelled:" && pProductID
> >  mobileStoreDisablePurchaseUpdates
> >  break
> >   case "complete"
> >  answer "Purchase Complete:" && pProductID
> >  mobileStoreConsumePurchase pProductID  // <-- ADD THIS HERE
> >  mobileStoreDisablePurchaseUpdates
> >  break
> >end switch
> > end purchaseStateUpdate
> >
> > Hope this helps.
> >
> > Kind regards,
> > Panos
> > --
> >
> >
> >
> > On Tue, 8 Aug 2023 at 22:52, Dan Friedman via use-livecode <
> > use-li

Re: Consumable In App Purchases on Android

2023-08-09 Thread Dan Friedman via use-livecode
Panos and others…

First, thank you for your assistance and advise with this.   Panos’ suggestions 
were spot on!Restoring the purchases, then calling 
mobileStoreConsumePurchase worked for consumption.   And, adding a “complete” 
case to purchaseStateUpdate and handeling the mobilePurchaseGet() as well as 
the mobileStoreConsumePurchase worked beautifully.   A couple of follow up 
questions…

1 - Does the “complete” case get returned with the Apple Store as well?
2 – Is there a way to get the purchase token from mobilePurchaseGet() on 
Android?   The “transactionIdentifier” returns the order number, not the 
purchase token.  The purchase token is needed to verify the purchase server 
side.

Lastly, it would be terrific if the lesson on the LC website was updated to 
these options/methods.   It might save the next guy some grief.

-Dan


From: use-livecode  on behalf of 
panagiotis m via use-livecode 
Date: Wednesday, August 9, 2023 at 7:51 AM
To: How to use LiveCode 
Cc: panagiotis m 
Subject: Re: Consumable In App Purchases on Android
Hello all,

Also, it might be worth trying this as well - add a new button with this
code:

on mouseUp
   mobileStoreEnablePurchaseUpdates
   mobileStoreRestorePurchases
end mouseUp

Then press the button, and *then* call mobileStoreConsumePurchase pProductID .
Hopefully now it should be properly consumed, and you should be able to buy
it (and consume it) again.

Cheers,
Panos
--

On Wed, 9 Aug 2023 at 11:37, panagiotis m  wrote:

> Hello Dan,
>
> The call to mobileStoreConfirmPurchase pProductID  causes the
> purchaseStateUpdate message to be sent again with status=complete.
>
> So I would not suggest putting the call to mobileStoreConsumePurchase
> pProductID just after mobileStoreConfirmPurchase.
>
> You could either put it in a separate button and see if it works,
> otherwise add a [case "complete"] in the purchaseStateUpdate msg and there
> consume the product and disable purchase updates, i.e.:
>
> on purchaseStateUpdate pPurchaseID, pProductID, pState
>switch pState
>   case "paymentReceived"
>  answer "Payment received!"
>  offerPurchasedProduct pProductID
>  mobileStoreConfirmPurchase pProductID
>  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"
>  put "Restored: " & pProductID & cr after field "restored"
>  offerPurchasedProduct pProductID
>  mobileStoreConfirmPurchase pProductID
>  break
>   case "cancelled"
>  answer "Purchase Cancelled:" && pProductID
>  mobileStoreDisablePurchaseUpdates
>  break
>   case "complete"
>  answer "Purchase Complete:" && pProductID
>  mobileStoreConsumePurchase pProductID  // <-- ADD THIS HERE
>  mobileStoreDisablePurchaseUpdates
>  break
>end switch
> end purchaseStateUpdate
>
> Hope this helps.
>
> Kind regards,
> Panos
> --
>
>
>
> On Tue, 8 Aug 2023 at 22:52, Dan Friedman via use-livecode <
> use-livecode@lists.runrev.com> wrote:
>
>> Andrew,
>>
>> Thank you for the input.   The code snippet you said you are using has
>> mobileStoreConsumePurchase IMMEDIATELY following mobileStoreMakePurchase.
>> Is that what you are doing?   The LC example show that
>> mobileStoreMakePurchase should be handled in the purchaseStateUpdate
>> message after the purchase is paymentReceived”
>>
>> If that’s true, then I feel like I’m doing exactly what you are
>> suggesting.   The purchase is fine, but the consumption if not working for
>> me.   Here’s what I’m doing:
>>
>> on startInAppPurchase numCredits
>>   //setup purchase id
>>   if numCredits = 1 then
>> put 1001 into productID
>> put "$0.99" into productAmount
>>   else if numCredits = 2 then
>> put 1002 into productID
>> put "$1.99" into productAmount
>>   else if numCredits = 3 then
>> put 1003 into productID
>> put "$2.99" into productAmount
>>   else if numCredits = 11 then
>> put 1011 into productID
>> p

Re: Consumable In App Purchases on Android

2023-08-09 Thread panagiotis m via use-livecode
te
>>   global user
>>
>>   switch pState
>> case "paymentReceived"
>>   put mobilePurchaseGet(pPurchaseID,"receipt") into rawReciptData
>>
>>   //tell our server is was sucessful and log users credits to database
>>   if isIPhone() then
>> if db_validateAppleReceipt(rawReciptData) then
>>   add (pProductID-1000) to user["credits"]
>> end if
>>   else
>> //will add Android database call when ready
>>   end if
>>
>>   mobileStoreConfirmPurchase pProductID //Inform the store that the
>> purchase identifier productID was successfully delivered
>>   if isAndroid() then
>> mobileStoreConsumePurchase pProductID. //  <--- DOES NOT SEEM TO
>> CONSUME THE PRODUCT !!
>>   end if
>>
>>   mobileStoreDisablePurchaseUpdates
>>   loadMeUp //refresh our display
>>   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
>>
>>   loadMeUp //refresh our display
>>   break
>> case "canceled"
>> case "cancelled"
>>   answer "Purchase Cancelled:" && pProductID
>>   mobileStoreDisablePurchaseUpdates
>>   break
>>   end switch
>> end purchaseStateUpdate
>>
>>
>>
>> Do you see anything wonky in my code?
>>
>> --Dan
>>
>> From: use-livecode  on behalf of
>> Andrew at MidWest Coast Media via use-livecode <
>> use-livecode@lists.runrev.com>
>> Date: Tuesday, August 8, 2023 at 10:57 AM
>> To: use-livecode@lists.runrev.com 
>> Cc: Andrew at MidWest Coast Media 
>> Subject: Re: Consumable In App Purchases on Android
>> 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
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Consumable In App Purchases on Android

2023-08-09 Thread panagiotis m via use-livecode
play
>   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
>
>   loadMeUp //refresh our display
>   break
> case "canceled"
> case "cancelled"
>   answer "Purchase Cancelled:" && pProductID
>   mobileStoreDisablePurchaseUpdates
>   break
>   end switch
> end purchaseStateUpdate
>
>
>
> Do you see anything wonky in my code?
>
> --Dan
>
> From: use-livecode  on behalf of
> Andrew at MidWest Coast Media via use-livecode <
> use-livecode@lists.runrev.com>
> Date: Tuesday, August 8, 2023 at 10:57 AM
> To: use-livecode@lists.runrev.com 
> Cc: Andrew at MidWest Coast Media 
> Subject: Re: Consumable In App Purchases on Android
> 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
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Consumable In App Purchases on Android

2023-08-08 Thread Dan Friedman via use-livecode
Andrew,

Thank you for the input.   The code snippet you said you are using has 
mobileStoreConsumePurchase IMMEDIATELY following mobileStoreMakePurchase.  Is 
that what you are doing?   The LC example show that mobileStoreMakePurchase 
should be handled in the purchaseStateUpdate message after the purchase is 
paymentReceived”

If that’s true, then I feel like I’m doing exactly what you are suggesting.   
The purchase is fine, but the consumption if not working for me.   Here’s what 
I’m doing:

on startInAppPurchase numCredits
  //setup purchase id
  if numCredits = 1 then
put 1001 into productID
put "$0.99" into productAmount
  else if numCredits = 2 then
put 1002 into productID
put "$1.99" into productAmount
  else if numCredits = 3 then
put 1003 into productID
put "$2.99" into productAmount
  else if numCredits = 11 then
put 1011 into productID
put "$9.99" into productAmount
  end if

  //confirm with user
  if numCredits = 1 then
put "Are you sure you want to purchase 1 credit for" && productAmount & "?" 
into pString
  else
put "Are you sure you want to purchase" && numCredits && "credits for" && 
productAmount & "?" into pString
  end if
  if myAnswer(pString,"Cancel|Buy Now","Purchase Confirmation","|appBlue") = 
"Cancel" then //my custom answer dialog
exit startInAppPurchase
  end if

  //initiate the purchase
  mobileStoreEnablePurchaseUpdates
  mobileStoreSetProductType productID,"inapp"
  mobileStoreMakePurchase productID,"1","testPayload - Android Only"
end startInAppPurchase

on purchaseStateUpdate pPurchaseID,pProductID,pState
  global user

  switch pState
case "paymentReceived"
  put mobilePurchaseGet(pPurchaseID,"receipt") into rawReciptData

  //tell our server is was sucessful and log users credits to database
  if isIPhone() then
if db_validateAppleReceipt(rawReciptData) then
  add (pProductID-1000) to user["credits"]
end if
  else
//will add Android database call when ready
  end if

  mobileStoreConfirmPurchase pProductID //Inform the store that the 
purchase identifier productID was successfully delivered
  if isAndroid() then
mobileStoreConsumePurchase pProductID. //  <--- DOES NOT SEEM TO 
CONSUME THE PRODUCT !!
  end if

  mobileStoreDisablePurchaseUpdates
  loadMeUp //refresh our display
  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

  loadMeUp //refresh our display
  break
case "canceled"
case "cancelled"
  answer "Purchase Cancelled:" && pProductID
  mobileStoreDisablePurchaseUpdates
  break
  end switch
end purchaseStateUpdate



Do you see anything wonky in my code?

--Dan

From: use-livecode  on behalf of Andrew 
at MidWest Coast Media via use-livecode 
Date: Tuesday, August 8, 2023 at 10:57 AM
To: use-livecode@lists.runrev.com 
Cc: Andrew at MidWest Coast Media 
Subject: Re: Consumable In App Purchases on Android
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 purchaseSta

Re: Consumable In App Purchases on Android

2023-08-08 Thread Andrew at MidWest Coast Media via use-livecode
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 
> Subject: Re: Consumable In App Purchases on Android
> Message-ID:
>   
> 
>   
> 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  on behalf of 
> panagiotis m via use-livecode 
> Date: Tuesday, August 8, 2023 at 9:21 AM
> To: How to use LiveCode 
> Cc: panagiotis m 
> 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 <
> use-livecode@lists.runrev.com> 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
>> use-livecode@lists.runrev.com
>> Pleas

Re: Consumable In App Purchases on Android

2023-08-08 Thread Dan Friedman via use-livecode
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  on behalf of 
panagiotis m via use-livecode 
Date: Tuesday, August 8, 2023 at 9:21 AM
To: How to use LiveCode 
Cc: panagiotis m 
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 <
use-livecode@lists.runrev.com> 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
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Consumable In App Purchases on Android

2023-08-08 Thread panagiotis m via use-livecode
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 <
use-livecode@lists.runrev.com> 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
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Consumable In App Purchases on Android

2023-08-07 Thread Dan Friedman via use-livecode
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
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode