Axx*_*xon 14 android in-app-purchase in-app-billing
我有一个可更新的每月订阅的Android应用程序.在这个应用程序中,我想在下个月他的订阅继续时通知用户一些信息.
正如我可以看到商家中心的续订(orderId以例如.0,..1结尾),但在查询库存时,我的采购订单ID与efor eq相同.
{
"orderId": "GPA.XXXX-YYYY-XXXX-ZZZZZ",
"packageName": "my.packageName",
"productId": "my.sku",
"purchaseTime": 1456398623654,
"purchaseState": 0,
"developerPayload": "mypayload",
"purchaseToken": "token",
"autoRenewing": true
}
Run Code Online (Sandbox Code Playgroud)
令我困扰的是,buyTime也没有改变.
所以我的问题是:如果有任何方法可以在应用程序中检测到更新发生了吗?
编辑:
我正在使用Google Play Developer API获取订阅信息,然后自行计算续订数量.
ran*_*dom 10
所有重复的订单ID orderId在INAPP_PURCHASE_DATAJSON字段的字段中返回(在V3中),每个重复的事务都附加一个整数.
为了帮助您跟踪与给定订阅相关的交易,Google付款会为订阅的所有重复提供基本商家订单号,并通过附加整数来表示每个定期交易,如下所示:
GPA.1234-5678-9012-34567 (base order number)
GPA.1234-5678-9012-34567..0 (first recurrence orderID)
GPA.1234-5678-9012-34567..1 (second recurrence orderID)
GPA.1234-5678-9012-34567..2 (third recurrence orderID) ...
Run Code Online (Sandbox Code Playgroud)
但由于本地缓存,您可能无法获得最新信息.因此,请尝试从应用程序管理器清除缓存,先查看是否获得了正确的购买信息
由于购买查询这种方式不可靠,因此调用Google Play Developer Purchases.subscriptions更有意义:从后端获取 API以获取将返回当前订阅的Purchases.subscriptions资源expiryTimeMillis.
{
"kind": "androidpublisher#subscriptionPurchase",
"startTimeMillis": long,
"expiryTimeMillis": long,
"autoRenewing": boolean,
"priceCurrencyCode": string,
"priceAmountMicros": long,
"countryCode": string,
"developerPayload": string,
"paymentState": integer,
"cancelReason": integer
}
Run Code Online (Sandbox Code Playgroud)