iap_purchase_details (Deprecated)


With this function you can populate a previously created ds_map with a number of key/value pairs that describe the purchase details of the given product. The following data is returned within the map:

The map will also contain one further key, "status", which can be use to check the current status of the purchase. This key will have one of the following constants as it's value:

Constant Description
iap_available Product is available or the game is waiting for the result of a purchase.
iap_failed The purchase attempt failed.
iap_purchased The product was successfully purchased.
iap_canceled The user cancelled the purchase.
iap_refunded The purchase has been rescinded.

The following notes are related to the "token" and "receipt" keys of the map returned in reference to the target store being used:

  1. For the Amazon Store the purchase "token" and "receipt" entries are treated as one and the same.

  2. For Google Play there is no "receipt" data and you are expected to verify purchases via the returned "payload" (should you be verifying via a payload it is recommended that you do not use hard coded values). GameMaker Studio 2 will still verify the data signature returned with a purchase by Google Play against the public key provided in the IAP tab of the Game Options.

  3. For Google Play the "token" provided with a purchase is intended for use with consuming purchases.

  4. For iOS and MacOS target stores there is "receipt" data available for purchases but the associated "token" is generated internally for developer purposes.
NOTE: The ds_map used is not created by the function, meaning that you must create it previously and remove it again from memory when not in use using the appropriate function.


iap_purchase_details(product_id, ds_map);

Argument Description
product_id The product ID string for the purchase.
ds_map The ds_map that will store the purchase information.




var p_map = ds_map_create();
var p_index = ds_map_find_value(iap_data, "index");
iap_purchase_details(p_index, p_map);
if ds_map_find_value(p_map, "status") == iap_purchased
    global.Gold += 100000;

The above code will create a ds_map and then populate it with the key/value pairs for the purchase with the product ID stored in the variable "p_index", which we get from the special iap_data ds_map which is created exclusively in the IAP Event. If the "status" key returns the constant iap_purchased, it will then set a global variable.