Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you detect if a user's existing subscription's price has changed (Google Play in-app purchase)?

Google has documentation of what to do IF a subscription's price has changed.

You're supposed to use a billing client and launch PriceChangeConfirmationFlow. However, how do you detect if the price has changed in the first place?

What Android library API would tell me that?

The SkuDetails have the price, but the Purchase details don't. They just refer to the SkuDetails using the "productId". I'm looking at the raw json. If the Purchase object had a price in it, I could compare it to the current price in the SkuDetails, but it doesn't.

like image 506
metaphyze Avatar asked Nov 07 '22 20:11

metaphyze


1 Answers

When you query for the user inventory with the billing API, you get Purchase objects which include the purchase time. A bit of a hacky solution is to look at that date and if it's before the time you changed your price, you initiate the flow with launchPriceChangeConfirmationFlow().

like image 96
Ariel Vardi Avatar answered Nov 14 '22 23:11

Ariel Vardi