Difference between revisions of "FBInstant.payments.getCatalogAsync"

From GiderosMobile
Line 8: Line 8:
 
  FBInstant.payments.getCatalogAsync(callback)
 
  FBInstant.payments.getCatalogAsync(callback)
 
</source>
 
</source>
'''callback''': (function) A function that will be called with two arguments: a set of key-value pairs that are the products that are registered to the game or nil if the operation failed, and an error code if the function failed. ''''''<br/>
+
=== Parameters ===
 +
'''callback''': (function) A function that will be called with two arguments: a set of key-value pairs that are the products that are registered to the game or nil if the operation failed, and an error code if the function failed. <br/>
 +
=== Examples ===
 +
'''Example 1'''<br/>
 +
<source lang="lua"><br />
 +
FBInstant.payments.getCatalogAsync(function(result,error)
 +
    if result then
 +
for key,value in pairs(result) do
 +
print(key,value)
 +
end
 +
end
 +
end)
 +
<br/></source>
 +
'''Example 2'''<br/>
 +
<source lang="lua"><br />
 +
FBInstant.payments.getCatalogAsync(function(result,error)
 +
    if result then
 +
for loop=1,#result do
 +
local p=result[loop]
 +
print("title,id,description,umage,price,currency",p.title,p.productID,p.description,p.imageURI,p.price,p.priceCurrencyCode)
 +
end
 +
end
 +
end)
 +
<br/></source>

Revision as of 11:40, 23 August 2018

Available since: Gideros 2018.3

Description


Fetches the game's product catalog.

 FBInstant.payments.getCatalogAsync(callback)

Parameters

callback: (function) A function that will be called with two arguments: a set of key-value pairs that are the products that are registered to the game or nil if the operation failed, and an error code if the function failed.

Examples

Example 1

<br />
FBInstant.payments.getCatalogAsync(function(result,error)
    if result then
		for key,value in pairs(result) do
			print(key,value)
		end
	end
end)
<br/>

Example 2

<br />
FBInstant.payments.getCatalogAsync(function(result,error)
    if result then
		for loop=1,#result do
			local p=result[loop]
			print("title,id,description,umage,price,currency",p.title,p.productID,p.description,p.imageURI,p.price,p.priceCurrencyCode)
		end
	end
end)
<br/>