`AmazonStoreProduct` `period` is `null` for subscription with free trial during Live App Testing on the Amazon App Store.
- [X] I have updated Purchases SDK to the latest version
- [X] I have read the Contribution Guidelines
- [X] I have searched the Community
- [X] I have read docs.revenuecat.com
- [X] I have searched for existing Github issues
Describe the bug
Summary: AmazonStoreProduct period is null for subscription with free trial during Live App Testing on the Amazon App Store.
In the Amazon Developer Console we have set up one subscription in-app items with two terms:
- Monthly, paid subscription, no free trial, no promotional price
- Annually, paid subscription, free trial (1 month), no promotional price.
When testing our app with Amazon Live App Testing, we found that the annual subscription package object from RevenueCat (type AmazonStoreProduct) does not have a period set (it’s “period=null”), however, the monthly subscription has a period set as expected (“period=Period(value=1, "unit=MONTH", iso8601=P1M)”). The main difference between the two is that the annual subscription has a free trial period.
This hinders us from displaying our available packages as desired with the proper subscription period.
I noticed that in the RevenueCat documentation, StoreProduct period has documented
/**
* Subscription period.
*
* Note: Returned only for Google subscriptions. Null for Amazon or for INAPP products.
*/
val period: Period?
(also see this issue),
whereas the AmazonStoreProduct period has documented
/**
* Subscription period.
*
* Note: Returned only for subscriptions. Null for INAPP products.
*/
override val period: Period?
So is it expected to be null or not, and why is it then not null for the monthly subscription?
We’re using RevenueCat v8.1.0.
My device is a Amazon Fire HD 8 (12th Generation), running Android 11 (SDK 30).
Here are the RevenueCat Package objects, logged from a Live App Testing build of our app from the Amazon App Store:
Monthly:
Package("identifier=$rc_monthly",
"packageType=MONTHLY",
"product=AmazonStoreProduct(id=XXX",
"type=SUBS",
"name=Pro Access",
"title=Pro Access",
"description=XXX",
period=Period(value=1,
"unit=MONTH",
iso8601=P1M),
price=Price(formatted=XXX €,
amountMicros=XXX,
"currencyCode=EUR)",
"subscriptionOptions=null",
"defaultOption=null",
"iconUrl=XXX,
"freeTrialPeriod=null",
"originalProductJSON="{
"sku":"XXX",
"productType":"SUBSCRIPTION",
"description":"XXX",
"price":"XXX €",
"smallIconUrl":"XXX",
"title":"Pro Access",
"coinsRewardAmount":0,
"subscriptionPeriod":"Monthly"
},
presentedOfferingContext=PresentedOfferingContext(offeringIdentifier=XXX,
"placementIdentifier=null",
"targetingContext=null))",
presentedOfferingContext=PresentedOfferingContext(offeringIdentifier=XXX,
"placementIdentifier=null",
"targetingContext=null))")
Annual:
"Package(identifier=$rc_annual",
"packageType=ANNUAL",
"product=AmazonStoreProduct(id=XXX",
"type=SUBS",
"name=Pro Access",
"title=Pro Access",
"description=XXX",
"period=null",
price=Price(formatted=XXX €,
amountMicros=XXX,
"currencyCode=EUR)",
"subscriptionOptions=null",
"defaultOption=null",
"iconUrl=XXX,
freeTrialPeriod=Period(value=1,
"unit=MONTH",
iso8601=P1M),
"originalProductJSON="{
"sku":"XXX",
"productType":"SUBSCRIPTION",
"description":"XXX",
"price":"XXX €",
"smallIconUrl":"XXX",
"title":"Pro Access",
"coinsRewardAmount":0,
"subscriptionPeriod":"Annual",
"freeTrialPeriod":"Monthly"
},
presentedOfferingContext=PresentedOfferingContext(offeringIdentifier=XXX,
"placementIdentifier=null",
"targetingContext=null))",
presentedOfferingContext=PresentedOfferingContext(offeringIdentifier=XXX,
"placementIdentifier=null",
"targetingContext=null))"
Please also note that, when using Amazon App Tester App with the amazon.sdktester.json exported from the Amazon developer console and a debug build from our app, the in-app products are received as expected from the RevenueCat SDK, and here, the annual subscription has both a period and the freeTrialPeriod info set. It only is broken with Amazon Live App Testing.
- Environment
-
Platform: Android (Amazon)
-
SDK version: 8.1.0
-
OS version: Android 11 (SDK 30)
-
Android Studio version: Android Studio Jellyfish | 2023.3.1 Patch 1 Build #AI-233.14808.21.2331.11842104, built on May 15, 2024 Runtime version: 17.0.10+0-17.0.10b1087.21-11572160 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 15.0 GC: G1 Young Generation, G1 Old Generation Memory: 4096M Cores: 12 Metal Rendering is ON Registry: ide.experimental.ui=true
-
How widespread is the issue. Percentage of devices affected: Not live yet, but 100% reproducible in Amazon Live App Testing
-
- Debug logs that reproduce the issue: See above
- Steps to reproduce, with a description of expected vs. actual behavior: See above
- Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)
Additional context I yesterday created a [question on the RevenueCat Community](I yesterday posted a question on the RevenueCat Community which might be related to this question: https://community.revenuecat.com/sdks-51/bug-amazonstoreproduct-period-is-null-when-it-contains-a-free-trial-4743?fid=51&tid=4743), however, I think this is actually a bug of some sorts and hence opening an issue here.
👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!
In the meantime I think I have identified the issue, and it doesn't have anything to do with the free trial period.
In RevenueCat's storeProductConversions.kt internal fun String.createPeriod(): Period? (line 40), there is a match for "SemiAnnually" and "Annually". However, Amazon returns as subscriptionPeriod (and assumably also freeTrialPeriod) "SemiAnnual" and "Annual", see https://developer.amazon.com/docs/in-app-purchasing/iap-implement-iap.html#successful-request .
Looks like there is a difference in Debug and Release though:
- Debug: Faked products from Amazon App Tester App ->
"SemiAnnually"and"Annually" - Release: Real in-app products from the store ->
"SemiAnnual"and"Annual"
Hey @zahnooo ,
Thanks for reaching out and for the info here.
On Amazon Appstore, when an eligible user attempts to purchase a product that has an introductory offer (e.g. a free trial) the offer will be applied automatically. Are you possibly checking for eligibility before displaying this to user/starting the free trial? If you are, is it reporting that the user is eligible when you are running this in the debug environment?
I will share this with the rest of the team to get some more eyes on this, thanks for all the info provided here!
I'm having the same issue, any news here? @michaelAtRC
This issue has been automatically locked due to no recent activity after it was closed. Please open a new issue for related reports.