Configure Purchase Handling
This is a synchronous function which allows you to control how purchases are handled when a successful transaction comes through.
The only parameter is a function which allows you to communicate with the plugin to provide information about how you would like to handle purchases. At this point in time, the only influence you have is whether or not to consume an in-app purchase, ultimately defining products as consumables or non-consumables. Non-consumable products cannot be purchased again on the same Google account used to make the purchase.
This function will be called for every successfully completed transaction, including when pending transactions complete. Be sure to set this function up at the begining of your application before using Check for Purchases or Launch Billing Flow blueprint nodes.
If this blueprint node is not used, all in-app purchases will default as consumables.
NOTE: Do not use this blueprint node as a way of determining successfully completed transactions as there can still be issues when acknowledging transactions. You should use the Check for Purchases or Launch Billing Flow blueprint nodes' success/failure delegates to determine when to grant your users rights to their purchase.
Purchase Handler
This is a delegate which has one Purchase object as an input and requires one boolean return value indicating whether or not to consume the purchase. The Purchase object parameter is the Purchase which has successfully gone through and is about to be acknowledged. The boolean return value indicates whether to consume the purchase or not, ultimately defining it as a consumable or non-consumable item.
NOTE: When dragging off this pin to create a function, you need to use the Event Dispatchers dropdown and then select the Create Event option. Once this option is selected, it will create a blueprint node to create an event, you can then use its dropdown to [Create a matching function] with the matching function signature.
Example
The most common use-case for a non-consumable is an option to purchase the ability to remove all ads from your application. In this example, we have multiple consumable products along with one non-consumable product to remove ads from your application.
Once you have created your Purchase Handler function, we will wire it up so that it checks if there exists a product-id of "remove_ads" which would be setup in the Google Play Console.