Android / Amazon Fire [Resolved by St. Nicolas] Can't get right IAP price from Google

Moar.Of.Me

Member
In my game I sell Stars and Hints via IAPs. I want the prices in my store to show the actual price from my google account. For some reason the code works just fine for Stars but fails on Hints.

I am testing IAP dots_universe_hints_3

Here are the screenshots of my Google Dev Console IAP page:
all_iaps.jpg

Here are the settings of the test Hints IAP:
console_page.jpg

To initialize IAPs in the game I use the following code:
Code:
global.purchaseMap = ds_map_create();

ds_map_add(global.purchaseMap, "dots_universe_stars_1", 0);
ds_map_add(global.purchaseMap, "dots_universe_stars_2", 0);
ds_map_add(global.purchaseMap, "dots_universe_stars_3", 0);
ds_map_add(global.purchaseMap, "dots_universe_stars_4", 0);

ds_map_add(global.purchaseMap, "dots_universe_hints_1", 0);
ds_map_add(global.purchaseMap, "dots_universe_hints_2", 0);
ds_map_add(global.purchaseMap, "dots_universe_hints_3", 0);
ds_map_add(global.purchaseMap, "dots_universe_hints_4", 0);

ds_map_secure_save(global.purchaseMap, "iap_data.json");

var productList = ds_list_create()

var stars_1  = ds_map_create()
ds_map_add(stars_1, "id", "dots_universe_stars_1");
ds_map_add(stars_1, "title", "3000 Stars");
ds_list_add(productList, stars_1);

var stars_2  = ds_map_create()
ds_map_add(stars_2, "id", "dots_universe_stars_2");
ds_map_add(stars_2, "title", "7000 Stars");
ds_list_add(productList, stars_2);

var stars_3  = ds_map_create()
ds_map_add(stars_3, "id", "dots_universe_stars_3");
ds_map_add(stars_3, "title", "15000 Stars");
ds_list_add(productList, stars_3);

var stars_4  = ds_map_create()
ds_map_add(stars_4, "id", "dots_universe_stars_4");
ds_map_add(stars_4, "title", "30000 Stars");
ds_list_add(productList, stars_4);

var hints_1  = ds_map_create()
ds_map_add(hints_1, "id", "dots_universe_hints_1");
ds_map_add(hints_1, "title", "10 Hints");
ds_list_add(productList, hints_1);

var hints_2  = ds_map_create()
ds_map_add(hints_2, "id", "dots_universe_hints_2");
ds_map_add(hints_2, "title", "25 Hints");
ds_list_add(productList, hints_2);

var hints_3  = ds_map_create()
ds_map_add(hints_3, "id", "dots_universe_hints_3");
ds_map_add(hints_3, "title", "60 Hints");
ds_list_add(productList, hints_3);

var hints_4  = ds_map_create()
ds_map_add(hints_4, "id", "dots_universe_hints_4");
ds_map_add(hints_4, "title", "150 Hints");
ds_list_add(productList, hints_4);

iap_activate(productList);

ds_map_destroy(stars_1);
ds_map_destroy(stars_2);
ds_map_destroy(stars_3);
ds_map_destroy(stars_4);

ds_map_destroy(hints_1);
ds_map_destroy(hints_2);
ds_map_destroy(hints_3);
ds_map_destroy(hints_4);

ds_list_destroy(productList);

To update ingame store prices I use this code (in the same object's assync iap event):
Code:
if iap_data[? "type"] == iap_ev_product
{
    var product_details = ds_map_create()
    iap_product_details(iap_data[? "index"], product_details)
    scr_ds_map_print(product_details)
    
        
    if true
    {
        var product_id = product_details[? "id"]
        product_id = string_delete(product_id,1,14)   
        var price = string_digits(product_details[? "price"])
        price = int64(price) / 100
        
        ////////////////
        //  проверка на undefined
        ////////////////

        ini_open("Main Files\\Settings.ini")
        ini_write_string("Prices",product_id,price)
        ini_close()
        
        switch (product_id){
            case "stars_1":
                global.shop_stars_1_price = price
                break;   
                
            case "stars_2":
                global.shop_stars_2_price = price
                break;   
                
            case "stars_3":
                global.shop_stars_3_price = price
                break;       
                
            case "stars_4":
                global.shop_stars_4_price = price
                break;   
                
            case "hints_1":
                global.shop_hints_1_price = price
                break;   
                
            case "hints_2":
                global.shop_hints_2_price = price
                break;   
                
            case "hints_3":
                global.shop_hints_3_price = price
                break;   
                
            case "hints_4":
                global.shop_hints_4_price = price
                break;       
        }        
        ds_map_destroy(product_details)
    }
}

Here's the code to draw the prices in store's Draw event:
Code:
draw_text_transformed(x + sprite_half*ss - border*ss, y + btn_1_mid*ss - sh*ss,global.shop_hints_1_price,ss*ps,ss*ps,0)
draw_text_transformed(x + sprite_half*ss - border*ss, y + btn_2_mid*ss - sh*ss,global.shop_hints_2_price,ss*ps,ss*ps,0)
draw_text_transformed(x + sprite_half*ss - border*ss, y + btn_3_mid*ss - sh*ss,global.shop_hints_3_price,ss*ps,ss*ps,0)
draw_text_transformed(x + sprite_half*ss - border*ss, y + btn_4_mid*ss - sh*ss,global.shop_hints_4_price,ss*ps,ss*ps,0)

draw_text_transformed(x + sprite_half*ss - border*ss, y + btn_1_mid*ss + sh*ss,global.shop_currency,ss*ps,ss*ps,0)
draw_text_transformed(x + sprite_half*ss - border*ss, y + btn_2_mid*ss + sh*ss,global.shop_currency,ss*ps,ss*ps,0)
draw_text_transformed(x + sprite_half*ss - border*ss, y + btn_3_mid*ss + sh*ss,global.shop_currency,ss*ps,ss*ps,0)
draw_text_transformed(x + sprite_half*ss - border*ss, y + btn_4_mid*ss + sh*ss,global.shop_currency,ss*ps,ss*ps,0)


But for some reasons in my game I have this:
screenshots.jpg

Star prices are Ok, while Hint prices are messed up. But when I click the button to buy 60 hints I have the correct price, the one I've set in the console.

Here's the console output for that scr_ds_map_print(product_details) method. It get's the id, title and description right while the price is not the one set in the console. It looks like the old price I've used before but I can't find any trace of it in Google Console.
Code:
I/yoyo    ( 9121):   DS Map: 6

I/yoyo    ( 9121):   Size: 6

I/yoyo    ( 9121):   {

I/yoyo    ( 9121):       price       : UAH 124.99

I/yoyo    ( 9121):       title       : 60 Hints (Dots Universe - Connect dots, find hidden pictures)

I/yoyo    ( 9121):       id          : dots_universe_hints_3

I/yoyo    ( 9121):       type        : inapp

I/yoyo    ( 9121):       description : 60 hints for Dots Universe

I/yoyo    ( 9121):       verified    : 1

I/yoyo    ( 9121):   }

What could cause this kind of behavior?
 

Moar.Of.Me

Member
Nevermind... The game is fine now. For some reason ingame prices are correct now. Somehow it happened overnight. I made a YYC build and tested it just to see the issue was still there. Launched the game in the morning - prices are fine. It could be a present from St. Nicolas... Thank you, I guess...

Or it could be just another one of those issues which can be cured by just waiting it to resolve itself.
 
Top