Payments Code Blocks
Product Block
The Product Code Block, which can be found in Payments - In-App Purchases -> In-App Purchases Actions is used by the Purchase actions to define which Product will execute the action, for example, which Product to initiate the purchase.
Tip: You can use the dropdown to change between available products, that you have already added in Manage products.
Actions
Is Product Cached as Purchased
You can use this Code Block to check if the provided Product has already been marked as purchased in the current device. This action is not using Apple servers and only checks if the Product is locally cached as purchased.
Note: A product could be cached as not purchased if the user has reinstalled the application, or purchased it on a different device. User will need to use the Restore Purchases Button or the Restore Purchases Code Block.
Example
In the example, the user will be navigated to Main Screen if has already purchased the Monthly subscription, else Payments Screen will be presented.
Get Product Details
You can use this block to fetch the latest details of the selected Product from Apple. You can then use the fetched product and connect it to the Product Details Code Blocks to display its info.
Example
In the example, the Monthly Subscription details will be fetched, and then its price will be displayed in the Price Label.
Get Multiple Product Details
Similar to Get Product Details Code Block, you can use this block to fetch multiple products simultaneously.
Buy Product
Buy Product, similar to the Buy Button, can be used for your user to purchase the selected Product. In the success, canceled, and errored section, you can add more Blocks to define each result’s action.
Example
In the example, the user will initiate a purchase for Monthly Subscription, and if the purchase is successful, Label will change its text to Thank you!
and the user will be navigated to Main Screen.
Check Online if Product is Purchased
You can use this Code Block in order to validate using Apple’s servers if a product is still purchased.
Check without Apple if Products are still purchased
You can use this Code Block in order to validate by accessing only the cached In-App Purchases Receipt if a product is still purchased.
Restore Purchases
You can use this Code Block to initiate a Restore Purchases action.
Tip: It is easier to use the Restore Purchases Button.
Product Details
You can use the Code Blocks from this section with a fetched product from the Get Product Details Code Block.
Get Displayable Price with Currency
Returns product’s price (including the currency symbol) in the device’s locale format.
Get Displayable Subscription Period
Returns product’s subscription period in a human-readable format.
Get IAP Product Id
Returns the In-App Purchase product id, which has been set in App Store Connect and Manage Products.
Get Is Subscription
Returns true, if the fetched Product is of Subscription type.
Get Name
Returns the Name of the fetched Product.
Get Price Currency Symbol
Returns only the currency symbol in the device’s locale.
Get Price Value
Returns only the Price numeric value without the currency symbol.
Get Product Description
Returns the Product Description of the fetched Product. You can define this value in App Store Connect before the release of the application.
Get Product Unique Id
Returns the Product Unique Id to use it in In-App Purchase Actions Code Blocks.