Skip to content

Fix amazon zero price#1634

Merged
vegaro merged 3 commits into
mainfrom
fix-amazon-zero-price
Mar 7, 2024
Merged

Fix amazon zero price#1634
vegaro merged 3 commits into
mainfrom
fix-amazon-zero-price

Conversation

@vegaro

@vegaro vegaro commented Mar 6, 2024

Copy link
Copy Markdown
Member

We were never posting prices for Amazon purchases, because when we try to find the purchased product, we where using the subscriptionOptions property, which is always null for Amazon

This fix is a bit hacky right now, but we need to ship it quickly

@vegaro vegaro requested a review from a team March 6, 2024 23:55
@vegaro vegaro added the pr:fix A bug fix label Mar 6, 2024
// Amazon purchases don't have subscription options
// Amazon is the only store that has marketplace
// We want Google restores to enter in this if, that's why we need to filter Amazon only
if (transaction.type == ProductType.SUBS && transaction.marketplace == null) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about just removing the else and checking if purchasedStoreProduct is null and in that case doing:

storeProducts.firstOrNull { product ->
    product.id == transaction.productIds.firstOrNull()
}

But I worry about restored purchases, which also don't have subscription options, and right now we are also getting a purchasedStoreProduct for them. That might be another bug, or expected behavior.

So I went with checking transaction.marketplace == null which is a proxy for checking if the store is Google. So if it's Amazon, or consumables, it will go into the else.

@joshdholtz joshdholtz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small comments but otherwise looks good 👍

@vegaro vegaro enabled auto-merge (squash) March 7, 2024 00:05
@vegaro vegaro merged commit 5ae4dcb into main Mar 7, 2024
@vegaro vegaro deleted the fix-amazon-zero-price branch March 7, 2024 00:24
joshdholtz pushed a commit that referenced this pull request Mar 7, 2024
**This is an automatic release.**

### Bugfixes
* Fix amazon zero price (#1634) via Cesar de la Vega (@vegaro)

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
@farmerbb

farmerbb commented Mar 7, 2024

Copy link
Copy Markdown

Thank you very much for getting this fixed!

vegaro added a commit that referenced this pull request Mar 7, 2024
We were never posting prices for Amazon purchases, because when we try
to find the purchased product, we where using the `subscriptionOptions`
property, which is always null for Amazon

This fix is a bit hacky right now, but we need to ship it quickly
vegaro added a commit that referenced this pull request Mar 7, 2024
@vegaro vegaro mentioned this pull request Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants