簡體   English   中英

如何區分用戶是否在Google Play中訂閱試用期?

[英]How to distinguish if the user is on subscription trial period or not in google play?

我正在實施一項服務器端服務,用於檢查用戶的Google Play訂閱狀態。 我使用Android Pubisher API( https://developers.google.com/android-publisher/api-ref/purchases/subscriptions/get )來檢查訂閱狀態。 雖然,我無法理解如何區分用戶是否處於試用期或者他是否已經付款(我需要它用於分析,歸因於收入)?

如何才能做到這一點?

當您從服務器驗證訂閱購買時,您將獲得以下訂閱資源:

{
  "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文檔: https//developers.google.com/android-publisher/api-ref/purchases/subscriptions#resource

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM