Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | hamza_memon |
I have a game in which a user can buy different amounts of gold as consumable item.
I am confused as of what to do after i initiate var purchase = IAP.purchase['1000_gold]
What I am trying to ask is -
Where does the flow go after .purchase in the previous plug in it was a callback `_on_purchase_success _on_purchase_failed` etc.
I want to set it to consume and add it to a dictionary for gold, I am thinking of doing this in `_on_purchase_aknowledged`
func _on_purchase_acknowledged(purchase_token):
`print("Purchase acknowledged: %s" % purchase_token)`
`var query = payment.queryPurchases("inapp") # Or "subs" for subscriptions`
`if query.status == OK:`
`for purchase in query.purchases:`
`if purchase.sku == "1000chips":`
if !purchase.is_acknowledged:
payment.consumePurchase(purchase.purchase_token)
And in purchase_consumed callback
func _on_purchase_consumed(purchase_token):
`print("Purchase consumed successfully: %s" % purchase_token)`
`ChipsManager.chips_info['chips'] += int(1000)`
`ChipsManager.save_data()`
Is this right? Can anyone help?