2016-12-13 14 views
3

我正在實現一個服務器端服務,用於檢查用戶的Google Play訂閱狀態。我使用Android Pubisher API(https://developers.google.com/android-publisher/api-ref/purchases/subscriptions/get)來檢查訂閱狀態。雖然,我不明白如何區分用戶是否處於試用期,或者他是否已經付款(我需要它進行分析,以確定收入)?如何區分用戶是否在訂閱試用期或不在谷歌播放?

這怎麼辦?

+0

是一次性付款還是訂閱? – Ak9637

+1

@ Ak9637請仔細閱讀問題 – DataGreed

+0

任何解決方案? @DataGreed – Jorge

回答

1

當您驗證從您的服務器訂閱購買,你會得到這樣的訂閱資源:

{ 
    "kind": "androidpublisher#subscriptionPurchase", 
    "startTimeMillis": long, 
    "expiryTimeMillis": long, 
    "autoRenewing": boolean, 
    "priceCurrencyCode": string, 
    "priceAmountMicros": long, 
    "countryCode": string, 
    "developerPayload": string, 
    "paymentState": integer, 
    "cancelReason": integer, 
    "userCancellationTimeMillis": long 
} 

paymentState值對訂閱3種狀態:

  • 0 - 付款正在申請
  • 1 - 已收到付款
  • 2 - 免費試用

您可以隨時致電Google Play API檢查此狀態。 API Docs:https://developers.google.com/android-publisher/api-ref/purchases/subscriptions#resource

相關問題