The in-app billing order for my app is automatically canceled.
I have “google.iap.billing.v2”
Even if you execute “store.finishTransaction( event.transaction )”, the order is not approved.
Anyone know a solution?
Google play will automatically process the refund in 3 days.
I don’t know how to authorize a purchase.
here is my code
local function transactionCallback( event )
if (event.name == "init" ) and (store.target == "google") then
if ( event.isError ) then
-- alert
end
elseif (event.name == "storeTransaction" ) then
if event.transaction.state == "purchased" or
event.transaction.state == "restored" or
event.transaction.state == "restoreCompleted" then
elseif event.transaction.state == "refunded" then
-- refunded
elseif event.transaction.state == "cancelled" then
print( "Transaction cancelled by user." )
elseif event.transaction.state == "failed" then
print( "Transaction failed." )
else
print( "Unknown event" )
end
--
store.finishTransaction( event.transaction )
end
print("=== finish transactionCallback ===")
end
I’m running the v2 billing and my transactions are finishing just fine. The only difference between your code and mine is this line:
elseif (event.name == "storeTransaction" ) then
Mine looks more like this:
if event.name == "init" then
-- do init stuff
else
if event.transaction then
local transaction = event.transaction
if transaction.state == "purchased" or transaction.state == "restored" then
elseif transaction.state == "cancelled" then
elseif transaction.state == "failed" then
end
store.finishTransaction( transaction )
end
end
So I’m not looking for an event.name, just if there is a transaction. And I always call finishTransaction on it, no matter that state.