Using In-App Purchases

In-app purchases enable you to offer additional content and features to players. This can be used as a means of monetizing a free-to-play game or providing additional paid content for your game.

Configuration

See the apropriate platform-specific page below for details on configuring in-app purchases for each platform:

Reading Purchase Information

image alt text

You can read the in-app purchase information using the Read In-App Purchase Information Blueprint node (or associated C++ function call). Like most other online subsystems functions, it takes a Player Controller as input, as well as an array of your product identifiers. Note that Make In-App Purchase below takes a single identifier, while Read can process an array of information. The function returns an array of In App Purchase structs, and each element of the array can be broken out to get the name, description, price, and other data to display in your UI or use in your gameplay logic.

Completing a Purchase

image alt text

To make an in-app purchase, use the Make an In-App Purchase Blueprint node (or associated C++ function call). It takes the Player Controller as input, as well as a Product Request struct. A Product Request is just the product identifier from iTunes Connect or the Google Play Developer console (in this case, match3theme_night), as well as whether or not the product is consumable.

The Make an In-App Purchase node is latent, so any gameplay behavior you want to have rely on whether the purchase succeeds or fails should use those two execution pins. They will only execute after a response has come back from the online service. The node also returns the completion status of the purchase (such as Success, Failed, Restored) and the detailed In App Purchase Information struct.

There is a non-latent version of this function (the Blueprint node will display without the clock). The exit execution pin here does not wait for a response from the online service, and you will generally want to use the latent version.

Restoring Purchases

image alt text

To restore purchases, use the Restore In-App Purchases Blueprint node (or associated C++ function call). It only takes in the Player Controller, and returns an array of all the purchase information associated with that Player Controller. You can then process that array to compare against the particular Identifier (or Identifiers) that your gameplay logic needs.

Tags