SnakeULTIMATE
Member
Before i update on 2.3 InnApps working fine. After GMS update on Android InnApps working but on iOS it says everything is fine, but no award is awarded. I use tutorial code.
GML:
var _eventId = async_load[? "id"];
switch (_eventId)
{
case ios_product_update:
// Decode the returned JSON
var _json = async_load[? "response_json"];
var _map = json_decode(_json);
var _plist = _map[? "valid"];
var _sz = ds_list_size(_plist);
// Loop through all valid products and store any data that you require
for (var i = 0; i < _sz; ++i;)
{
var _pmap = _plist[| i];
var _num = 0;
while(_pmap[? "productId"] != global.ProductID[_num, 0])
{
++_num;
}
global.ProductID[_num, 1] = _pmap[? "price"];
global.ProductID[_num, 2] = _pmap[? "localizedDescription"];
global.ProductID[_num, 3] = _pmap[? "localizedTitle"];
}
// Parse any invalid responses here if required
ds_map_destroy(_map);
// Check previous purchases with your server or from
// a local secure file and enable features as required
// and then query on-going purchases here
break;
case ios_payment_queue_update:
// Decode the returned JSON
var _json = async_load[? "response_json"];
if _json != ""
{
var _map = json_decode(_json);
var _plist = _map[? "purchases"];
var _sz = ds_list_size(_plist);
// loop through purchases
for (var i = 0; i < _sz; ++i;)
{
var _pmap = _plist[| i];
var _ptoken = _pmap[? "purchaseToken"];
// Check purchases
if _pmap[? "purchaseState"] != ios_purchase_failed
{
var _receipt = ios_iap_GetReceipt();
// CALL SERVER CHECK WITH RECEIPT HERE
// or validate, award the product, and finalise
if ios_iap_ValidateReceipt() == true
{
var _num = 0;
while(_pmap[? "productId"] != global.ProductID[_num, 0])
{
++_num;
}
switch (_num)
{
case 0: buy_1(); break;
case 1: buy_2(); break;
}
// Securely save the details to a file
// or save them to your server
ios_iap_FinishTransaction(_ptoken);
}
else
{
// Validation failed, so deal with it here
// We still need to finalise the transaction
ios_iap_FinishTransaction(_ptoken);
}
}
else
{
var _ptoken = _pmap[? "purchaseToken"];
// Purchase failed, so finalise it
ios_iap_FinishTransaction(_ptoken);
}
ds_map_destroy(_pmap);
}
ds_map_destroy(_map);
}
break;
}
var _json = ios_iap_QueryPurchases();
if _json != ""
{
var _map = json_decode(_json);
var _plist = _map[? "purchases"];
var _sz = ds_list_size(_plist);
// loop through purchases
for (var i = 0; i < _sz; ++i;)
{
var _pmap = _plist[| i];
var _ptoken = _pmap[? "purchaseToken"];
// Check purchases
if _pmap[? "purchaseState"] != ios_purchase_failed
{
var _receipt = ios_iap_GetReceipt();
// CALL SERVER CHECK WITH RECEIPT HERE
// or validate, award the product, and finalise, as shown below
if ios_iap_ValidateReceipt() == true
{
var _num = 0;
while(_pmap[? "productId"] != global.ProductID[_num, 0])
{
++_num;
}
switch (_num)
{
case 0: buy_1(); break;
case 1: buy_2(); break;
}
// Securely save the details to a file
// or save them to your server
ios_iap_FinishTransaction(_ptoken);
}
else
{
// Validation failed, so deal with it here
// You still need to finalise the transaction
ios_iap_FinishTransaction(_ptoken);
}
}
else
{
var _ptoken = _pmap[? "purchaseToken"];
// Purchase failed, so finalise it
ios_iap_FinishTransaction(_ptoken);
}
ds_map_destroy(_pmap);
}
ds_map_destroy(_map);
}