Skip to content

Resetting a consumable purchase does not work correctly #22

@TheMadProf

Description

@TheMadProf

My current game has IAP coin packs which the player can buy.

When the player first buys a coin pack, it works fine.

The second time the player tries to buy the same coin pack, it throws up an error stating the player already owns the product.

The third time the player tries to buy the same coin pack, it works fine.

fv-iap-error-pu89

The above image shows the purchase error on every other attempt by the user.

//	Starts the buying process
InAppPurchaseActivate(iapCoinPackID)

Repeat

        iapStatus = GetInAppPurchaseAvailable2(iapCoinPackID)
        
        Select iapStatus
        
	        //	Cancelled?  The IAP was cancelled by the user
	        Case 0:
		        //	Break out of loop
		        finished = true
	        Endcase
        
	        //	IAP Queued
	        Case 1:
		        Print("IAP in progress..")
	        Endcase
        
	        //	IAP In progress
	        Case 2:
		        Print("IAP in progress..")
	        Endcase
        
	        //	IAP Pending
	        Case 3:
		        Print("IAP in progress..")
	        Endcase
        
	        //	IAP Completed
	        Case 4:
		        //	Award the IAP
        
		        //	Add the relevant amount of coins to the player total
		        Inc player.coinTotal, coinPackAmounts[iapCoinPackID - 1]
		        
		        //	Break out of loop
		        finished = true
		        
		        //	Resets the purchase
		        token = GetInAppPurchaseToken(iapCoinPackID)
		        
		        InAppPurchaseResetPurchase(token)
		        
	        Endcase
        
        EndSelect
        
        sync()

Until finished = true

The above code handles the purchase and resetting of the products. I have tried several different things to try and resolve the issue, moving the InAppPurchaseResetPurchase(token) around and putting it in a loop.

Edit<
I forgot to say this is an issue on Android

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions