Difference between revisions of "FBInstant.payments.purchaseAsync"
From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>") |
|||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | '''Available since:''' Gideros 2018.3<br/> | + | <languages /> |
− | === Description === | + | '''<translate>Available since</translate>:''' Gideros 2018.3<br/> |
− | <br /> | + | '''<translate>Class</translate>:''' [[Special:MyLanguage/Payments|Payments]]<br/> |
+ | === <translate>Description</translate> === | ||
+ | <translate><br /> | ||
Begins the purchase flow for a specific product.<br /> | Begins the purchase flow for a specific product.<br /> | ||
− | <br /> | + | <br /></translate> |
− | < | + | <syntaxhighlight lang="lua"> |
FBInstant.payments.purchaseAsync(purchaseConfig,callback) | FBInstant.payments.purchaseAsync(purchaseConfig,callback) | ||
− | </ | + | </syntaxhighlight> |
− | === Parameters === | + | === <translate>Parameters</translate> === |
− | '''purchaseConfig''': (table) The purchase's configuration details. <br/> | + | '''purchaseConfig''': (table) <translate>The purchase's configuration details.</translate> <br/> |
− | '''callback''': (function) A function that will be called with two arguments: True when the product is successfully purchased by the player. Otherwise, it rejects if the operation failed, and an error code if the function failed. <br/> | + | '''callback''': (function) <translate>A function that will be called with two arguments: True when the product is successfully purchased by the player. Otherwise, it rejects if the operation failed, and an error code if the function failed.</translate> <br/> |
− | === Examples === | + | === <translate>Examples</translate> === |
'''Example 1'''<br/> | '''Example 1'''<br/> | ||
− | < | + | <syntaxhighlight lang="lua"> |
FBInstant.payments.purchaseAsync({productID="12345", developerPayload="foobar"}, function(result,error) | FBInstant.payments.purchaseAsync({productID="12345", developerPayload="foobar"}, function(result,error) | ||
if result then | if result then | ||
Line 22: | Line 24: | ||
end | end | ||
end) | end) | ||
− | <br/></ | + | <br/></syntaxhighlight> |
'''Example 2'''<br/> | '''Example 2'''<br/> | ||
− | < | + | <syntaxhighlight lang="lua"> |
FBInstant.payments.purchaseAsync({productID="12345", developerPayload="foobar"}, function(result,error) | FBInstant.payments.purchaseAsync({productID="12345", developerPayload="foobar"}, function(result,error) | ||
if result then | if result then | ||
Line 36: | Line 38: | ||
end | end | ||
end) | end) | ||
− | <br/></ | + | <br/></syntaxhighlight> |
+ | |||
+ | {{FBInstant.payments}} |
Latest revision as of 14:29, 13 July 2023
Available since: Gideros 2018.3
Class: Payments
Description
Begins the purchase flow for a specific product.
FBInstant.payments.purchaseAsync(purchaseConfig,callback)
Parameters
purchaseConfig: (table) The purchase's configuration details.
callback: (function) A function that will be called with two arguments: True when the product is successfully purchased by the player. Otherwise, it rejects if the operation failed, and an error code if the function failed.
Examples
Example 1
FBInstant.payments.purchaseAsync({productID="12345", developerPayload="foobar"}, function(result,error)
if result then
print("Purchased!")
for key,value in pairs(result) do
print(key,value)
end
end
end)
<br/>
Example 2
FBInstant.payments.purchaseAsync({productID="12345", developerPayload="foobar"}, function(result,error)
if result then
print("Purchased!")
print("developer string",result.developerPayload)
print("payment id",result.paymentID)
print("product id",result.productID)
print("purchaseTime",result.purchaseTime)
print("puchaseToken",result.purchaseToken)
print("signedRequest",result.signedRequest)
end
end)
<br/>