Android In App Billing Issue (SOLVED)

I’m not sure what’s causing the issue you are seeing and I’m not even sure you can trigger more than one purchase dialog at a time, but one thing that is always good practice when you read user input in your UI code is to trigger the action when you see action.released (ie when the user releases the finger from the screen or key). I am in the code below assuming that you initialise the purchase when the user taps on a GUI box node named “purchase_button” in your game:

function on_input(self, action_id, action)
	if action.released and gui.pick_node(gui.get_node("purchase_button"), action.screen_x, action.screen_y) then
		iap.set_listener(function(self, transaction, error)
			if not error then
				print(transaction.ident)
				print(transaction.state)
				print(transaction.date)
				print(transaction.trans_ident) -- only available when state == TRANS_STATE_PURCHASED, TRANS_STATE_UNVERIFIED or TRANS_STATE_RESTORED
				print(transaction.receipt)     -- only available when state == TRANS_STATE_PURCHASED or TRANS_STATE_UNVERIFIED
				print(transaction.request_id)  -- only available for Facebook IAP transactions (and if used in the iap.buy call parameters)
				print(transaction.user_id)     -- only available for Amazon IAP transactions

				-- required if auto finish transactions is disabled in project settings
				if (transaction.state == iap.TRANS_STATE_PURCHASED) then
					-- do server-side verification of purchase here..
					iap.finish(self, transation)
				end
			else
				print(error.error, error.reason)
			end
		end)
		iap.buy("product_id")
	end
end
2 Likes