REST Resource: partners.subscriptions

Stay organized with collections Save and categorize content based on your preferences.

Resource: Subscription

A Subscription resource managed by 3P Partners.

JSON representation
{
  "name": string,
  "products": [
    string
  ],
  "promotions": [
    string
  ],
  "promotionSpecs": [
    {
      object (PromotionSpec)
    }
  ],
  "partnerUserToken": string,
  "serviceLocation": {
    object (Location)
  },
  "upgradeDowngradeDetails": {
    object (UpgradeDowngradeDetails)
  },
  "redirectUri": string,
  "createTime": string,
  "updateTime": string,
  "cycleEndTime": string,
  "renewalTime": string,
  "freeTrialEndTime": string,
  "endUserEntitled": boolean,
  "state": enum (State),
  "processingState": enum (ProcessingState),
  "cancellationDetails": {
    object (CancellationDetails)
  },
  "lineItems": [
    {
      object (LineItem)
    }
  ]
}
Fields
name

string

Optional. Resource name of the subscription. It will have the format of "partners/{partner_id}/subscriptions/{subscriptionId}". This is available for authorizeAddon, but otherwise is response only.

products[]

string

Required. Deprecated: consider using lineItems as the input. Required. Resource name that identifies the purchased products. The format will be 'partners/{partner_id}/products/{product_id}'.

promotions[]

string

Optional. Deprecated: consider using the top-level promotionSpecs as the input. Optional. Resource name that identifies one or more promotions that can be applied on the product. A typical promotion for a subscription is Free trial. The format will be 'partners/{partner_id}/promotions/{promotion_id}'.

promotionSpecs[]

object (PromotionSpec)

Optional. Subscription-level promotions. Only free trial is supported on this level. It determines the first renewal time of the subscription to be the end of the free trial period. Specify the promotion resource name only when used as input.

partnerUserToken

string

Required. Identifier of the end-user in partner’s system. The value is restricted to 63 ASCII characters at the maximum.

serviceLocation

object (Location)

Required. The location that the service is provided as indicated by the partner.

upgradeDowngradeDetails

object (UpgradeDowngradeDetails)

Optional. Details about the previous subscription that this new subscription upgrades/downgrades from. Only populated if this subscription is an upgrade/downgrade from another subscription.

redirectUri

string

Output only. The place where partners should redirect the end-user to after creation. This field might also be populated when creation failed. However, Partners should always prepare a default URL to redirect the user in case this field is empty.

createTime

string (Timestamp format)

Output only. System generated timestamp when the subscription is created. UTC timezone.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

updateTime

string (Timestamp format)

Output only. System generated timestamp when the subscription is most recently updated. UTC timezone.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

cycleEndTime

string (Timestamp format)

Output only. The time at which the subscription is expected to be extended, in ISO 8061 format. UTC timezone. For example: "2019-08-31T17:28:54.564Z"

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

renewalTime

string (Timestamp format)

Output only. The time at which the subscription is expected to be renewed by Google - a new charge will be incurred and the service entitlement will be renewed. A non-immediate cancellation will take place at this time too, before which, the service entitlement for the end user will remain valid. UTC timezone in ISO 8061 format. For example: "2019-08-31T17:28:54.564Z"

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

freeTrialEndTime

string (Timestamp format)

Output only. End of the free trial period, in ISO 8061 format. For example, "2019-08-31T17:28:54.564Z". It will be set the same as createTime if no free trial promotion is specified.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

endUserEntitled

boolean

Output only. Indicates if the subscription is entitled to the end user.

state

enum (State)

Output only. Describes the state of the subscription. See more details at the lifecycle of a subscription.

processingState

enum (ProcessingState)

Output only. Describes the processing state of the subscription. See more details at the lifecycle of a subscription.

cancellationDetails

object (CancellationDetails)

Output only. Describes the details of a cancelled subscription. Only applicable to subscription of state STATE_CANCELLED.

lineItems[]

object (LineItem)

Required. The line items of the subscription.

PromotionSpec

Describes the spec for one promotion.

JSON representation
{
  "promotion": string,
  "type": enum (PromotionType),

  // Union field spec can be only one of the following:
  "introductoryPricingDetails": {
    object (IntroductoryPricingDetails)
  },
  "freeTrialDuration": {
    object (Duration)
  }
  // End of list of possible types for union field spec.
}
Fields
promotion

string

Required. Promotion resource name that identifies a promotion. The format is 'partners/{partner_id}/promotions/{promotion_id}'.

type

enum (PromotionType)

Output only. The type of the promotion for the spec.

Union field spec.

spec can be only one of the following:

introductoryPricingDetails

object (IntroductoryPricingDetails)

Output only. The details of the introductory pricing spec if the promotion is of type INTRODUCTORY_PRICING.

freeTrialDuration

object (Duration)

Output only. The duration of the free trial if the promotion is of type FREE_TRIAL.

Location

Describes a location of an end user.

JSON representation
{
  "regionCode": string,
  "postalCode": string
}
Fields
regionCode

string

2-letter ISO region code for current content region. Ex. “US” Please refers to: https://en.wikipedia.org/wiki/ISO_3166-1

postalCode

string

The postal code this location refers to. Ex. "94043"

UpgradeDowngradeDetails

Details about the previous subscription that this new subscription upgrades/downgrades from.

JSON representation
{
  "previousSubscriptionId": string,
  "billingCycleSpec": enum (BillingCycleSpec)
}
Fields
previousSubscriptionId

string

Required. The previous subscription id to be replaced. This is not the full resource name, use the subscriptionId segment only.

billingCycleSpec

enum (BillingCycleSpec)

Required. Specifies the billing cycle spec for the new upgraded/downgraded subscription.

BillingCycleSpec

Specifies the billing cycle spec for the new upgraded/downgraded subscription.

Enums
BILLING_CYCLE_SPEC_UNSPECIFIED Billing cycle spec is not specified.
BILLING_CYCLE_SPEC_ALIGN_WITH_PREVIOUS_SUBSCRIPTION The billing cycle of the new subscription aligns with the previous subscription it upgrades or downgrades from.
BILLING_CYCLE_SPEC_START_IMMEDIATELY The billing cycle of the new subscription starts immediately.

State

The state of a subscription.

Enums
STATE_UNSPECIFIED The state is unspecified.
STATE_CREATED The subscription is created, a state before it is moved to STATE_ACTIVE.
STATE_ACTIVE The subscription is active.
STATE_CANCELLED The subscription is cancelled.
STATE_IN_GRACE_PERIOD The subscription has not been extended by the partner after the end of current cycle.
STATE_CANCEL_AT_END_OF_CYCLE The subscription is waiting to be cancelled by the next recurrence cycle.
STATE_SUSPENDED The subscription is suspended.

ProcessingState

The processing state of a subscription which is transient.

Enums
PROCESSING_STATE_UNSPECIFIED The processing state is unspecified.
PROCESSING_STATE_CANCELLING The subscription is being cancelled.
PROCESSING_STATE_RECURRING The subscription is recurring.

CancellationDetails

Describes the details of a cancelled or cancelling subscription.

JSON representation
{
  "reason": enum (CancellationReason)
}
Fields
reason

enum (CancellationReason)

The reason of the cancellation.

CancellationReason

Describes the reason for cancellation of the subscription.

Enums
CANCELLATION_REASON_UNSPECIFIED Reason is unspecified.
CANCELLATION_REASON_FRAUD Fraudualant transaction.
CANCELLATION_REASON_REMORSE Buyer's remorse.
CANCELLATION_REASON_ACCIDENTAL_PURCHASE Accidential purchase.
CANCELLATION_REASON_PAST_DUE Payment is past due.
CANCELLATION_REASON_ACCOUNT_CLOSED User account closed.
CANCELLATION_REASON_UPGRADE_DOWNGRADE Used for notification only, do not use in Cancel API. Cancellation due to upgrade or downgrade.
CANCELLATION_REASON_USER_DELINQUENCY Cancellation due to user delinquency
CANCELLATION_REASON_OTHER Other reason.

LineItem

Individual line item definition of a subscription. Next id: 9

JSON representation
{
  "product": string,
  "description": string,
  "lineItemPromotionSpecs": [
    {
      object (PromotionSpec)
    }
  ],
  "state": enum (LineItemState),
  "lineItemFreeTrialEndTime": string,
  "recurrenceType": enum (LineItemRecurrenceType),
  "oneTimeRecurrenceDetails": {
    object (OneTimeRecurrenceDetails)
  },
  "productPayload": {
    object (ProductPayload)
  }
}
Fields
product

