adaptyteam / AdaptySDK-Flutter

SDK for growing mobile in-app purchases
https://docs.adapty.io/docs/quickstart
MIT License
88 stars 15 forks source link

On Android regionCode: null, but currencyCode is recognized #95

Closed tiyberius closed 10 months ago

tiyberius commented 10 months ago

Flutter Version Details

Flutter 3.10.5 • channel stable • https://github.com/flutter/flutter.git Framework • revision 796c8ef792 (3 months ago) • 2023-06-13 15:51:02 -0700 Engine • revision 45f6e00911 Tools • Dart 3.0.5 • DevTools 2.23.1

Adapty SDK Details

adapty_flutter: ^2.6.2

Issue Details

I am successfully retrieving paywall products in my iOS and Android app, but I'm getting a different value for "localizedTtitle" for both platforms. I think it might have something to do with regionCode being null on Android.

On iOS, both the local currency AND the region code are recognized and they match, as expected.

However on Android, Adapty is recognizing the correct local currency, but the regionCode is null.

Please see the product data that I'm retrieving from Adapty on iOS vs. the product data that I'm retrieving from Adapty on Android:

iOS (recognizes region code and currency)

(
    vendorProductId: adapty.1year_sub,
    localizedDescription: Billed Once Per Year,
    localizedTitle: Annual, 
    regionCode: NZ, 
    isFamilyShareable: false, 
    paywallVariationId: ----------------------------------, 
    paywallABTestName: Mobile App Paywall, 
    paywallName: Mobile App Paywall, 
    price: (
        amount: 49.99, 
        currencyCode: NZD, 
        currencySymbol: $, 
        localizedString: $49.99
    ),
    subscriptionDetails: (
        subscriptionGroupIdentifier: -------, 
        subscriptionPeriod: (
            unit: AdaptyPeriodUnit.year,
            numberOfUnits: 1
        ),
        localizedSubscriptionPeriod: 1 year, 
        introductoryOffer: [], 
        promotionalOffer: null, 
        androidOfferId: null, 
        androidBasePlanId: null, 
        androidOfferTags: [], 
        renewalType: AdaptyRenewalType.autorenewable, 
        _androidIntroductoryOfferEligibility: null
    )
)

Android (currency is recognized as NZ, but region code is null)

(
    vendorProductId: adapty.yearly.premium, 
    localizedDescription: , 
    localizedTitle: Annual Subscription (<PRODUCT_NAME>), 
    regionCode: null, 
    isFamilyShareable: false, 
    paywallVariationId: -------------------, 
    paywallABTestName: Mobile App Paywall, 
    paywallName: Mobile App Paywall, 
    price: (
        amount: 59.99, 
        currencyCode: NZD, 
        currencySymbol: $, 
        localizedString: $59.99
    ), 
    subscriptionDetails: (
        subscriptionGroupIdentifier: null, 
        subscriptionPeriod: (
            unit: AdaptyPeriodUnit.year,
            numberOfUnits: 1
        ), 
        localizedSubscriptionPeriod: 1 year, 
        introductoryOffer: [], 
        promotionalOffer: null, 
        androidOfferId: null,
        androidBasePlanId: adapty-yearly-base-plan-test, 
        androidOfferTags: [], 
        renewalType: AdaptyRenewalType.autorenewable, 
        _androidIntroductoryOfferEligibility: AdaptyEligibility.ineligible
    )
)

Ultimately, I should be able to set the localizedTitle in the Play Store, but I haven't found where I can set it. However even if I do set it, shouldn't the regionCode match the price currencyCode?

tiyberius commented 10 months ago

Okay, for anyone else having trouble with this, I mostly figured out where localizedTitle is coming from when using Adapty in conjunction with the Google Play Store. If you go to the Play Console and go to your app, then go to "Monetize -> Products -> Subscriptions" then click on the subscription you want to change the localizedTitle for, then hit "Edit Subscription Details" and change the "Name" field.

HOWEVER, Adapty will not be aware of this update (as it is probably cached) and simply re-loading the paywall did not reflect those changes (for me, at the time of this writing).

In order to refresh this name when showing the paywall to have it accurately reflect what you set in the Google Play Store, you'll have to go into the Adapty console, head to "Paywalls & Products" then click "Products", then edit a product, click "Google Play" and remove the information about the product like Google Play Product ID, Base Plan ID, and Legacy fallback product, then hit save. Go back into the product and then add the information back as it once was, hit "Save" and then Adapty will pull down the new name.

For me, this also included pricing changes that I made in the Google Play Store not being reflected in the Adapty paywall.

vladd-g commented 10 months ago

hi @tiyberius

you are right, localizedTitle comes from App Store and Google Play as is, from the correspondent fields, we don't modify them in any way