Skip to content

Obtain the amount of the internal purchase item corresponding to the current region. ​

effect ​

If you need to display the amount and currency of the current region for in-game items, call this interface to obtain the amount and currency of the current region currency corresponding to the currently configured internal purchase item.


Function ​

objective-c
-(void)getLocalGoodsInfoV2:(void (^)(NSDictionary * _Nullable info, NSError * _Nullable error))callback;

Correction ​

Parameter nameEmpty (Yes/No)explain
infoYesinfo is a dictionary; its key is the price tier, and its value is the corresponding price information. For example: @{ @"0.99" : { @"amount" : @"8" , @"currency" : @"HKD",@"currencySymbol": @"HK$", @"formattedPrice" : @"HK$8" } }
errorYesError message

Key is the price tier ​

Parameter nameEmpty (Yes/No)explain
{priceKey}NoThe price tier for the in-app purchase item, for example, 0.99. Its value is a dictionary containing the price information shown below.

Value is the corresponding price information ​

Parameter nameEmpty (Yes/No)explain
amountNoThe numeric amount from the store, without a currency symbol, currency code, thousands separators, or spaces. The decimal point is always . and insignificant trailing zeros are removed.
currencyNoThe ISO 4217 currency code returned by the store, such as TWD, HKD, or USD. Use this field to identify the currency; do not infer it from symbols such as $.
currencySymbolNoA common currency symbol obtained from the device Locale. It may be displayed as $, NT$, or TWD depending on the language, region, and system version, and is not guaranteed to exactly match the symbol in formattedPrice.
formattedPriceNoThe complete localized price ready to display, including the store-selected currency symbol, amount, decimal digits, grouping separators, and symbol position. Do not parse amount or currencySymbol from this field.

Usage recommendations ​

  • When displaying a price directly in the UI, use formattedPrice first.
  • When you need to arrange the amount and symbol yourself, use amount and currencySymbol, but handle the symbol position and spacing yourself. Do not assume that the symbol always appears before the amount.
  • When identifying or recording the currency, use currency. Do not determine the currency from currencySymbol.
  • Do not use the outer price tier as the product ID.
  • If the callback fails, using USD as a fallback is recommended.

Example code ​

objective-c
    [[GamedreamerManager shareInstance] getLocalGoodsInfoV2:^(NSDictionary * _Nullable info, NSError * _Nullable error) {
        if (error) {
            NSLog(@"错误信息:%@",error);
        } else {
            NSLog(@"品项本地化价格信息:%@",info);
        }
    }];