Difference between revisions of "FBInstant.payments.getPurchasesAsync"
From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>") |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
+ | <languages /> | ||
'''<translate>Available since</translate>:''' Gideros 2018.3<br/> | '''<translate>Available since</translate>:''' Gideros 2018.3<br/> | ||
+ | '''<translate>Class</translate>:''' [[Special:MyLanguage/Payments|Payments]]<br/> | ||
=== <translate>Description</translate> === | === <translate>Description</translate> === | ||
<translate><br /> | <translate><br /> | ||
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.<br /> | 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.<br /> | ||
<br /></translate> | <br /></translate> | ||
− | < | + | <syntaxhighlight lang="lua"> |
FBInstant.payments.getPurchasesAsync(callback) | FBInstant.payments.getPurchasesAsync(callback) | ||
− | </ | + | </syntaxhighlight> |
=== <translate>Parameters</translate> === | === <translate>Parameters</translate> === | ||
'''callback''': (function) <translate>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.</translate> <br/> | '''callback''': (function) <translate>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.</translate> <br/> | ||
=== <translate>Examples</translate> === | === <translate>Examples</translate> === | ||
'''Example'''<br/> | '''Example'''<br/> | ||
− | < | + | <syntaxhighlight lang="lua"> |
FBInstant.payments.getPurchasesAsync(function(result,error) | FBInstant.payments.getPurchasesAsync(function(result,error) | ||
if result then | if result then | ||
Line 24: | Line 26: | ||
end | end | ||
end) | end) | ||
− | <br/></ | + | <br/></syntaxhighlight> |
+ | |||
+ | {{FBInstant.payments}} |
Latest revision as of 14:27, 13 July 2023
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.
FBInstant.payments.getPurchasesAsync(callback)
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
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)
<br/>