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

北战南征 提交于 2020-12-25 04:25:22

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/54797847/how-do-you-detect-if-a-users-existing-subscriptions-price-has-changed-google

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!