FBInstant.payments.getPurchasesAsync

From GiderosMobile
Revision as of 15:26, 13 July 2023 by Hgy29 (talk | contribs) (Text replacement - "<source" to "<syntaxhighlight")


Available since: Gideros 2018.3
Class: Payments

Description


Fetches all of the player's unconsumed purchases. As a best practice, the game should fetch the current player's purchases as soon as the client indicates that it is ready to perform payments-related operations. The game can then process and consume any purchases that are waiting to be consumed.

<syntaxhighlight lang="lua">

FBInstant.payments.getPurchasesAsync(callback)

</source>

Parameters

callback: (function) A function that will be called with two arguments: a set of key-value pairs that purchases that the player has made for the game or nil if the operation failed, and an error code if the function failed.

Examples

Example
<syntaxhighlight lang="lua"> FBInstant.payments.getPurchasesAsync(function(result,error)

   if result then

print("Unconsumed purchases:",#result) for loop=1,#result do local item=result[loop] for key,value in pairs(item) do print(key,value) end end end end)
</source>