REST Resource: purchases.subscriptions

资源:SubscriptionPurchase

SubscriptionPurchase 资源表示用户的订阅购买的状态。

JSON 表示法
{
  "kind": string,
  "startTimeMillis": string,
  "expiryTimeMillis": string,
  "autoResumeTimeMillis": string,
  "autoRenewing": boolean,
  "priceCurrencyCode": string,
  "priceAmountMicros": string,
  "introductoryPriceInfo": {
    object (IntroductoryPriceInfo)
  },
  "countryCode": string,
  "developerPayload": string,
  "paymentState": integer,
  "cancelReason": integer,
  "userCancellationTimeMillis": string,
  "cancelSurveyResult": {
    object (SubscriptionCancelSurveyResult)
  },
  "orderId": string,
  "linkedPurchaseToken": string,
  "purchaseType": integer,
  "priceChange": {
    object (SubscriptionPriceChange)
  },
  "profileName": string,
  "emailAddress": string,
  "givenName": string,
  "familyName": string,
  "profileId": string,
  "acknowledgementState": integer,
  "externalAccountId": string,
  "promotionType": integer,
  "promotionCode": string,
  "obfuscatedExternalAccountId": string,
  "obfuscatedExternalProfileId": string
}
字段
kind

string

此类型表示 androidpublisherservice 中的 subscriptionPurchase 对象。

startTimeMillis

string (int64 format)

授予订阅的时间,以从公元纪年开始计算的毫秒数表示。

expiryTimeMillis

string (int64 format)

订阅的到期时间(以毫秒为单位,从 Epoch 起算)。

autoResumeTimeMillis

string (int64 format)

自动恢复订阅的时间(以毫秒为单位,从 Epoch 起算)。仅当用户请求暂停订阅时才存在。

autoRenewing

boolean

设置是否在订阅到期时自动续订。

priceCurrencyCode

string

订阅价格的 ISO 4217 货币代码。例如,如果价格采用英镑,则 priceCurrencyCode 为“GBP”。

priceAmountMicros

string (int64 format)

订阅价格。对于不含税的国家/地区,价格不包含税费。对于含税的国家/地区,价格中包含税费。价格以微单位显示,其中 1000000 个微单位表示货币单位。例如,如果订阅价格为 1.99 欧元,priceAmountMicros 为 1990000。

introductoryPriceInfo

object (IntroductoryPriceInfo)

订阅的初次体验价信息。只有以初次体验价购买订阅内容时,此字段才会显示。

此字段不指明订阅目前处于初次体验价阶段。

countryCode

string

订阅获得批准的用户的 ISO 3166-1 alpha-2 帐单邮寄地址所在国家/地区代码。

developerPayload

string

开发者指定的字符串,其中包含有关订单的补充信息。

paymentState

integer

订阅的付款状态。可能的值包括:0。1. 待处理付款付款已收讫 2. 免费试用 3. 延迟升级/降级

已取消、已过期的订阅不会显示。

cancelReason

integer

订阅被取消或未自动续订的原因。可能的值包括:0。用户取消了订阅 1. 由于结算问题 2,系统取消了订阅 2. 订阅被新的订阅 3 取代了。开发者已取消订阅

userCancellationTimeMillis

string (int64 format)

用户取消订阅的时间,以从公元纪年开始计算的毫秒数表示。仅当 CancelReason 为 0 时才存在。

cancelSurveyResult

object (SubscriptionCancelSurveyResult)

用户在完成取消订阅流程(取消订阅原因调查问卷)时提供的信息。

orderId

string

与购买订阅有关的最新周期性订单的订单 ID。如果订阅因付款遭拒而被取消,系统将会显示付款遭拒订单的订单 ID。

linkedPurchaseToken

string

源购买交易的购买令牌(如果此订阅是以下之一):0。重新注册已取消但尚未失效的订阅 1. 从之前的订阅升级/降级

例如,假设某个用户先注册后收到购买令牌 X,然后该用户取消并完成了重新注册流程(在订阅到期之前),您收到了购买令牌 Y,最后该用户升级了订阅,这时您收到了购买令牌 Z。如果您使用购买令牌 Z 调用此 API,此字段将设置为 Y。如果您使用购买令牌 Y 调用此 API,此字段将设置为 X。如果您使用购买令牌 X 调用此 API,将不会设置此字段。

purchaseType

integer

订阅的购买类型。仅当购买交易不是使用标准的应用内购买结算流程时,系统才会设置此字段。可能的值包括:0。测试(即通过许可测试帐号购买)1.促销(即使用促销代码购买)

priceChange

object (SubscriptionPriceChange)

提供的最新价格变动信息。只有在订阅价格即将调整时,系统才会显示此日期。

使用新价格续订或取消订阅后,系统将不会返回任何价格变动信息。

profileName

string

购买订阅的用户的个人资料名称。只有通过“在 Google 上购买”的购买交易才能使用此功能。

emailAddress

string

购买订阅时用户的电子邮件地址。只有通过“在 Google 上购买”的购买交易才能使用此功能。

givenName

string

购买订阅时用户的指定名称。只有通过“在 Google 上购买”的购买交易才能使用此功能。

familyName

string

购买订阅用户的姓氏。只有通过“在 Google 上购买”的购买交易才能使用此功能。

profileId

string

购买订阅用户的 Google 个人资料 ID。只有通过“在 Google 上购买”的购买交易才能使用此功能。

acknowledgementState

integer

订阅产品的确认状态。可能的值包括:0。待确认 1. 已确认

externalAccountId

string

第三方服务中的用户帐号标识符。仅当帐号关联是在订阅购买流程中发生的。

promotionType

integer

此购买交易适用的促销活动类型。仅当购买订阅时应用促销优惠时,系统才会设置此字段。可能的值包括:0。一次性代码 1。个性化代码

promotionCode

string

此购买交易的促销代码。只有在购买订阅时适用个性化代码促销的情况下,系统才会设置此字段。

obfuscatedExternalAccountId

string

与用户的用户帐号唯一关联的 ID 的混淆版本。如果存在以下购买交易,则存在该 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 指定时才提供此值。

初次体验价信息

包含订阅的初次体验价信息。

JSON 表示法
{
  "introductoryPriceCurrencyCode": string,
  "introductoryPriceAmountMicros": string,
  "introductoryPricePeriod": string,
  "introductoryPriceCycles": integer
}
字段
introductoryPriceCurrencyCode

string

初次体验价的 ISO 4217 币种代码。例如,如果价格采用英镑,则 priceCurrencyCode 为“GBP”。

introductoryPriceAmountMicros

string (int64 format)

订阅的初次体验价(不含税)。币种与 priceCurrencyCode 相同。价格以微单位显示,其中 1000000 个微单位表示货币单位。例如,如果订阅价格为 1.99 欧元,priceAmountMicros 为 1990000。

introductoryPricePeriod

string

初次体验价期间,采用 ISO 8601 格式。常见值包括(但不限于)“P1W”(1 周)、“P1M”(1 个月)、“P3M”(3 个月)、“P6M”(6 个月)和“P1Y”(1 年)。

introductoryPriceCycles

integer

提供初次体验价的结算周期数。

SubscriptionCancelSurveyResult

用户在完成取消订阅流程(取消订阅原因调查问卷)时提供的信息。

JSON 表示法
{
  "cancelSurveyReason": integer,
  "userInputCancelReason": string
}
字段
cancelSurveyReason

integer

用户在调查问卷中选择的取消原因。可能的值包括:0。其他 1. 我不常使用这项服务 2. 技术问题 3. 费用相关原因 4. 我找到了更好的应用

userInputCancelReason

string

用户的自定义输入取消原因。仅当 CancelReason 为 0 时才存在。

订阅价格变动

包含订阅的价格变动信息,可用于控制用户在应用内执行的价格变动流程。具体形式包括征求用户确认或为成功转化定制体验。

JSON 表示法
{
  "newPrice": {
    object (Price)
  },
  "state": integer
}
字段
newPrice

object (Price)

用户接受价格变动后,订阅将采用的新价格。

state

integer

价格变动的当前状态。可能的值包括:0。待处理:等待用户同意的待处理价格变动的状态。在此状态下,您可以使用 In-App API 请求用户确认。1. 已接受:除非订阅被取消,否则对于订阅将在续订后接受的价格变动,请指明该状态。价格变动将于订阅到期的未来日期生效。请注意,订阅下次续订时,可能不会发生变化。

方法

acknowledge

确认订阅购买交易。

cancel

取消用户的订阅购买交易。

defer

将用户的订阅购买交易推迟到指定的未来到期时间。

get

检查用户的订阅购买交易是否有效并返回有效期。

refund

为用户的订阅购买交易退款,但订阅在到期之前仍然有效,并且会继续重复发生。

revoke

退款并立即撤消用户的订阅购买交易。