purchases-android icon indicating copy to clipboard operation
purchases-android copied to clipboard

subscriptionPeriod is null

Open Toubap opened this issue 2 years ago • 4 comments
trafficstars

Describe the bug Recently experiencing a rare but annoying issue where StoreProduct.subscriptionPeriod is null which leads to a crash in our case. I guess it could be avoided by handling this specific case and skipping StoreProduct objects with null subscriptionPeriod. But then what happens to the user who is not able to proceed to the payment.

  1. Environment
    1. Platform: Android
    2. SDK version: 5.8.2 (waiting a bit more to upgrade to the 6.x)
    3. OS version: 10, 12, 13..
    4. Android Studio version: last stable - Android Studio Electric Eel | 2022.1.1 Patch 2
    5. How widespread is the issue. Percentage of devices affected: low which makes me believe the issue could come on your side or google's

Not reproduced in local environment

Toubap avatar Apr 11 '23 12:04 Toubap

👀 SDKONCALL-251 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

RCGitBot avatar Apr 11 '23 12:04 RCGitBot

Hi @Toubap, thanks for reaching out! Let me try to help you.

In 5.8.2, there are two situations where StoreProduct.subscriptionPeriod could be null:

  • If it's a non-subscription product (an In-app product within the Play store console).
  • If it's an Amazon product.

Do you have any products matching that situation? If that's not your issue, could you share a code snippet of how you're obtaining your StoreProduct's along with some logs of that flow so it's easier to debug?

tonidero avatar Apr 12 '23 15:04 tonidero

Here's what I get from the StoreProduct

StoreProduct(sku=xxx, type=SUBS, price=$18.00 , priceAmountMicros=18000000, priceCurrencyCode=USD, originalPrice=$18.00 , originalPriceAmountMicros=18000000, title=xxx , description=xxx  , subscriptionPeriod=null, freeTrialPeriod=null, introductoryPrice=null, introductoryPriceAmountMicros=0, introductoryPricePeriod=null, introductoryPriceCycles=0, iconUrl=, originalJson={"productId":"xxx","type":"subs","price":"$18.00 ","title":"xxx","name":"xxx","localizedIn":["de_DE","en_AU","en_CA","en_GB","en_IN","en_SG","en-US","en_ZA","fr_CA","fr_FR","ja_JP","ko_KR","zh_CN","zh_HK","zh_TW"],"description":"xxx","price_amount_micros":18000000,"price_currency_code":"USD","skuDetailsToken":"xxx","subscriptionOfferDetails":[{"offerIdToken":"xxx","pricingPhases":[{"priceAmountMicros":18000000,"priceCurrencyCode":"USD","formattedPrice":"$18.00 ","billingPeriod":"P1M","recurrenceMode":1}],"offerTags":["baseplan"]}]})

Its not an in app purchase nor an amazon product

initially obtained through getOfferingsWith

Toubap avatar Jun 15 '23 12:06 Toubap

Hi @Toubap,

Unfortunately I'm not able to repro the issue. Could you share a snippet of your call to getOfferingsWith along with how you're getting this StoreProduct and also share the logs before this happens?

tonidero avatar Jun 16 '23 09:06 tonidero