REST Resource: purchases.subscriptionsv2

資源:SubscriptionPurchaseV2

指出使用者的訂閱購買狀態。

JSON 表示法
{
  "kind": string,
  "regionCode": string,
  "lineItems": [
    {
      object (SubscriptionPurchaseLineItem)
    }
  ],
  "startTime": string,
  "subscriptionState": enum (SubscriptionState),
  "latestOrderId": string,
  "linkedPurchaseToken": string,
  "pausedStateContext": {
    object (PausedStateContext)
  },
  "canceledStateContext": {
    object (CanceledStateContext)
  },
  "testPurchase": {
    object (TestPurchase)
  },
  "acknowledgementState": enum (AcknowledgementState),
  "externalAccountIdentifiers": {
    object (ExternalAccountIdentifiers)
  },
  "subscribeWithGoogleInfo": {
    object (SubscribeWithGoogleInfo)
  }
}
欄位
kind

string

這個種類代表 Androidpublisher 服務中的 SubscriptionPurchaseV2 物件。

regionCode

string

使用者授予訂閱時的 ISO 3166-1 alpha-2 帳單國家/地區代碼。

lineItems[]

object (SubscriptionPurchaseLineItem)

訂閱項目購買交易的商品層級資訊。在同一筆交易中的商品應全部採用 AutoRenewingPlan 屬性,或是全都搭配預付方案。

startTime

string (Timestamp format)

使用者授予訂閱的時間。未設為待處理訂閱項目 (訂閱已建立,但在申請期間有待付款)。

RFC3339 世界標準時間「Zulu」格式的時間戳記,採用奈秒解析度,且最多 9 個小數位數。範例:"2014-10-02T15:01:23Z""2014-10-02T15:01:23.045123456Z"

subscriptionState

enum (SubscriptionState)

訂閱項目的目前狀態。

latestOrderId

string

與購買訂閱項目相關的最新訂單 ID。如果是自動續訂,這是指註冊訂單的訂單 ID (如果尚未續約的話),或是最後一個週期性訂單 ID (成功、待處理或遭拒)。如果是預付型訂閱項目,這是指與所查詢購買憑證相關聯的訂單 ID。

linkedPurchaseToken

string

如果這個訂閱項目符合以下任一條件,就會提供舊訂閱項目的購買憑證:* 重新申請已取消但尚未到期的訂閱 * 升級/降級至舊訂閱項目。* 從預付轉換為自動續約型訂閱方案。* 從自動續訂型訂閱項目轉換為預付方案。* 為預付訂閱方案儲值。

pausedStateContext

object (PausedStateContext)

暫停訂閱的額外背景資訊。只有在訂閱目前具有 subscriptionState SUBSCRIPTION_STATE_PAUSED 時,才會顯示。

canceledStateContext

object (CanceledStateContext)

取消訂閱的其他背景資訊。只有在訂閱目前具有 subscriptionState SUBSCRIPTION_STATE_CANCELED 時,才會顯示。

testPurchase

object (TestPurchase)

只有在此訂閱項目購買交易是測試購買交易時才會顯示。

acknowledgementState

enum (AcknowledgementState)

訂閱項目的確認狀態。

externalAccountIdentifiers

object (ExternalAccountIdentifiers)

第三方服務中的使用者帳戶 ID。

subscribeWithGoogleInfo

object (SubscribeWithGoogleInfo)

與「透過 Google 訂閱」交易相關聯的使用者個人資料。

SubscriptionState

訂閱項目可能的狀態,例如訂閱項目是否有效。訂閱購買的項目可以是自動續訂方案或預付方案。

列舉
SUBSCRIPTION_STATE_UNSPECIFIED 未指定的訂閱狀態。
SUBSCRIPTION_STATE_PENDING 訂閱項目已建立,但在註冊期間尚待付款。處於這個狀態的項目全都在等待付款。
SUBSCRIPTION_STATE_ACTIVE 訂閱有效。- (1) 如果訂閱項目是自動續約方案,則至少有 1 個項目會設定為 autoRenewEnabled 且尚未過期。- (2) 如果訂閱是預付方案,至少有一項商品尚未過期。
SUBSCRIPTION_STATE_PAUSED 訂閱項目已暫停。只有在訂閱項目為自動續約方案時,才會顯示這個狀態。所有項目都會處於暫停狀態。
SUBSCRIPTION_STATE_IN_GRACE_PERIOD 訂閱項目處於寬限期。只有在訂閱項目為自動續約方案時,才會顯示這個狀態。在這個狀態下,所有項目都處於寬限期。
SUBSCRIPTION_STATE_ON_HOLD 訂閱項目已暫停 (已暫停)。只有在訂閱項目為自動續約方案時,才會顯示這個狀態。在這個狀態下,所有項目都處於保留狀態。
SUBSCRIPTION_STATE_CANCELED 訂閱項目已取消,但尚未到期。只有在訂閱項目為自動續約方案時,才會顯示這個狀態。所有項目的 autoRenewEnabled 均設為 false。
SUBSCRIPTION_STATE_EXPIRED 訂閱已過期。所有項目皆設有 expiryTime。

PausedStateContext

暫停狀態訂閱項目的相關資訊。

JSON 表示法
{
  "autoResumeTime": string
}
欄位
autoResumeTime

string (Timestamp format)

自動恢復訂閱的時間。

RFC3339 世界標準時間「Zulu」格式的時間戳記,採用奈秒解析度,且最多 9 個小數位數。範例:"2014-10-02T15:01:23Z""2014-10-02T15:01:23.045123456Z"

CanceledStateContext

處於已取消狀態的訂閱項目相關資訊。

JSON 表示法
{

  // Union field cancellation_reason can be only one of the following:
  "userInitiatedCancellation": {
    object (UserInitiatedCancellation)
  },
  "systemInitiatedCancellation": {
    object (SystemInitiatedCancellation)
  },
  "developerInitiatedCancellation": {
    object (DeveloperInitiatedCancellation)
  },
  "replacementCancellation": {
    object (ReplacementCancellation)
  }
  // End of list of possible types for union field cancellation_reason.
}
欄位
聯集欄位 cancellation_reason。取消訂閱的原因。cancellation_reason 只能是下列其中一項:
userInitiatedCancellation

object (UserInitiatedCancellation)

使用者已取消訂閱。

systemInitiatedCancellation

object (SystemInitiatedCancellation)

系統已取消訂閱項目,例如因為帳單問題。

developerInitiatedCancellation

object (DeveloperInitiatedCancellation)

開發人員已取消訂閱方案。

replacementCancellation

object (ReplacementCancellation)

訂閱已由新的訂閱方案取代。

UserInitiatedCancellation

使用者自行取消訂閱的相關資訊。

JSON 表示法
{
  "cancelSurveyResult": {
    object (CancelSurveyResult)
  },
  "cancelTime": string
}
欄位
cancelSurveyResult

object (CancelSurveyResult)

使用者在完成取消訂閱流程時提供的資訊 (取消原因問卷調查)。

cancelTime

string (Timestamp format)

使用者取消訂閱的時間。此時間過後,使用者或許仍可存取訂閱項目。使用 lineItems.expiry_time 判斷使用者是否仍可存取。

RFC3339 世界標準時間「Zulu」格式的時間戳記,採用奈秒解析度,且最多 9 個小數位數。範例:"2014-10-02T15:01:23Z""2014-10-02T15:01:23.045123456Z"

CancelSurveyResult

使用者取消訂閱時取消訂閱的問卷調查結果。

JSON 表示法
{
  "reason": enum (CancelSurveyReason),
  "reasonUserInput": string
}
欄位
reason

enum (CancelSurveyReason)

使用者在取消訂閱問卷調查中選取的原因。

reasonUserInput

string

僅為 CANCEL_SURVEY_REASON_OTHERS 設定。這是使用者對問卷調查的任意形式回覆。

CancelSurveyReason

使用者在取消訂閱問卷調查中選取的原因。

列舉
CANCEL_SURVEY_REASON_UNSPECIFIED 取消問卷調查的不明原因。
CANCEL_SURVEY_REASON_NOT_ENOUGH_USAGE 訂閱用量不足。
CANCEL_SURVEY_REASON_TECHNICAL_ISSUES 使用應用程式時發生技術問題。
CANCEL_SURVEY_REASON_FOUND_BETTER_APP 使用者找到了更好的應用程式,
CANCEL_SURVEY_REASON_OTHERS 其他原因。

SystemInitiatedCancellation

這個類型沒有任何欄位。

Google 系統所發起取消作業的相關資訊。

DeveloperInitiatedCancellation

這個類型沒有任何欄位。

開發人員所發起取消交易的相關資訊。

ReplacementCancellation

這個類型沒有任何欄位。

因更換訂閱項目而造成的取消訂閱專屬資訊。

TestPurchase

這個類型沒有任何欄位。

此訂閱項目是否為測試購買交易。

AcknowledgementState

訂閱項目的可能確認狀態。

列舉
ACKNOWLEDGEMENT_STATE_UNSPECIFIED 未指定的確認狀態。
ACKNOWLEDGEMENT_STATE_PENDING 訂閱項目尚未確認,
ACKNOWLEDGEMENT_STATE_ACKNOWLEDGED 已確認訂閱項目。

ExternalAccountIdentifiers

第三方服務中的使用者帳戶 ID。

JSON 表示法
{
  "externalAccountId": string,
  "obfuscatedExternalAccountId": string,
  "obfuscatedExternalProfileId": string
}
欄位
externalAccountId

string

第三方服務中的使用者帳戶 ID。只有在訂閱購買流程中需要帳戶連結才會出現。

obfuscatedExternalAccountId

string

經過模糊處理的 ID 版本,只與應用程式中的使用者帳戶相關。針對下列購買交易顯示:* 如果帳戶連結流程是訂閱項目購買流程的一部分。* 購買時會使用 https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedaccountid

obfuscatedExternalProfileId

string

經過模糊處理的 ID 版本,只與應用程式中的使用者個人資料相關。只有在購買交易時使用 https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedprofileid 指定時才會顯示。

SubscribeWithGoogleInfo

透過「透過 Google 訂閱」交易的相關資訊。

JSON 表示法
{
  "profileId": string,
  "profileName": string,
  "emailAddress": string,
  "givenName": string,
  "familyName": string
}
欄位
profileId

string

購買訂閱項目時使用者的 Google 個人資料 ID。

profileName

string

購買訂閱項目時的使用者個人資料名稱。

emailAddress

string

購買訂閱項目時的使用者電子郵件地址。

givenName

string

購買訂閱項目時的使用者名稱。

familyName

string

購買訂閱項目時的使用者名稱。

SubscriptionPurchaseLineItem

訂閱項目購買交易的商品層級資訊。

JSON 表示法
{
  "productId": string,
  "expiryTime": string,

  // Union field plan_type can be only one of the following:
  "autoRenewingPlan": {
    object (AutoRenewingPlan)
  },
  "prepaidPlan": {
    object (PrepaidPlan)
  }
  // End of list of possible types for union field plan_type.
  "offerDetails": {
    object (OfferDetails)
  },

  // Union field deferred_item_change can be only one of the following:
  "deferredItemReplacement": {
    object (DeferredItemReplacement)
  }
  // End of list of possible types for union field deferred_item_change.
}
欄位
productId

string

已購買的產品 ID (例如「monthly001」)。

expiryTime

string (Timestamp format)

訂閱到期或到期的時間,除非存取權延長 (例如續訂)。

RFC3339 世界標準時間「Zulu」格式的時間戳記,採用奈秒解析度,且最多 9 個小數位數。範例:"2014-10-02T15:01:23Z""2014-10-02T15:01:23.045123456Z"

聯集欄位 plan_type。訂閱方案類型。plan_type 只能是下列其中一項:
autoRenewingPlan

object (AutoRenewingPlan)

項目會自動續訂。

prepaidPlan

object (PrepaidPlan)

商品已預付郵資。

offerDetails

object (OfferDetails)

這項商品的優惠詳細資料。

聯集欄位 deferred_item_change。當項目有延遲變更時,就會顯示這個欄位。您可以將其移除或替換。deferred_item_change 只能是下列其中一項:
deferredItemReplacement

object (DeferredItemReplacement)

延遲替換品的資訊。

AutoRenewingPlan

自動續約方案相關資訊。

JSON 表示法
{
  "autoRenewEnabled": boolean,
  "priceChangeDetails": {
    object (SubscriptionItemPriceChangeDetails)
  }
}
欄位
autoRenewEnabled

boolean

如果訂閱項目目前設為自動續約,例如使用者尚未取消訂閱

priceChangeDetails

object (SubscriptionItemPriceChangeDetails)

訂閱訂閱後上次價格異動的資訊。

SubscriptionItemPriceChangeDetails

訂閱項目價格異動相關資訊。

JSON 表示法
{
  "newPrice": {
    object (Money)
  },
  "priceChangeMode": enum (PriceChangeMode),
  "priceChangeState": enum (PriceChangeState),
  "expectedNewPriceChargeTime": string
}
欄位
newPrice

object (Money)

訂閱項目項目的新週期性價格。

priceChangeMode

enum (PriceChangeMode)

價格變更模式會指定訂閱項目價格的變化方式。

priceChangeState

enum (PriceChangeState)

說明目前的價格異動情形。

expectedNewPriceChargeTime

string (Timestamp format)

使用者價格異動的續訂時間。續約時間發生變化(例如暫停訂閱),可能會有所變動。只有在價格異動未生效時,系統才會填入這個欄位。

RFC3339 世界標準時間「Zulu」格式的時間戳記,採用奈秒解析度,且最多 9 個小數位數。範例:"2014-10-02T15:01:23Z""2014-10-02T15:01:23.045123456Z"

PriceChangeMode

價格異動的模式。

列舉
PRICE_CHANGE_MODE_UNSPECIFIED 未指定價格變更模式。請勿設定此值。
PRICE_DECREASE 訂閱價格調降。
PRICE_INCREASE 如果訂閱價格即將調漲,且使用者需要接受方案。
OPT_OUT_PRICE_INCREASE 選擇退出模式後訂閱價格調漲。

PriceChangeState

價格異動的狀態,

列舉
PRICE_CHANGE_STATE_UNSPECIFIED 未指定價格變更狀態。不應使用這個值。
OUTSTANDING 正在等待使用者同意價格異動。
CONFIRMED 系統已確認向使用者顯示價格異動。
APPLIED 套用價格異動後,系統就會開始向使用者收取新價格。

PrepaidPlan

預付方案相關資訊。

JSON 表示法
{
  "allowExtendAfterTime": string
}
欄位
allowExtendAfterTime

string (Timestamp format)

如有指定,代表預付方案允許儲值的期限。如果預付方案過期,則不會顯示。

RFC3339 世界標準時間「Zulu」格式的時間戳記,採用奈秒解析度,且最多 9 個小數位數。範例:"2014-10-02T15:01:23Z""2014-10-02T15:01:23.045123456Z"

OfferDetails

與購買明細項目相關的優惠資訊。

JSON 表示法
{
  "offerTags": [
    string
  ],
  "basePlanId": string,
  "offerId": string
}
欄位
offerTags[]

string

與優惠相關的最新優惠標記。當中包含繼承自基本方案的標記。

basePlanId

string

基本方案 ID。適用於所有基本方案和優惠。

offerId

string

優惠 ID。僅適用於折扣優惠。

DeferredItemReplacement

延遲替換品的相關資訊。

JSON 表示法
{
  "productId": string
}
欄位
productId

string

productId 即將取代現有產品 ID。

方法

get

取得訂閱項目的中繼資料

revoke

撤銷使用者的訂閱購買交易。