简体   繁体   中英

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.

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() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM