问题
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