The OnPurchaseUpdated Event
After an app store accepts a purchase request that has been made via the Purchase action, it sends information about the accepted purchase to the app. This information is stored in a Purchase element of the \$MT_IN-APP_PURCHASE page source. After this information has been received from the app store, you would most likely need to carry out certain actions. It is to enable the possibility of triggering actions automatically upon receiving such "purchase-accepted" information from the app store, that the OnPurchaseUpdated event has been created. To set up actions that are triggered by this event, go to the project property In-App Purchase Actions, which opens the Actions dialog for the OnPurchaseUpdated event.
In our example, we have defined two actions to be carried out automatically upon receiving a "purchase-accepted" response from the app store:
•Re-count the number of purchases and update the count that is displayed in the app.
•Send an app-side acknowledgment of the in-app purchase to the app store. An acknowledgment is commonly required by app stores to complete the transaction and forward to the product vendor the money that was paid for the product. In the design, you can acknowledge an in-app purchase by specifying an Acknowledge Purchase action.
The screenshot above shows the OnPurchaseUpdated actions that have been defined in our example project. The acknowledgments have been made conditional on the specific product because (i) consumables and (ii) subscriptions/non-consumables require different types of acknowledgment.
|You might need to modify the actions above to suit different app store requirements.