string

Required. Product resource name that identifies one the line item The format is 'partners/{partner_id}/products/{product_id}'.

description

string

Output only. Description of this line item.

lineItemPromotionSpecs[]

object (PromotionSpec)

Optional. The promotions applied on the line item. It can be: - a free trial promotion, which overrides the subscription-level free trial promotion. - an introductory pricing promotion. When used as input in Create or Provision API, specify its resource name only.

state

enum (LineItemState)

Output only. The state of the line item.

lineItemFreeTrialEndTime

string (Timestamp format)

Output only. It is set only if the line item has its own free trial applied. End time of the line item free trial period, in ISO 8061 format. For example, "2019-08-31T17:28:54.564Z". It will be set the same as createTime if no free trial promotion is specified.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

recurrenceType

enum (LineItemRecurrenceType)

Output only. The recurrence type of the line item.

oneTimeRecurrenceDetails

object (OneTimeRecurrenceDetails)

Output only. Details only set for a ONE_TIME recurrence line item.

productPayload

object (ProductPayload)

Optional. Product specific payload for this line item.

LineItemState

The state of a subscription line item.

Enums
LINE_ITEM_STATE_UNSPECIFIED Unspecified state.
LINE_ITEM_STATE_ACTIVE The line item is in ACTIVE state.
LINE_ITEM_STATE_INACTIVE The line item is in INACTIVE state.
LINE_ITEM_STATE_NEW The line item is new, and is not activated or charged yet.
LINE_ITEM_STATE_ACTIVATING The line item is being activated in order to be charged. If a free trial applies to the line item, the line item is pending a prorated charge at the end of the free trial period, as indicated by lineItemFreeTrialEndTime.
LINE_ITEM_STATE_DEACTIVATING The line item is being deactivated.

LineItemRecurrenceType

The recurrence type of the line item.

Enums
LINE_ITEM_RECURRENCE_TYPE_UNSPECIFIED The line item recurrence type is unspecified.
LINE_ITEM_RECURRENCE_TYPE_PERIODIC The line item recurs periodically.
LINE_ITEM_RECURRENCE_TYPE_ONE_TIME The line item does not recur in the future.

OneTimeRecurrenceDetails

Details for a ONE_TIME recurrence line item.

JSON representation
{
  "servicePeriod": {
    object (ServicePeriod)
  }
}
Fields
servicePeriod

object (ServicePeriod)

The service period of the ONE_TIME line item.

ProductPayload

Specifies product specific payload.

JSON representation
{

  // Union field payload can be only one of the following:
  "googleOnePayload": {
    object (GoogleOnePayload)
  },
  "youtubePayload": {
    object (YoutubePayload)
  }
  // End of list of possible types for union field payload.
}
Fields
Union field payload. Product-specific payloads. payload can be only one of the following:
googleOnePayload

object (GoogleOnePayload)

Payload specific to Google One products.

youtubePayload

object (YoutubePayload)

Payload specific to Youtube products.

GoogleOnePayload

Payload specific to Google One products.

YoutubePayload

Payload specific to Youtube products.

JSON representation
{
  "partnerEligibilityIds": [
    string
  ]
}
Fields
partnerEligibilityIds[]

string

The list of eligibility_ids which are applicable for the line item.

Methods

authorizeAddon

Used by Google to check with reseller whether an add-on to the subscription is authorized.

Note: The POST URL shown here is for illustrative purpose only.

authorizeSignup

Used by Google to check with reseller whether the subscription signup is authorized.

Note: The POST URL shown here is for illustrative purpose only.

cancel

Used by partners to cancel a subscription service either immediately or by the end of the current billing cycle for their customers.

create

Used by partners to create a subscription for their customers.

entitle

Used by partners to entitle a previously provisioned subscription to the current end user.

extend

Used by partners to extend a subscription service for their customers on an ongoing basis for the subscription to remain active and renewable.

get

Used by partners to get a subscription by id.

provision

Used by partners to provision a subscription for their customers.

undoCancel

Used by partners to revoke the pending cancellation of a subscription, which is currently in STATE_CANCEL_AT_END_OF_CYCLE state.