Payments Reseller Subscription API . partners . subscriptions

Instance Methods

cancel(name, body=None, x__xgafv=None)

Used by partners to cancel a subscription service either immediately or by the end of the current billing cycle for their customers. It should be called directly by the partner using service accounts.

close()

Close httplib2 connections.

create(parent, body=None, subscriptionId=None, x__xgafv=None)

Used by partners to create a subscription for their customers. The created subscription is associated with the end user inferred from the end user credentials. This API must be authorized by the end user using OAuth.

entitle(name, body=None, x__xgafv=None)

Used by partners to entitle a previously provisioned subscription to the current end user. The end user identity is inferred from the authorized credential of the request. This API must be authorized by the end user using OAuth.

extend(name, body=None, x__xgafv=None)

[Opt-in only] Most partners should be on auto-extend by default. Used by partners to extend a subscription service for their customers on an ongoing basis for the subscription to remain active and renewable. It should be called directly by the partner using service accounts.

get(name, x__xgafv=None)

Used by partners to get a subscription by id. It should be called directly by the partner using service accounts.

provision(parent, body=None, subscriptionId=None, x__xgafv=None)

Used by partners to provision a subscription for their customers. This creates a subscription without associating it with the end user account. EntitleSubscription must be called separately using OAuth in order for the end user account to be associated with the subscription. It should be called directly by the partner using service accounts.

undoCancel(name, body=None, x__xgafv=None)

Used by partners to revoke the pending cancellation of a subscription, which is currently in `STATE_CANCEL_AT_END_OF_CYCLE` state. If the subscription is already cancelled, the request will fail. It should be called directly by the partner using service accounts.

Method Details

cancel(name, body=None, x__xgafv=None)
Used by partners to cancel a subscription service either immediately or by the end of the current billing cycle for their customers. It should be called directly by the partner using service accounts.

Args:
  name: string, Required. The name of the subscription resource to be cancelled. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}" (required)
  body: object, The request body.
    The object takes the form of:

{ # Request to cancel a subscription.
  "cancelImmediately": True or False, # Optional. If true, Google will cancel the subscription immediately, and may or may not (based on the contract) issue a prorated refund for the remainder of the billing cycle. Otherwise, Google defers the cancelation at renewal_time, and will not issue a refund.
  "cancellationReason": "A String", # Specifies the reason for the cancellation.
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response that contains the cancelled subscription resource.
  "subscription": { # A subscription serves as a central billing entity between an external partner and Google. The underlying Google services rely on the subscription state to grant or revoke the user's service entitlement. It's important to note that the subscription state may not always perfectly align with the user's service entitlement. For example, some Google services may continue providing access to the user until the current billing cycle ends, even if the subscription has been immediately canceled. However, other services may not do the same. To fully understand the specific details, please consult the relevant contract or product policy. # The cancelled subscription resource.
    "cancellationDetails": { # Describes the details of a cancelled or cancelling subscription. # Output only. Describes the details of a cancelled subscription. Only applicable to subscription of state `STATE_CANCELLED`.
      "reason": "A String", # Output only. The reason of the cancellation.
    },
    "createTime": "A String", # Output only. System generated timestamp when the subscription is created. UTC timezone.
    "cycleEndTime": "A String", # 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"
    "endUserEntitled": True or False, # Output only. Indicates if the subscription is entitled to the end user.
    "freeTrialEndTime": "A String", # 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.
    "lineItems": [ # Required. The line items of the subscription.
      { # Individual line item definition of a subscription.
        "amount": { # Describes the amount unit including the currency code. # Output only. The price of the product/service in this line item. The amount could be the wholesale price, or it can include a cost of sale based on the contract.
          "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
          "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
        },
        "bundleDetails": { # The bundle details for a line item corresponding to a hard bundle. # Output only. The bundle details for the line item. Only populated if the line item corresponds to a hard bundle.
          "bundleElementDetails": [ # Output only. The details for each element in the hard bundle.
            { # The details for an element in the hard bundle.
              "product": "A String", # Output only. Product resource name that identifies the bundle element. The format is 'partners/{partner_id}/products/{product_id}'.
              "userAccountLinkedTime": "A String", # Output only. The time when this product is linked to an end user.
            },
          ],
        },
        "description": "A String", # Output only. Description of this line item.
        "finiteBillingCycleDetails": { # Details for a subscriptiin line item with finite billing cycles. # Optional. Details for a subscription line item with finite billing cycles. If unset, the line item will be charged indefinitely. Used only with LINE_ITEM_RECURRENCE_TYPE_PERIODIC.
          "billingCycleCountLimit": "A String", # Required. The number of a subscription line item billing cycles after which billing will stop automatically.
        },
        "lineItemFreeTrialEndTime": "A String", # Output only. The free trial end time will be populated after the line item is successfully processed. 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.
        "lineItemIndex": 42, # Output only. A unique index of the subscription line item.
        "lineItemPromotionSpecs": [ # Optional. The promotions applied on the line item. It can be: - an introductory pricing promotion. - a free trial promotion. This feature is not enabled. If used, the request will be rejected. When used as input in Create or Provision API, specify its resource name only.
          { # Describes the spec for one promotion.
            "freeTrialDuration": { # Describes the length of a period of a time. # Output only. The duration of the free trial if the promotion is of type FREE_TRIAL.
              "count": 42, # number of duration units to be included.
              "unit": "A String", # The unit used for the duration
            },
            "introductoryPricingDetails": { # The details of a introductory pricing promotion. # Output only. The details of the introductory pricing spec if the promotion is of type INTRODUCTORY_PRICING.
              "introductoryPricingSpecs": [ # Output only. Specifies the introductory pricing periods.
                { # The duration of an introductory pricing promotion.
                  "discountAmount": { # Describes the amount unit including the currency code. # Output only. The discount amount. The value is positive.
                    "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
                    "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
                  },
                  "discountRatioMicros": "A String", # Output only. The discount percentage in micros. For example, 50,000 represents 5%.
                  "recurrenceCount": 42, # Output only. Output Only. The duration of an introductory offer in billing cycles.
                  "regionCode": "A String", # Output only. 2-letter ISO region code where the product is available in. Ex. "US".
                },
              ],
            },
            "promotion": "A String", # Required. Promotion resource name that identifies a promotion. The format is 'partners/{partner_id}/promotions/{promotion_id}'.
            "type": "A String", # Output only. The type of the promotion for the spec.
          },
        ],
        "oneTimeRecurrenceDetails": { # Details for a ONE_TIME recurrence line item. # Output only. Details only set for a ONE_TIME recurrence line item.
          "servicePeriod": { # A description of what time period or moment in time the product or service is being delivered over. # Output only. The service period of the ONE_TIME line item.
            "endTime": "A String", # Optional. The end time of the service period. Time is exclusive.
            "startTime": "A String", # Required. The start time of the service period. Time is inclusive.
          },
        },
        "product": "A String", # Required. Product resource name that identifies one the line item The format is 'partners/{partner_id}/products/{product_id}'.
        "productPayload": { # Specifies product specific payload. # Optional. Product specific payload for this line item.
          "googleOnePayload": { # Payload specific to Google One products. # Product-specific payloads. Payload specific to Google One products.
            "campaigns": [ # Campaign attributed to sales of this subscription.
              "A String",
            ],
            "offering": "A String", # The type of offering the subscription was sold by the partner. e.g. VAS.
            "salesChannel": "A String", # The type of sales channel through which the subscription was sold.
            "storeId": "A String", # The identifier for the partner store where the subscription was sold.
          },
          "youtubePayload": { # Payload specific to Youtube products. # Payload specific to Youtube products.
            "accessEndTime": "A String", # Output only. The access expiration time for this line item.
            "partnerEligibilityIds": [ # The list of eligibility_ids which are applicable for the line item.
              "A String",
            ],
            "partnerPlanType": "A String", # Optional. Specifies the plan type offered to the end user by the partner.
          },
        },
        "recurrenceType": "A String", # Output only. The recurrence type of the line item.
        "state": "A String", # Output only. The state of the line item.
      },
    ],
    "name": "A String", # Identifier. Resource name of the subscription. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}". This is available for authorizeAddon, but otherwise is response only.
    "partnerUserToken": "A String", # Required. Identifier of the end-user in partner’s system. The value is restricted to 63 ASCII characters at the maximum.
    "processingState": "A String", # Output only. Describes the processing state of the subscription. See more details at [the lifecycle of a subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle).
    "products": [ # Optional. Deprecated: consider using `line_items` as the input. Required. Resource name that identifies the purchased products. The format will be 'partners/{partner_id}/products/{product_id}'.
      "A String",
    ],
    "promotionSpecs": [ # 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.
      { # Describes the spec for one promotion.
        "freeTrialDuration": { # Describes the length of a period of a time. # Output only. The duration of the free trial if the promotion is of type FREE_TRIAL.
          "count": 42, # number of duration units to be included.
          "unit": "A String", # The unit used for the duration
        },
        "introductoryPricingDetails": { # The details of a introductory pricing promotion. # Output only. The details of the introductory pricing spec if the promotion is of type INTRODUCTORY_PRICING.
          "introductoryPricingSpecs": [ # Output only. Specifies the introductory pricing periods.
            { # The duration of an introductory pricing promotion.
              "discountAmount": { # Describes the amount unit including the currency code. # Output only. The discount amount. The value is positive.
                "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
                "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
              },
              "discountRatioMicros": "A String", # Output only. The discount percentage in micros. For example, 50,000 represents 5%.
              "recurrenceCount": 42, # Output only. Output Only. The duration of an introductory offer in billing cycles.
              "regionCode": "A String", # Output only. 2-letter ISO region code where the product is available in. Ex. "US".
            },
          ],
        },
        "promotion": "A String", # Required. Promotion resource name that identifies a promotion. The format is 'partners/{partner_id}/promotions/{promotion_id}'.
        "type": "A String", # Output only. The type of the promotion for the spec.
      },
    ],
    "promotions": [ # Optional. Deprecated: consider using the top-level `promotion_specs` 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}'.
      "A String",
    ],
    "purchaseTime": "A String", # Optional. The timestamp when the user transaction was made with the Partner. Specify for the case of "bundle with choice", and it must be before the provision_time (when the user makes a selection).
    "redirectUri": "A 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.
    "renewalTime": "A String", # 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"
    "serviceLocation": { # Describes a location of an end user. # Required. The location that the service is provided as indicated by the partner.
      "postalCode": "A String", # The postal code this location refers to. Ex. "94043"
      "regionCode": "A String", # 2-letter ISO region code for current content region. Ex. “US” Please refers to: https://en.wikipedia.org/wiki/ISO_3166-1
    },
    "state": "A String", # Output only. Describes the state of the subscription. See more details at [the lifecycle of a subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle).
    "updateTime": "A String", # Output only. System generated timestamp when the subscription is most recently updated. UTC timezone.
    "upgradeDowngradeDetails": { # Details about the previous subscription that this new subscription upgrades/downgrades from. # 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.
      "billingCycleSpec": "A String", # Required. Specifies the billing cycle spec for the new upgraded/downgraded subscription.
      "previousSubscriptionId": "A String", # Required. The previous subscription id to be replaced. This is not the full resource name, use the subscription_id segment only.
    },
  },
}
close()
Close httplib2 connections.
create(parent, body=None, subscriptionId=None, x__xgafv=None)
Used by partners to create a subscription for their customers. The created subscription is associated with the end user inferred from the end user credentials. This API must be authorized by the end user using OAuth.

Args:
  parent: string, Required. The parent resource name, which is the identifier of the partner. It will have the format of "partners/{partner_id}". (required)
  body: object, The request body.
    The object takes the form of:

{ # A subscription serves as a central billing entity between an external partner and Google. The underlying Google services rely on the subscription state to grant or revoke the user's service entitlement. It's important to note that the subscription state may not always perfectly align with the user's service entitlement. For example, some Google services may continue providing access to the user until the current billing cycle ends, even if the subscription has been immediately canceled. However, other services may not do the same. To fully understand the specific details, please consult the relevant contract or product policy.
  "cancellationDetails": { # Describes the details of a cancelled or cancelling subscription. # Output only. Describes the details of a cancelled subscription. Only applicable to subscription of state `STATE_CANCELLED`.
    "reason": "A String", # Output only. The reason of the cancellation.
  },
  "createTime": "A String", # Output only. System generated timestamp when the subscription is created. UTC timezone.
  "cycleEndTime": "A String", # 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"
  "endUserEntitled": True or False, # Output only. Indicates if the subscription is entitled to the end user.
  "freeTrialEndTime": "A String", # 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.
  "lineItems": [ # Required. The line items of the subscription.
    { # Individual line item definition of a subscription.
      "amount": { # Describes the amount unit including the currency code. # Output only. The price of the product/service in this line item. The amount could be the wholesale price, or it can include a cost of sale based on the contract.
        "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
        "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
      },
      "bundleDetails": { # The bundle details for a line item corresponding to a hard bundle. # Output only. The bundle details for the line item. Only populated if the line item corresponds to a hard bundle.
        "bundleElementDetails": [ # Output only. The details for each element in the hard bundle.
          { # The details for an element in the hard bundle.
            "product": "A String", # Output only. Product resource name that identifies the bundle element. The format is 'partners/{partner_id}/products/{product_id}'.
            "userAccountLinkedTime": "A String", # Output only. The time when this product is linked to an end user.
          },
        ],
      },
      "description": "A String", # Output only. Description of this line item.
      "finiteBillingCycleDetails": { # Details for a subscriptiin line item with finite billing cycles. # Optional. Details for a subscription line item with finite billing cycles. If unset, the line item will be charged indefinitely. Used only with LINE_ITEM_RECURRENCE_TYPE_PERIODIC.
        "billingCycleCountLimit": "A String", # Required. The number of a subscription line item billing cycles after which billing will stop automatically.
      },
      "lineItemFreeTrialEndTime": "A String", # Output only. The free trial end time will be populated after the line item is successfully processed. 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.
      "lineItemIndex": 42, # Output only. A unique index of the subscription line item.
      "lineItemPromotionSpecs": [ # Optional. The promotions applied on the line item. It can be: - an introductory pricing promotion. - a free trial promotion. This feature is not enabled. If used, the request will be rejected. When used as input in Create or Provision API, specify its resource name only.
        { # Describes the spec for one promotion.
          "freeTrialDuration": { # Describes the length of a period of a time. # Output only. The duration of the free trial if the promotion is of type FREE_TRIAL.
            "count": 42, # number of duration units to be included.
            "unit": "A String", # The unit used for the duration
          },
          "introductoryPricingDetails": { # The details of a introductory pricing promotion. # Output only. The details of the introductory pricing spec if the promotion is of type INTRODUCTORY_PRICING.
            "introductoryPricingSpecs": [ # Output only. Specifies the introductory pricing periods.
              { # The duration of an introductory pricing promotion.
                "discountAmount": { # Describes the amount unit including the currency code. # Output only. The discount amount. The value is positive.
                  "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
                  "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
                },
                "discountRatioMicros": "A String", # Output only. The discount percentage in micros. For example, 50,000 represents 5%.
                "recurrenceCount": 42, # Output only. Output Only. The duration of an introductory offer in billing cycles.
                "regionCode": "A String", # Output only. 2-letter ISO region code where the product is available in. Ex. "US".
              },
            ],
          },
          "promotion": "A String", # Required. Promotion resource name that identifies a promotion. The format is 'partners/{partner_id}/promotions/{promotion_id}'.
          "type": "A String", # Output only. The type of the promotion for the spec.
        },
      ],
      "oneTimeRecurrenceDetails": { # Details for a ONE_TIME recurrence line item. # Output only. Details only set for a ONE_TIME recurrence line item.
        "servicePeriod": { # A description of what time period or moment in time the product or service is being delivered over. # Output only. The service period of the ONE_TIME line item.
          "endTime": "A String", # Optional. The end time of the service period. Time is exclusive.
          "startTime": "A String", # Required. The start time of the service period. Time is inclusive.
        },
      },
      "product": "A String", # Required. Product resource name that identifies one the line item The format is 'partners/{partner_id}/products/{product_id}'.
      "productPayload": { # Specifies product specific payload. # Optional. Product specific payload for this line item.
        "googleOnePayload": { # Payload specific to Google One products. # Product-specific payloads. Payload specific to Google One products.
          "campaigns": [ # Campaign attributed to sales of this subscription.
            "A String",
          ],
          "offering": "A String", # The type of offering the subscription was sold by the partner. e.g. VAS.
          "salesChannel": "A String", # The type of sales channel through which the subscription was sold.
          "storeId": "A String", # The identifier for the partner store where the subscription was sold.
        },
        "youtubePayload": { # Payload specific to Youtube products. # Payload specific to Youtube products.
          "accessEndTime": "A String", # Output only. The access expiration time for this line item.
          "partnerEligibilityIds": [ # The list of eligibility_ids which are applicable for the line item.
            "A String",
          ],
          "partnerPlanType": "A String", # Optional. Specifies the plan type offered to the end user by the partner.
        },
      },
      "recurrenceType": "A String", # Output only. The recurrence type of the line item.
      "state": "A String", # Output only. The state of the line item.
    },
  ],
  "name": "A String", # Identifier. Resource name of the subscription. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}". This is available for authorizeAddon, but otherwise is response only.
  "partnerUserToken": "A String", # Required. Identifier of the end-user in partner’s system. The value is restricted to 63 ASCII characters at the maximum.
  "processingState": "A String", # Output only. Describes the processing state of the subscription. See more details at [the lifecycle of a subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle).
  "products": [ # Optional. Deprecated: consider using `line_items` as the input. Required. Resource name that identifies the purchased products. The format will be 'partners/{partner_id}/products/{product_id}'.
    "A String",
  ],
  "promotionSpecs": [ # 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.
    { # Describes the spec for one promotion.
      "freeTrialDuration": { # Describes the length of a period of a time. # Output only. The duration of the free trial if the promotion is of type FREE_TRIAL.
        "count": 42, # number of duration units to be included.
        "unit": "A String", # The unit used for the duration
      },
      "introductoryPricingDetails": { # The details of a introductory pricing promotion. # Output only. The details of the introductory pricing spec if the promotion is of type INTRODUCTORY_PRICING.
        "introductoryPricingSpecs": [ # Output only. Specifies the introductory pricing periods.
          { # The duration of an introductory pricing promotion.
            "discountAmount": { # Describes the amount unit including the currency code. # Output only. The discount amount. The value is positive.
              "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
              "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
            },
            "discountRatioMicros": "A String", # Output only. The discount percentage in micros. For example, 50,000 represents 5%.
            "recurrenceCount": 42, # Output only. Output Only. The duration of an introductory offer in billing cycles.
            "regionCode": "A String", # Output only. 2-letter ISO region code where the product is available in. Ex. "US".
          },
        ],
      },
      "promotion": "A String", # Required. Promotion resource name that identifies a promotion. The format is 'partners/{partner_id}/promotions/{promotion_id}'.
      "type": "A String", # Output only. The type of the promotion for the spec.
    },
  ],
  "promotions": [ # Optional. Deprecated: consider using the top-level `promotion_specs` 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}'.
    "A String",
  ],
  "purchaseTime": "A String", # Optional. The timestamp when the user transaction was made with the Partner. Specify for the case of "bundle with choice", and it must be before the provision_time (when the user makes a selection).
  "redirectUri": "A 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.
  "renewalTime": "A String", # 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"
  "serviceLocation": { # Describes a location of an end user. # Required. The location that the service is provided as indicated by the partner.
    "postalCode": "A String", # The postal code this location refers to. Ex. "94043"
    "regionCode": "A String", # 2-letter ISO region code for current content region. Ex. “US” Please refers to: https://en.wikipedia.org/wiki/ISO_3166-1
  },
  "state": "A String", # Output only. Describes the state of the subscription. See more details at [the lifecycle of a subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle).
  "updateTime": "A String", # Output only. System generated timestamp when the subscription is most recently updated. UTC timezone.
  "upgradeDowngradeDetails": { # Details about the previous subscription that this new subscription upgrades/downgrades from. # 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.
    "billingCycleSpec": "A String", # Required. Specifies the billing cycle spec for the new upgraded/downgraded subscription.
    "previousSubscriptionId": "A String", # Required. The previous subscription id to be replaced. This is not the full resource name, use the subscription_id segment only.
  },
}

  subscriptionId: string, Required. Identifies the subscription resource on the Partner side. The value is restricted to 63 ASCII characters at the maximum. If a subscription was previously created with the same subscription_id, we will directly return that one.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # A subscription serves as a central billing entity between an external partner and Google. The underlying Google services rely on the subscription state to grant or revoke the user's service entitlement. It's important to note that the subscription state may not always perfectly align with the user's service entitlement. For example, some Google services may continue providing access to the user until the current billing cycle ends, even if the subscription has been immediately canceled. However, other services may not do the same. To fully understand the specific details, please consult the relevant contract or product policy.
  "cancellationDetails": { # Describes the details of a cancelled or cancelling subscription. # Output only. Describes the details of a cancelled subscription. Only applicable to subscription of state `STATE_CANCELLED`.
    "reason": "A String", # Output only. The reason of the cancellation.
  },
  "createTime": "A String", # Output only. System generated timestamp when the subscription is created. UTC timezone.
  "cycleEndTime": "A String", # 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"
  "endUserEntitled": True or False, # Output only. Indicates if the subscription is entitled to the end user.
  "freeTrialEndTime": "A String", # 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.
  "lineItems": [ # Required. The line items of the subscription.
    { # Individual line item definition of a subscription.
      "amount": { # Describes the amount unit including the currency code. # Output only. The price of the product/service in this line item. The amount could be the wholesale price, or it can include a cost of sale based on the contract.
        "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
        "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
      },
      "bundleDetails": { # The bundle details for a line item corresponding to a hard bundle. # Output only. The bundle details for the line item. Only populated if the line item corresponds to a hard bundle.
        "bundleElementDetails": [ # Output only. The details for each element in the hard bundle.
          { # The details for an element in the hard bundle.
            "product": "A String", # Output only. Product resource name that identifies the bundle element. The format is 'partners/{partner_id}/products/{product_id}'.
            "userAccountLinkedTime": "A String", # Output only. The time when this product is linked to an end user.
          },
        ],
      },
      "description": "A String", # Output only. Description of this line item.
      "finiteBillingCycleDetails": { # Details for a subscriptiin line item with finite billing cycles. # Optional. Details for a subscription line item with finite billing cycles. If unset, the line item will be charged indefinitely. Used only with LINE_ITEM_RECURRENCE_TYPE_PERIODIC.
        "billingCycleCountLimit": "A String", # Required. The number of a subscription line item billing cycles after which billing will stop automatically.
      },
      "lineItemFreeTrialEndTime": "A String", # Output only. The free trial end time will be populated after the line item is successfully processed. 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.
      "lineItemIndex": 42, # Output only. A unique index of the subscription line item.
      "lineItemPromotionSpecs": [ # Optional. The promotions applied on the line item. It can be: - an introductory pricing promotion. - a free trial promotion. This feature is not enabled. If used, the request will be rejected. When used as input in Create or Provision API, specify its resource name only.
        { # Describes the spec for one promotion.
          "freeTrialDuration": { # Describes the length of a period of a time. # Output only. The duration of the free trial if the promotion is of type FREE_TRIAL.
            "count": 42, # number of duration units to be included.
            "unit": "A String", # The unit used for the duration
          },
          "introductoryPricingDetails": { # The details of a introductory pricing promotion. # Output only. The details of the introductory pricing spec if the promotion is of type INTRODUCTORY_PRICING.
            "introductoryPricingSpecs": [ # Output only. Specifies the introductory pricing periods.
              { # The duration of an introductory pricing promotion.
                "discountAmount": { # Describes the amount unit including the currency code. # Output only. The discount amount. The value is positive.
                  "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
                  "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
                },
                "discountRatioMicros": "A String", # Output only. The discount percentage in micros. For example, 50,000 represents 5%.
                "recurrenceCount": 42, # Output only. Output Only. The duration of an introductory offer in billing cycles.
                "regionCode": "A String", # Output only. 2-letter ISO region code where the product is available in. Ex. "US".
              },
            ],
          },
          "promotion": "A String", # Required. Promotion resource name that identifies a promotion. The format is 'partners/{partner_id}/promotions/{promotion_id}'.
          "type": "A String", # Output only. The type of the promotion for the spec.
        },
      ],
      "oneTimeRecurrenceDetails": { # Details for a ONE_TIME recurrence line item. # Output only. Details only set for a ONE_TIME recurrence line item.
        "servicePeriod": { # A description of what time period or moment in time the product or service is being delivered over. # Output only. The service period of the ONE_TIME line item.
          "endTime": "A String", # Optional. The end time of the service period. Time is exclusive.
          "startTime": "A String", # Required. The start time of the service period. Time is inclusive.
        },
      },
      "product": "A String", # Required. Product resource name that identifies one the line item The format is 'partners/{partner_id}/products/{product_id}'.
      "productPayload": { # Specifies product specific payload. # Optional. Product specific payload for this line item.
        "googleOnePayload": { # Payload specific to Google One products. # Product-specific payloads. Payload specific to Google One products.
          "campaigns": [ # Campaign attributed to sales of this subscription.
            "A String",
          ],
          "offering": "A String", # The type of offering the subscription was sold by the partner. e.g. VAS.
          "salesChannel": "A String", # The type of sales channel through which the subscription was sold.
          "storeId": "A String", # The identifier for the partner store where the subscription was sold.
        },
        "youtubePayload": { # Payload specific to Youtube products. # Payload specific to Youtube products.
          "accessEndTime": "A String", # Output only. The access expiration time for this line item.
          "partnerEligibilityIds": [ # The list of eligibility_ids which are applicable for the line item.
            "A String",
          ],
          "partnerPlanType": "A String", # Optional. Specifies the plan type offered to the end user by the partner.
        },
      },
      "recurrenceType": "A String", # Output only. The recurrence type of the line item.
      "state": "A String", # Output only. The state of the line item.
    },
  ],
  "name": "A String", # Identifier. Resource name of the subscription. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}". This is available for authorizeAddon, but otherwise is response only.
  "partnerUserToken": "A String", # Required. Identifier of the end-user in partner’s system. The value is restricted to 63 ASCII characters at the maximum.
  "processingState": "A String", # Output only. Describes the processing state of the subscription. See more details at [the lifecycle of a subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle).
  "products": [ # Optional. Deprecated: consider using `line_items` as the input. Required. Resource name that identifies the purchased products. The format will be 'partners/{partner_id}/products/{product_id}'.
    "A String",
  ],
  "promotionSpecs": [ # 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.
    { # Describes the spec for one promotion.
      "freeTrialDuration": { # Describes the length of a period of a time. # Output only. The duration of the free trial if the promotion is of type FREE_TRIAL.
        "count": 42, # number of duration units to be included.
        "unit": "A String", # The unit used for the duration
      },
      "introductoryPricingDetails": { # The details of a introductory pricing promotion. # Output only. The details of the introductory pricing spec if the promotion is of type INTRODUCTORY_PRICING.
        "introductoryPricingSpecs": [ # Output only. Specifies the introductory pricing periods.
          { # The duration of an introductory pricing promotion.
            "discountAmount": { # Describes the amount unit including the currency code. # Output only. The discount amount. The value is positive.
              "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
              "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
            },
            "discountRatioMicros": "A String", # Output only. The discount percentage in micros. For example, 50,000 represents 5%.
            "recurrenceCount": 42, # Output only. Output Only. The duration of an introductory offer in billing cycles.
            "regionCode": "A String", # Output only. 2-letter ISO region code where the product is available in. Ex. "US".
          },
        ],
      },
      "promotion": "A String", # Required. Promotion resource name that identifies a promotion. The format is 'partners/{partner_id}/promotions/{promotion_id}'.
      "type": "A String", # Output only. The type of the promotion for the spec.
    },
  ],
  "promotions": [ # Optional. Deprecated: consider using the top-level `promotion_specs` 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}'.
    "A String",
  ],
  "purchaseTime": "A String", # Optional. The timestamp when the user transaction was made with the Partner. Specify for the case of "bundle with choice", and it must be before the provision_time (when the user makes a selection).
  "redirectUri": "A 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.
  "renewalTime": "A String", # 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"
  "serviceLocation": { # Describes a location of an end user. # Required. The location that the service is provided as indicated by the partner.
    "postalCode": "A String", # The postal code this location refers to. Ex. "94043"
    "regionCode": "A String", # 2-letter ISO region code for current content region. Ex. “US” Please refers to: https://en.wikipedia.org/wiki/ISO_3166-1
  },
  "state": "A String", # Output only. Describes the state of the subscription. See more details at [the lifecycle of a subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle).
  "updateTime": "A String", # Output only. System generated timestamp when the subscription is most recently updated. UTC timezone.
  "upgradeDowngradeDetails": { # Details about the previous subscription that this new subscription upgrades/downgrades from. # 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.
    "billingCycleSpec": "A String", # Required. Specifies the billing cycle spec for the new upgraded/downgraded subscription.
    "previousSubscriptionId": "A String", # Required. The previous subscription id to be replaced. This is not the full resource name, use the subscription_id segment only.
  },
}
entitle(name, body=None, x__xgafv=None)
Used by partners to entitle a previously provisioned subscription to the current end user. The end user identity is inferred from the authorized credential of the request. This API must be authorized by the end user using OAuth.

Args:
  name: string, Required. The name of the subscription resource that is entitled to the current end user. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}" (required)
  body: object, The request body.
    The object takes the form of:

{ # Partner request for entitling the previously provisioned subscription to an end user. The end user identity is inferred from the request OAuth context.
  "lineItemEntitlementDetails": [ # Optional. The line items to be entitled. If unspecified, all line items will be entitled.
    { # The details of the line item to be entitled.
      "lineItemIndex": 42, # Required. The index of the line item to be entitled.
      "products": [ # Optional. Only applicable if the line item corresponds to a hard bundle. Product resource names that identify the bundle elements to be entitled in the line item. If unspecified, all bundle elements will be entitled. The format is 'partners/{partner_id}/products/{product_id}'.
        "A String",
      ],
    },
  ],
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response that contains the entitled subscription resource.
  "subscription": { # A subscription serves as a central billing entity between an external partner and Google. The underlying Google services rely on the subscription state to grant or revoke the user's service entitlement. It's important to note that the subscription state may not always perfectly align with the user's service entitlement. For example, some Google services may continue providing access to the user until the current billing cycle ends, even if the subscription has been immediately canceled. However, other services may not do the same. To fully understand the specific details, please consult the relevant contract or product policy. # The subscription that has user linked to it.
    "cancellationDetails": { # Describes the details of a cancelled or cancelling subscription. # Output only. Describes the details of a cancelled subscription. Only applicable to subscription of state `STATE_CANCELLED`.
      "reason": "A String", # Output only. The reason of the cancellation.
    },
    "createTime": "A String", # Output only. System generated timestamp when the subscription is created. UTC timezone.
    "cycleEndTime": "A String", # 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"
    "endUserEntitled": True or False, # Output only. Indicates if the subscription is entitled to the end user.
    "freeTrialEndTime": "A String", # 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.
    "lineItems": [ # Required. The line items of the subscription.
      { # Individual line item definition of a subscription.
        "amount": { # Describes the amount unit including the currency code. # Output only. The price of the product/service in this line item. The amount could be the wholesale price, or it can include a cost of sale based on the contract.
          "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
          "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
        },
        "bundleDetails": { # The bundle details for a line item corresponding to a hard bundle. # Output only. The bundle details for the line item. Only populated if the line item corresponds to a hard bundle.
          "bundleElementDetails": [ # Output only. The details for each element in the hard bundle.
            { # The details for an element in the hard bundle.
              "product": "A String", # Output only. Product resource name that identifies the bundle element. The format is 'partners/{partner_id}/products/{product_id}'.
              "userAccountLinkedTime": "A String", # Output only. The time when this product is linked to an end user.
            },
          ],
        },
        "description": "A String", # Output only. Description of this line item.
        "finiteBillingCycleDetails": { # Details for a subscriptiin line item with finite billing cycles. # Optional. Details for a subscription line item with finite billing cycles. If unset, the line item will be charged indefinitely. Used only with LINE_ITEM_RECURRENCE_TYPE_PERIODIC.
          "billingCycleCountLimit": "A String", # Required. The number of a subscription line item billing cycles after which billing will stop automatically.
        },
        "lineItemFreeTrialEndTime": "A String", # Output only. The free trial end time will be populated after the line item is successfully processed. 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.
        "lineItemIndex": 42, # Output only. A unique index of the subscription line item.
        "lineItemPromotionSpecs": [ # Optional. The promotions applied on the line item. It can be: - an introductory pricing promotion. - a free trial promotion. This feature is not enabled. If used, the request will be rejected. When used as input in Create or Provision API, specify its resource name only.
          { # Describes the spec for one promotion.
            "freeTrialDuration": { # Describes the length of a period of a time. # Output only. The duration of the free trial if the promotion is of type FREE_TRIAL.
              "count": 42, # number of duration units to be included.
              "unit": "A String", # The unit used for the duration
            },
            "introductoryPricingDetails": { # The details of a introductory pricing promotion. # Output only. The details of the introductory pricing spec if the promotion is of type INTRODUCTORY_PRICING.
              "introductoryPricingSpecs": [ # Output only. Specifies the introductory pricing periods.
                { # The duration of an introductory pricing promotion.
                  "discountAmount": { # Describes the amount unit including the currency code. # Output only. The discount amount. The value is positive.
                    "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
                    "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
                  },
                  "discountRatioMicros": "A String", # Output only. The discount percentage in micros. For example, 50,000 represents 5%.
                  "recurrenceCount": 42, # Output only. Output Only. The duration of an introductory offer in billing cycles.
                  "regionCode": "A String", # Output only. 2-letter ISO region code where the product is available in. Ex. "US".
                },
              ],
            },
            "promotion": "A String", # Required. Promotion resource name that identifies a promotion. The format is 'partners/{partner_id}/promotions/{promotion_id}'.
            "type": "A String", # Output only. The type of the promotion for the spec.
          },
        ],
        "oneTimeRecurrenceDetails": { # Details for a ONE_TIME recurrence line item. # Output only. Details only set for a ONE_TIME recurrence line item.
          "servicePeriod": { # A description of what time period or moment in time the product or service is being delivered over. # Output only. The service period of the ONE_TIME line item.
            "endTime": "A String", # Optional. The end time of the service period. Time is exclusive.
            "startTime": "A String", # Required. The start time of the service period. Time is inclusive.
          },
        },
        "product": "A String", # Required. Product resource name that identifies one the line item The format is 'partners/{partner_id}/products/{product_id}'.
        "productPayload": { # Specifies product specific payload. # Optional. Product specific payload for this line item.
          "googleOnePayload": { # Payload specific to Google One products. # Product-specific payloads. Payload specific to Google One products.
            "campaigns": [ # Campaign attributed to sales of this subscription.
              "A String",
            ],
            "offering": "A String", # The type of offering the subscription was sold by the partner. e.g. VAS.
            "salesChannel": "A String", # The type of sales channel through which the subscription was sold.
            "storeId": "A String", # The identifier for the partner store where the subscription was sold.
          },
          "youtubePayload": { # Payload specific to Youtube products. # Payload specific to Youtube products.
            "accessEndTime": "A String", # Output only. The access expiration time for this line item.
            "partnerEligibilityIds": [ # The list of eligibility_ids which are applicable for the line item.
              "A String",
            ],
            "partnerPlanType": "A String", # Optional. Specifies the plan type offered to the end user by the partner.
          },
        },
        "recurrenceType": "A String", # Output only. The recurrence type of the line item.
        "state": "A String", # Output only. The state of the line item.
      },
    ],
    "name": "A String", # Identifier. Resource name of the subscription. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}". This is available for authorizeAddon, but otherwise is response only.
    "partnerUserToken": "A String", # Required. Identifier of the end-user in partner’s system. The value is restricted to 63 ASCII characters at the maximum.
    "processingState": "A String", # Output only. Describes the processing state of the subscription. See more details at [the lifecycle of a subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle).
    "products": [ # Optional. Deprecated: consider using `line_items` as the input. Required. Resource name that identifies the purchased products. The format will be 'partners/{partner_id}/products/{product_id}'.
      "A String",
    ],
    "promotionSpecs": [ # 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.
      { # Describes the spec for one promotion.
        "freeTrialDuration": { # Describes the length of a period of a time. # Output only. The duration of the free trial if the promotion is of type FREE_TRIAL.
          "count": 42, # number of duration units to be included.
          "unit": "A String", # The unit used for the duration
        },
        "introductoryPricingDetails": { # The details of a introductory pricing promotion. # Output only. The details of the introductory pricing spec if the promotion is of type INTRODUCTORY_PRICING.
          "introductoryPricingSpecs": [ # Output only. Specifies the introductory pricing periods.
            { # The duration of an introductory pricing promotion.
              "discountAmount": { # Describes the amount unit including the currency code. # Output only. The discount amount. The value is positive.
                "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
                "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
              },
              "discountRatioMicros": "A String", # Output only. The discount percentage in micros. For example, 50,000 represents 5%.
              "recurrenceCount": 42, # Output only. Output Only. The duration of an introductory offer in billing cycles.
              "regionCode": "A String", # Output only. 2-letter ISO region code where the product is available in. Ex. "US".
            },
          ],
        },
        "promotion": "A String", # Required. Promotion resource name that identifies a promotion. The format is 'partners/{partner_id}/promotions/{promotion_id}'.
        "type": "A String", # Output only. The type of the promotion for the spec.
      },
    ],
    "promotions": [ # Optional. Deprecated: consider using the top-level `promotion_specs` 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}'.
      "A String",
    ],
    "purchaseTime": "A String", # Optional. The timestamp when the user transaction was made with the Partner. Specify for the case of "bundle with choice", and it must be before the provision_time (when the user makes a selection).
    "redirectUri": "A 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.
    "renewalTime": "A String", # 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"
    "serviceLocation": { # Describes a location of an end user. # Required. The location that the service is provided as indicated by the partner.
      "postalCode": "A String", # The postal code this location refers to. Ex. "94043"
      "regionCode": "A String", # 2-letter ISO region code for current content region. Ex. “US” Please refers to: https://en.wikipedia.org/wiki/ISO_3166-1
    },
    "state": "A String", # Output only. Describes the state of the subscription. See more details at [the lifecycle of a subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle).
    "updateTime": "A String", # Output only. System generated timestamp when the subscription is most recently updated. UTC timezone.
    "upgradeDowngradeDetails": { # Details about the previous subscription that this new subscription upgrades/downgrades from. # 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.
      "billingCycleSpec": "A String", # Required. Specifies the billing cycle spec for the new upgraded/downgraded subscription.
      "previousSubscriptionId": "A String", # Required. The previous subscription id to be replaced. This is not the full resource name, use the subscription_id segment only.
    },
  },
}
extend(name, body=None, x__xgafv=None)
[Opt-in only] Most partners should be on auto-extend by default. Used by partners to extend a subscription service for their customers on an ongoing basis for the subscription to remain active and renewable. It should be called directly by the partner using service accounts.

Args:
  name: string, Required. The name of the subscription resource to be extended. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}". (required)
  body: object, The request body.
    The object takes the form of:

{ # Request message for extending a Subscription resource. A new recurrence will be made based on the subscription schedule defined by the original product.
  "extension": { # Describes the details of an extension request. # Required. Specifies details of the extension. Currently, the duration of the extension must be exactly one billing cycle of the original subscription.
    "duration": { # Describes the length of a period of a time. # Required. Specifies the period of access the subscription should grant.
      "count": 42, # number of duration units to be included.
      "unit": "A String", # The unit used for the duration
    },
    "partnerUserToken": "A String", # Required. Identifier of the end-user in partner’s system.
  },
  "requestId": "A String", # Required. Restricted to 36 ASCII characters. A random UUID is recommended. The idempotency key for the request. The ID generation logic is controlled by the partner. request_id should be the same as on retries of the same request. A different request_id must be used for a extension of a different cycle.
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response that contains the timestamps after the extension.
  "cycleEndTime": "A String", # The time at which the subscription is expected to be extended, in ISO 8061 format. UTC timezone. Example, "cycleEndTime":"2019-08-31T17:28:54.564Z"
  "freeTrialEndTime": "A String", # End of the free trial period, in ISO 8061 format. UTC timezone. Example, "freeTrialEndTime":"2019-08-31T17:28:54.564Z" This time will be set the same as initial subscription creation time if no free trial period is offered to the partner.
  "renewalTime": "A String", # 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"
}
get(name, x__xgafv=None)
Used by partners to get a subscription by id. It should be called directly by the partner using service accounts.

Args:
  name: string, Required. The name of the subscription resource to retrieve. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}" (required)
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # A subscription serves as a central billing entity between an external partner and Google. The underlying Google services rely on the subscription state to grant or revoke the user's service entitlement. It's important to note that the subscription state may not always perfectly align with the user's service entitlement. For example, some Google services may continue providing access to the user until the current billing cycle ends, even if the subscription has been immediately canceled. However, other services may not do the same. To fully understand the specific details, please consult the relevant contract or product policy.
  "cancellationDetails": { # Describes the details of a cancelled or cancelling subscription. # Output only. Describes the details of a cancelled subscription. Only applicable to subscription of state `STATE_CANCELLED`.
    "reason": "A String", # Output only. The reason of the cancellation.
  },
  "createTime": "A String", # Output only. System generated timestamp when the subscription is created. UTC timezone.
  "cycleEndTime": "A String", # 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"
  "endUserEntitled": True or False, # Output only. Indicates if the subscription is entitled to the end user.
  "freeTrialEndTime": "A String", # 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.
  "lineItems": [ # Required. The line items of the subscription.
    { # Individual line item definition of a subscription.
      "amount": { # Describes the amount unit including the currency code. # Output only. The price of the product/service in this line item. The amount could be the wholesale price, or it can include a cost of sale based on the contract.
        "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
        "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
      },
      "bundleDetails": { # The bundle details for a line item corresponding to a hard bundle. # Output only. The bundle details for the line item. Only populated if the line item corresponds to a hard bundle.
        "bundleElementDetails": [ # Output only. The details for each element in the hard bundle.
          { # The details for an element in the hard bundle.
            "product": "A String", # Output only. Product resource name that identifies the bundle element. The format is 'partners/{partner_id}/products/{product_id}'.
            "userAccountLinkedTime": "A String", # Output only. The time when this product is linked to an end user.
          },
        ],
      },
      "description": "A String", # Output only. Description of this line item.
      "finiteBillingCycleDetails": { # Details for a subscriptiin line item with finite billing cycles. # Optional. Details for a subscription line item with finite billing cycles. If unset, the line item will be charged indefinitely. Used only with LINE_ITEM_RECURRENCE_TYPE_PERIODIC.
        "billingCycleCountLimit": "A String", # Required. The number of a subscription line item billing cycles after which billing will stop automatically.
      },
      "lineItemFreeTrialEndTime": "A String", # Output only. The free trial end time will be populated after the line item is successfully processed. 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.
      "lineItemIndex": 42, # Output only. A unique index of the subscription line item.
      "lineItemPromotionSpecs": [ # Optional. The promotions applied on the line item. It can be: - an introductory pricing promotion. - a free trial promotion. This feature is not enabled. If used, the request will be rejected. When used as input in Create or Provision API, specify its resource name only.
        { # Describes the spec for one promotion.
          "freeTrialDuration": { # Describes the length of a period of a time. # Output only. The duration of the free trial if the promotion is of type FREE_TRIAL.
            "count": 42, # number of duration units to be included.
            "unit": "A String", # The unit used for the duration
          },
          "introductoryPricingDetails": { # The details of a introductory pricing promotion. # Output only. The details of the introductory pricing spec if the promotion is of type INTRODUCTORY_PRICING.
            "introductoryPricingSpecs": [ # Output only. Specifies the introductory pricing periods.
              { # The duration of an introductory pricing promotion.
                "discountAmount": { # Describes the amount unit including the currency code. # Output only. The discount amount. The value is positive.
                  "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
                  "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
                },
                "discountRatioMicros": "A String", # Output only. The discount percentage in micros. For example, 50,000 represents 5%.
                "recurrenceCount": 42, # Output only. Output Only. The duration of an introductory offer in billing cycles.
                "regionCode": "A String", # Output only. 2-letter ISO region code where the product is available in. Ex. "US".
              },
            ],
          },
          "promotion": "A String", # Required. Promotion resource name that identifies a promotion. The format is 'partners/{partner_id}/promotions/{promotion_id}'.
          "type": "A String", # Output only. The type of the promotion for the spec.
        },
      ],
      "oneTimeRecurrenceDetails": { # Details for a ONE_TIME recurrence line item. # Output only. Details only set for a ONE_TIME recurrence line item.
        "servicePeriod": { # A description of what time period or moment in time the product or service is being delivered over. # Output only. The service period of the ONE_TIME line item.
          "endTime": "A String", # Optional. The end time of the service period. Time is exclusive.
          "startTime": "A String", # Required. The start time of the service period. Time is inclusive.
        },
      },
      "product": "A String", # Required. Product resource name that identifies one the line item The format is 'partners/{partner_id}/products/{product_id}'.
      "productPayload": { # Specifies product specific payload. # Optional. Product specific payload for this line item.
        "googleOnePayload": { # Payload specific to Google One products. # Product-specific payloads. Payload specific to Google One products.
          "campaigns": [ # Campaign attributed to sales of this subscription.
            "A String",
          ],
          "offering": "A String", # The type of offering the subscription was sold by the partner. e.g. VAS.
          "salesChannel": "A String", # The type of sales channel through which the subscription was sold.
          "storeId": "A String", # The identifier for the partner store where the subscription was sold.
        },
        "youtubePayload": { # Payload specific to Youtube products. # Payload specific to Youtube products.
          "accessEndTime": "A String", # Output only. The access expiration time for this line item.
          "partnerEligibilityIds": [ # The list of eligibility_ids which are applicable for the line item.
            "A String",
          ],
          "partnerPlanType": "A String", # Optional. Specifies the plan type offered to the end user by the partner.
        },
      },
      "recurrenceType": "A String", # Output only. The recurrence type of the line item.
      "state": "A String", # Output only. The state of the line item.
    },
  ],
  "name": "A String", # Identifier. Resource name of the subscription. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}". This is available for authorizeAddon, but otherwise is response only.
  "partnerUserToken": "A String", # Required. Identifier of the end-user in partner’s system. The value is restricted to 63 ASCII characters at the maximum.
  "processingState": "A String", # Output only. Describes the processing state of the subscription. See more details at [the lifecycle of a subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle).
  "products": [ # Optional. Deprecated: consider using `line_items` as the input. Required. Resource name that identifies the purchased products. The format will be 'partners/{partner_id}/products/{product_id}'.
    "A String",
  ],
  "promotionSpecs": [ # 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.
    { # Describes the spec for one promotion.
      "freeTrialDuration": { # Describes the length of a period of a time. # Output only. The duration of the free trial if the promotion is of type FREE_TRIAL.
        "count": 42, # number of duration units to be included.
        "unit": "A String", # The unit used for the duration
      },
      "introductoryPricingDetails": { # The details of a introductory pricing promotion. # Output only. The details of the introductory pricing spec if the promotion is of type INTRODUCTORY_PRICING.
        "introductoryPricingSpecs": [ # Output only. Specifies the introductory pricing periods.
          { # The duration of an introductory pricing promotion.
            "discountAmount": { # Describes the amount unit including the currency code. # Output only. The discount amount. The value is positive.
              "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
              "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
            },
            "discountRatioMicros": "A String", # Output only. The discount percentage in micros. For example, 50,000 represents 5%.
            "recurrenceCount": 42, # Output only. Output Only. The duration of an introductory offer in billing cycles.
            "regionCode": "A String", # Output only. 2-letter ISO region code where the product is available in. Ex. "US".
          },
        ],
      },
      "promotion": "A String", # Required. Promotion resource name that identifies a promotion. The format is 'partners/{partner_id}/promotions/{promotion_id}'.
      "type": "A String", # Output only. The type of the promotion for the spec.
    },
  ],
  "promotions": [ # Optional. Deprecated: consider using the top-level `promotion_specs` 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}'.
    "A String",
  ],
  "purchaseTime": "A String", # Optional. The timestamp when the user transaction was made with the Partner. Specify for the case of "bundle with choice", and it must be before the provision_time (when the user makes a selection).
  "redirectUri": "A 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.
  "renewalTime": "A String", # 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"
  "serviceLocation": { # Describes a location of an end user. # Required. The location that the service is provided as indicated by the partner.
    "postalCode": "A String", # The postal code this location refers to. Ex. "94043"
    "regionCode": "A String", # 2-letter ISO region code for current content region. Ex. “US” Please refers to: https://en.wikipedia.org/wiki/ISO_3166-1
  },
  "state": "A String", # Output only. Describes the state of the subscription. See more details at [the lifecycle of a subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle).
  "updateTime": "A String", # Output only. System generated timestamp when the subscription is most recently updated. UTC timezone.
  "upgradeDowngradeDetails": { # Details about the previous subscription that this new subscription upgrades/downgrades from. # 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.
    "billingCycleSpec": "A String", # Required. Specifies the billing cycle spec for the new upgraded/downgraded subscription.
    "previousSubscriptionId": "A String", # Required. The previous subscription id to be replaced. This is not the full resource name, use the subscription_id segment only.
  },
}
provision(parent, body=None, subscriptionId=None, x__xgafv=None)
Used by partners to provision a subscription for their customers. This creates a subscription without associating it with the end user account. EntitleSubscription must be called separately using OAuth in order for the end user account to be associated with the subscription. It should be called directly by the partner using service accounts.

Args:
  parent: string, Required. The parent resource name, which is the identifier of the partner. It will have the format of "partners/{partner_id}". (required)
  body: object, The request body.
    The object takes the form of:

{ # A subscription serves as a central billing entity between an external partner and Google. The underlying Google services rely on the subscription state to grant or revoke the user's service entitlement. It's important to note that the subscription state may not always perfectly align with the user's service entitlement. For example, some Google services may continue providing access to the user until the current billing cycle ends, even if the subscription has been immediately canceled. However, other services may not do the same. To fully understand the specific details, please consult the relevant contract or product policy.
  "cancellationDetails": { # Describes the details of a cancelled or cancelling subscription. # Output only. Describes the details of a cancelled subscription. Only applicable to subscription of state `STATE_CANCELLED`.
    "reason": "A String", # Output only. The reason of the cancellation.
  },
  "createTime": "A String", # Output only. System generated timestamp when the subscription is created. UTC timezone.
  "cycleEndTime": "A String", # 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"
  "endUserEntitled": True or False, # Output only. Indicates if the subscription is entitled to the end user.
  "freeTrialEndTime": "A String", # 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.
  "lineItems": [ # Required. The line items of the subscription.
    { # Individual line item definition of a subscription.
      "amount": { # Describes the amount unit including the currency code. # Output only. The price of the product/service in this line item. The amount could be the wholesale price, or it can include a cost of sale based on the contract.
        "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
        "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
      },
      "bundleDetails": { # The bundle details for a line item corresponding to a hard bundle. # Output only. The bundle details for the line item. Only populated if the line item corresponds to a hard bundle.
        "bundleElementDetails": [ # Output only. The details for each element in the hard bundle.
          { # The details for an element in the hard bundle.
            "product": "A String", # Output only. Product resource name that identifies the bundle element. The format is 'partners/{partner_id}/products/{product_id}'.
            "userAccountLinkedTime": "A String", # Output only. The time when this product is linked to an end user.
          },
        ],
      },
      "description": "A String", # Output only. Description of this line item.
      "finiteBillingCycleDetails": { # Details for a subscriptiin line item with finite billing cycles. # Optional. Details for a subscription line item with finite billing cycles. If unset, the line item will be charged indefinitely. Used only with LINE_ITEM_RECURRENCE_TYPE_PERIODIC.
        "billingCycleCountLimit": "A String", # Required. The number of a subscription line item billing cycles after which billing will stop automatically.
      },
      "lineItemFreeTrialEndTime": "A String", # Output only. The free trial end time will be populated after the line item is successfully processed. 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.
      "lineItemIndex": 42, # Output only. A unique index of the subscription line item.
      "lineItemPromotionSpecs": [ # Optional. The promotions applied on the line item. It can be: - an introductory pricing promotion. - a free trial promotion. This feature is not enabled. If used, the request will be rejected. When used as input in Create or Provision API, specify its resource name only.
        { # Describes the spec for one promotion.
          "freeTrialDuration": { # Describes the length of a period of a time. # Output only. The duration of the free trial if the promotion is of type FREE_TRIAL.
            "count": 42, # number of duration units to be included.
            "unit": "A String", # The unit used for the duration
          },
          "introductoryPricingDetails": { # The details of a introductory pricing promotion. # Output only. The details of the introductory pricing spec if the promotion is of type INTRODUCTORY_PRICING.
            "introductoryPricingSpecs": [ # Output only. Specifies the introductory pricing periods.
              { # The duration of an introductory pricing promotion.
                "discountAmount": { # Describes the amount unit including the currency code. # Output only. The discount amount. The value is positive.
                  "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
                  "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
                },
                "discountRatioMicros": "A String", # Output only. The discount percentage in micros. For example, 50,000 represents 5%.
                "recurrenceCount": 42, # Output only. Output Only. The duration of an introductory offer in billing cycles.
                "regionCode": "A String", # Output only. 2-letter ISO region code where the product is available in. Ex. "US".
              },
            ],
          },
          "promotion": "A String", # Required. Promotion resource name that identifies a promotion. The format is 'partners/{partner_id}/promotions/{promotion_id}'.
          "type": "A String", # Output only. The type of the promotion for the spec.
        },
      ],
      "oneTimeRecurrenceDetails": { # Details for a ONE_TIME recurrence line item. # Output only. Details only set for a ONE_TIME recurrence line item.
        "servicePeriod": { # A description of what time period or moment in time the product or service is being delivered over. # Output only. The service period of the ONE_TIME line item.
          "endTime": "A String", # Optional. The end time of the service period. Time is exclusive.
          "startTime": "A String", # Required. The start time of the service period. Time is inclusive.
        },
      },
      "product": "A String", # Required. Product resource name that identifies one the line item The format is 'partners/{partner_id}/products/{product_id}'.
      "productPayload": { # Specifies product specific payload. # Optional. Product specific payload for this line item.
        "googleOnePayload": { # Payload specific to Google One products. # Product-specific payloads. Payload specific to Google One products.
          "campaigns": [ # Campaign attributed to sales of this subscription.
            "A String",
          ],
          "offering": "A String", # The type of offering the subscription was sold by the partner. e.g. VAS.
          "salesChannel": "A String", # The type of sales channel through which the subscription was sold.
          "storeId": "A String", # The identifier for the partner store where the subscription was sold.
        },
        "youtubePayload": { # Payload specific to Youtube products. # Payload specific to Youtube products.
          "accessEndTime": "A String", # Output only. The access expiration time for this line item.
          "partnerEligibilityIds": [ # The list of eligibility_ids which are applicable for the line item.
            "A String",
          ],
          "partnerPlanType": "A String", # Optional. Specifies the plan type offered to the end user by the partner.
        },
      },
      "recurrenceType": "A String", # Output only. The recurrence type of the line item.
      "state": "A String", # Output only. The state of the line item.
    },
  ],
  "name": "A String", # Identifier. Resource name of the subscription. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}". This is available for authorizeAddon, but otherwise is response only.
  "partnerUserToken": "A String", # Required. Identifier of the end-user in partner’s system. The value is restricted to 63 ASCII characters at the maximum.
  "processingState": "A String", # Output only. Describes the processing state of the subscription. See more details at [the lifecycle of a subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle).
  "products": [ # Optional. Deprecated: consider using `line_items` as the input. Required. Resource name that identifies the purchased products. The format will be 'partners/{partner_id}/products/{product_id}'.
    "A String",
  ],
  "promotionSpecs": [ # 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.
    { # Describes the spec for one promotion.
      "freeTrialDuration": { # Describes the length of a period of a time. # Output only. The duration of the free trial if the promotion is of type FREE_TRIAL.
        "count": 42, # number of duration units to be included.
        "unit": "A String", # The unit used for the duration
      },
      "introductoryPricingDetails": { # The details of a introductory pricing promotion. # Output only. The details of the introductory pricing spec if the promotion is of type INTRODUCTORY_PRICING.
        "introductoryPricingSpecs": [ # Output only. Specifies the introductory pricing periods.
          { # The duration of an introductory pricing promotion.
            "discountAmount": { # Describes the amount unit including the currency code. # Output only. The discount amount. The value is positive.
              "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
              "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
            },
            "discountRatioMicros": "A String", # Output only. The discount percentage in micros. For example, 50,000 represents 5%.
            "recurrenceCount": 42, # Output only. Output Only. The duration of an introductory offer in billing cycles.
            "regionCode": "A String", # Output only. 2-letter ISO region code where the product is available in. Ex. "US".
          },
        ],
      },
      "promotion": "A String", # Required. Promotion resource name that identifies a promotion. The format is 'partners/{partner_id}/promotions/{promotion_id}'.
      "type": "A String", # Output only. The type of the promotion for the spec.
    },
  ],
  "promotions": [ # Optional. Deprecated: consider using the top-level `promotion_specs` 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}'.
    "A String",
  ],
  "purchaseTime": "A String", # Optional. The timestamp when the user transaction was made with the Partner. Specify for the case of "bundle with choice", and it must be before the provision_time (when the user makes a selection).
  "redirectUri": "A 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.
  "renewalTime": "A String", # 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"
  "serviceLocation": { # Describes a location of an end user. # Required. The location that the service is provided as indicated by the partner.
    "postalCode": "A String", # The postal code this location refers to. Ex. "94043"
    "regionCode": "A String", # 2-letter ISO region code for current content region. Ex. “US” Please refers to: https://en.wikipedia.org/wiki/ISO_3166-1
  },
  "state": "A String", # Output only. Describes the state of the subscription. See more details at [the lifecycle of a subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle).
  "updateTime": "A String", # Output only. System generated timestamp when the subscription is most recently updated. UTC timezone.
  "upgradeDowngradeDetails": { # Details about the previous subscription that this new subscription upgrades/downgrades from. # 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.
    "billingCycleSpec": "A String", # Required. Specifies the billing cycle spec for the new upgraded/downgraded subscription.
    "previousSubscriptionId": "A String", # Required. The previous subscription id to be replaced. This is not the full resource name, use the subscription_id segment only.
  },
}

  subscriptionId: string, Required. Identifies the subscription resource on the Partner side. The value is restricted to 63 ASCII characters at the maximum. If a subscription was previously created with the same subscription_id, we will directly return that one.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # A subscription serves as a central billing entity between an external partner and Google. The underlying Google services rely on the subscription state to grant or revoke the user's service entitlement. It's important to note that the subscription state may not always perfectly align with the user's service entitlement. For example, some Google services may continue providing access to the user until the current billing cycle ends, even if the subscription has been immediately canceled. However, other services may not do the same. To fully understand the specific details, please consult the relevant contract or product policy.
  "cancellationDetails": { # Describes the details of a cancelled or cancelling subscription. # Output only. Describes the details of a cancelled subscription. Only applicable to subscription of state `STATE_CANCELLED`.
    "reason": "A String", # Output only. The reason of the cancellation.
  },
  "createTime": "A String", # Output only. System generated timestamp when the subscription is created. UTC timezone.
  "cycleEndTime": "A String", # 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"
  "endUserEntitled": True or False, # Output only. Indicates if the subscription is entitled to the end user.
  "freeTrialEndTime": "A String", # 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.
  "lineItems": [ # Required. The line items of the subscription.
    { # Individual line item definition of a subscription.
      "amount": { # Describes the amount unit including the currency code. # Output only. The price of the product/service in this line item. The amount could be the wholesale price, or it can include a cost of sale based on the contract.
        "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
        "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
      },
      "bundleDetails": { # The bundle details for a line item corresponding to a hard bundle. # Output only. The bundle details for the line item. Only populated if the line item corresponds to a hard bundle.
        "bundleElementDetails": [ # Output only. The details for each element in the hard bundle.
          { # The details for an element in the hard bundle.
            "product": "A String", # Output only. Product resource name that identifies the bundle element. The format is 'partners/{partner_id}/products/{product_id}'.
            "userAccountLinkedTime": "A String", # Output only. The time when this product is linked to an end user.
          },
        ],
      },
      "description": "A String", # Output only. Description of this line item.
      "finiteBillingCycleDetails": { # Details for a subscriptiin line item with finite billing cycles. # Optional. Details for a subscription line item with finite billing cycles. If unset, the line item will be charged indefinitely. Used only with LINE_ITEM_RECURRENCE_TYPE_PERIODIC.
        "billingCycleCountLimit": "A String", # Required. The number of a subscription line item billing cycles after which billing will stop automatically.
      },
      "lineItemFreeTrialEndTime": "A String", # Output only. The free trial end time will be populated after the line item is successfully processed. 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.
      "lineItemIndex": 42, # Output only. A unique index of the subscription line item.
      "lineItemPromotionSpecs": [ # Optional. The promotions applied on the line item. It can be: - an introductory pricing promotion. - a free trial promotion. This feature is not enabled. If used, the request will be rejected. When used as input in Create or Provision API, specify its resource name only.
        { # Describes the spec for one promotion.
          "freeTrialDuration": { # Describes the length of a period of a time. # Output only. The duration of the free trial if the promotion is of type FREE_TRIAL.
            "count": 42, # number of duration units to be included.
            "unit": "A String", # The unit used for the duration
          },
          "introductoryPricingDetails": { # The details of a introductory pricing promotion. # Output only. The details of the introductory pricing spec if the promotion is of type INTRODUCTORY_PRICING.
            "introductoryPricingSpecs": [ # Output only. Specifies the introductory pricing periods.
              { # The duration of an introductory pricing promotion.
                "discountAmount": { # Describes the amount unit including the currency code. # Output only. The discount amount. The value is positive.
                  "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
                  "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
                },
                "discountRatioMicros": "A String", # Output only. The discount percentage in micros. For example, 50,000 represents 5%.
                "recurrenceCount": 42, # Output only. Output Only. The duration of an introductory offer in billing cycles.
                "regionCode": "A String", # Output only. 2-letter ISO region code where the product is available in. Ex. "US".
              },
            ],
          },
          "promotion": "A String", # Required. Promotion resource name that identifies a promotion. The format is 'partners/{partner_id}/promotions/{promotion_id}'.
          "type": "A String", # Output only. The type of the promotion for the spec.
        },
      ],
      "oneTimeRecurrenceDetails": { # Details for a ONE_TIME recurrence line item. # Output only. Details only set for a ONE_TIME recurrence line item.
        "servicePeriod": { # A description of what time period or moment in time the product or service is being delivered over. # Output only. The service period of the ONE_TIME line item.
          "endTime": "A String", # Optional. The end time of the service period. Time is exclusive.
          "startTime": "A String", # Required. The start time of the service period. Time is inclusive.
        },
      },
      "product": "A String", # Required. Product resource name that identifies one the line item The format is 'partners/{partner_id}/products/{product_id}'.
      "productPayload": { # Specifies product specific payload. # Optional. Product specific payload for this line item.
        "googleOnePayload": { # Payload specific to Google One products. # Product-specific payloads. Payload specific to Google One products.
          "campaigns": [ # Campaign attributed to sales of this subscription.
            "A String",
          ],
          "offering": "A String", # The type of offering the subscription was sold by the partner. e.g. VAS.
          "salesChannel": "A String", # The type of sales channel through which the subscription was sold.
          "storeId": "A String", # The identifier for the partner store where the subscription was sold.
        },
        "youtubePayload": { # Payload specific to Youtube products. # Payload specific to Youtube products.
          "accessEndTime": "A String", # Output only. The access expiration time for this line item.
          "partnerEligibilityIds": [ # The list of eligibility_ids which are applicable for the line item.
            "A String",
          ],
          "partnerPlanType": "A String", # Optional. Specifies the plan type offered to the end user by the partner.
        },
      },
      "recurrenceType": "A String", # Output only. The recurrence type of the line item.
      "state": "A String", # Output only. The state of the line item.
    },
  ],
  "name": "A String", # Identifier. Resource name of the subscription. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}". This is available for authorizeAddon, but otherwise is response only.
  "partnerUserToken": "A String", # Required. Identifier of the end-user in partner’s system. The value is restricted to 63 ASCII characters at the maximum.
  "processingState": "A String", # Output only. Describes the processing state of the subscription. See more details at [the lifecycle of a subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle).
  "products": [ # Optional. Deprecated: consider using `line_items` as the input. Required. Resource name that identifies the purchased products. The format will be 'partners/{partner_id}/products/{product_id}'.
    "A String",
  ],
  "promotionSpecs": [ # 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.
    { # Describes the spec for one promotion.
      "freeTrialDuration": { # Describes the length of a period of a time. # Output only. The duration of the free trial if the promotion is of type FREE_TRIAL.
        "count": 42, # number of duration units to be included.
        "unit": "A String", # The unit used for the duration
      },
      "introductoryPricingDetails": { # The details of a introductory pricing promotion. # Output only. The details of the introductory pricing spec if the promotion is of type INTRODUCTORY_PRICING.
        "introductoryPricingSpecs": [ # Output only. Specifies the introductory pricing periods.
          { # The duration of an introductory pricing promotion.
            "discountAmount": { # Describes the amount unit including the currency code. # Output only. The discount amount. The value is positive.
              "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
              "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
            },
            "discountRatioMicros": "A String", # Output only. The discount percentage in micros. For example, 50,000 represents 5%.
            "recurrenceCount": 42, # Output only. Output Only. The duration of an introductory offer in billing cycles.
            "regionCode": "A String", # Output only. 2-letter ISO region code where the product is available in. Ex. "US".
          },
        ],
      },
      "promotion": "A String", # Required. Promotion resource name that identifies a promotion. The format is 'partners/{partner_id}/promotions/{promotion_id}'.
      "type": "A String", # Output only. The type of the promotion for the spec.
    },
  ],
  "promotions": [ # Optional. Deprecated: consider using the top-level `promotion_specs` 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}'.
    "A String",
  ],
  "purchaseTime": "A String", # Optional. The timestamp when the user transaction was made with the Partner. Specify for the case of "bundle with choice", and it must be before the provision_time (when the user makes a selection).
  "redirectUri": "A 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.
  "renewalTime": "A String", # 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"
  "serviceLocation": { # Describes a location of an end user. # Required. The location that the service is provided as indicated by the partner.
    "postalCode": "A String", # The postal code this location refers to. Ex. "94043"
    "regionCode": "A String", # 2-letter ISO region code for current content region. Ex. “US” Please refers to: https://en.wikipedia.org/wiki/ISO_3166-1
  },
  "state": "A String", # Output only. Describes the state of the subscription. See more details at [the lifecycle of a subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle).
  "updateTime": "A String", # Output only. System generated timestamp when the subscription is most recently updated. UTC timezone.
  "upgradeDowngradeDetails": { # Details about the previous subscription that this new subscription upgrades/downgrades from. # 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.
    "billingCycleSpec": "A String", # Required. Specifies the billing cycle spec for the new upgraded/downgraded subscription.
    "previousSubscriptionId": "A String", # Required. The previous subscription id to be replaced. This is not the full resource name, use the subscription_id segment only.
  },
}
undoCancel(name, body=None, x__xgafv=None)
Used by partners to revoke the pending cancellation of a subscription, which is currently in `STATE_CANCEL_AT_END_OF_CYCLE` state. If the subscription is already cancelled, the request will fail. It should be called directly by the partner using service accounts.

Args:
  name: string, Required. The name of the subscription resource whose pending cancellation needs to be undone. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}" (required)
  body: object, The request body.
    The object takes the form of:

{ # Request to revoke a cancellation request.
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response that contains the updated subscription resource.
  "subscription": { # A subscription serves as a central billing entity between an external partner and Google. The underlying Google services rely on the subscription state to grant or revoke the user's service entitlement. It's important to note that the subscription state may not always perfectly align with the user's service entitlement. For example, some Google services may continue providing access to the user until the current billing cycle ends, even if the subscription has been immediately canceled. However, other services may not do the same. To fully understand the specific details, please consult the relevant contract or product policy. # The updated subscription resource.
    "cancellationDetails": { # Describes the details of a cancelled or cancelling subscription. # Output only. Describes the details of a cancelled subscription. Only applicable to subscription of state `STATE_CANCELLED`.
      "reason": "A String", # Output only. The reason of the cancellation.
    },
    "createTime": "A String", # Output only. System generated timestamp when the subscription is created. UTC timezone.
    "cycleEndTime": "A String", # 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"
    "endUserEntitled": True or False, # Output only. Indicates if the subscription is entitled to the end user.
    "freeTrialEndTime": "A String", # 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.
    "lineItems": [ # Required. The line items of the subscription.
      { # Individual line item definition of a subscription.
        "amount": { # Describes the amount unit including the currency code. # Output only. The price of the product/service in this line item. The amount could be the wholesale price, or it can include a cost of sale based on the contract.
          "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
          "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
        },
        "bundleDetails": { # The bundle details for a line item corresponding to a hard bundle. # Output only. The bundle details for the line item. Only populated if the line item corresponds to a hard bundle.
          "bundleElementDetails": [ # Output only. The details for each element in the hard bundle.
            { # The details for an element in the hard bundle.
              "product": "A String", # Output only. Product resource name that identifies the bundle element. The format is 'partners/{partner_id}/products/{product_id}'.
              "userAccountLinkedTime": "A String", # Output only. The time when this product is linked to an end user.
            },
          ],
        },
        "description": "A String", # Output only. Description of this line item.
        "finiteBillingCycleDetails": { # Details for a subscriptiin line item with finite billing cycles. # Optional. Details for a subscription line item with finite billing cycles. If unset, the line item will be charged indefinitely. Used only with LINE_ITEM_RECURRENCE_TYPE_PERIODIC.
          "billingCycleCountLimit": "A String", # Required. The number of a subscription line item billing cycles after which billing will stop automatically.
        },
        "lineItemFreeTrialEndTime": "A String", # Output only. The free trial end time will be populated after the line item is successfully processed. 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.
        "lineItemIndex": 42, # Output only. A unique index of the subscription line item.
        "lineItemPromotionSpecs": [ # Optional. The promotions applied on the line item. It can be: - an introductory pricing promotion. - a free trial promotion. This feature is not enabled. If used, the request will be rejected. When used as input in Create or Provision API, specify its resource name only.
          { # Describes the spec for one promotion.
            "freeTrialDuration": { # Describes the length of a period of a time. # Output only. The duration of the free trial if the promotion is of type FREE_TRIAL.
              "count": 42, # number of duration units to be included.
              "unit": "A String", # The unit used for the duration
            },
            "introductoryPricingDetails": { # The details of a introductory pricing promotion. # Output only. The details of the introductory pricing spec if the promotion is of type INTRODUCTORY_PRICING.
              "introductoryPricingSpecs": [ # Output only. Specifies the introductory pricing periods.
                { # The duration of an introductory pricing promotion.
                  "discountAmount": { # Describes the amount unit including the currency code. # Output only. The discount amount. The value is positive.
                    "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
                    "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
                  },
                  "discountRatioMicros": "A String", # Output only. The discount percentage in micros. For example, 50,000 represents 5%.
                  "recurrenceCount": 42, # Output only. Output Only. The duration of an introductory offer in billing cycles.
                  "regionCode": "A String", # Output only. 2-letter ISO region code where the product is available in. Ex. "US".
                },
              ],
            },
            "promotion": "A String", # Required. Promotion resource name that identifies a promotion. The format is 'partners/{partner_id}/promotions/{promotion_id}'.
            "type": "A String", # Output only. The type of the promotion for the spec.
          },
        ],
        "oneTimeRecurrenceDetails": { # Details for a ONE_TIME recurrence line item. # Output only. Details only set for a ONE_TIME recurrence line item.
          "servicePeriod": { # A description of what time period or moment in time the product or service is being delivered over. # Output only. The service period of the ONE_TIME line item.
            "endTime": "A String", # Optional. The end time of the service period. Time is exclusive.
            "startTime": "A String", # Required. The start time of the service period. Time is inclusive.
          },
        },
        "product": "A String", # Required. Product resource name that identifies one the line item The format is 'partners/{partner_id}/products/{product_id}'.
        "productPayload": { # Specifies product specific payload. # Optional. Product specific payload for this line item.
          "googleOnePayload": { # Payload specific to Google One products. # Product-specific payloads. Payload specific to Google One products.
            "campaigns": [ # Campaign attributed to sales of this subscription.
              "A String",
            ],
            "offering": "A String", # The type of offering the subscription was sold by the partner. e.g. VAS.
            "salesChannel": "A String", # The type of sales channel through which the subscription was sold.
            "storeId": "A String", # The identifier for the partner store where the subscription was sold.
          },
          "youtubePayload": { # Payload specific to Youtube products. # Payload specific to Youtube products.
            "accessEndTime": "A String", # Output only. The access expiration time for this line item.
            "partnerEligibilityIds": [ # The list of eligibility_ids which are applicable for the line item.
              "A String",
            ],
            "partnerPlanType": "A String", # Optional. Specifies the plan type offered to the end user by the partner.
          },
        },
        "recurrenceType": "A String", # Output only. The recurrence type of the line item.
        "state": "A String", # Output only. The state of the line item.
      },
    ],
    "name": "A String", # Identifier. Resource name of the subscription. It will have the format of "partners/{partner_id}/subscriptions/{subscription_id}". This is available for authorizeAddon, but otherwise is response only.
    "partnerUserToken": "A String", # Required. Identifier of the end-user in partner’s system. The value is restricted to 63 ASCII characters at the maximum.
    "processingState": "A String", # Output only. Describes the processing state of the subscription. See more details at [the lifecycle of a subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle).
    "products": [ # Optional. Deprecated: consider using `line_items` as the input. Required. Resource name that identifies the purchased products. The format will be 'partners/{partner_id}/products/{product_id}'.
      "A String",
    ],
    "promotionSpecs": [ # 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.
      { # Describes the spec for one promotion.
        "freeTrialDuration": { # Describes the length of a period of a time. # Output only. The duration of the free trial if the promotion is of type FREE_TRIAL.
          "count": 42, # number of duration units to be included.
          "unit": "A String", # The unit used for the duration
        },
        "introductoryPricingDetails": { # The details of a introductory pricing promotion. # Output only. The details of the introductory pricing spec if the promotion is of type INTRODUCTORY_PRICING.
          "introductoryPricingSpecs": [ # Output only. Specifies the introductory pricing periods.
            { # The duration of an introductory pricing promotion.
              "discountAmount": { # Describes the amount unit including the currency code. # Output only. The discount amount. The value is positive.
                "amountMicros": "A String", # Required. Amount in micros (1_000_000 micros = 1 currency unit)
                "currencyCode": "A String", # Required. Currency codes in accordance with [ISO-4217 Currency Codes] (https://en.wikipedia.org/wiki/ISO_4217). For example, USD.
              },
              "discountRatioMicros": "A String", # Output only. The discount percentage in micros. For example, 50,000 represents 5%.
              "recurrenceCount": 42, # Output only. Output Only. The duration of an introductory offer in billing cycles.
              "regionCode": "A String", # Output only. 2-letter ISO region code where the product is available in. Ex. "US".
            },
          ],
        },
        "promotion": "A String", # Required. Promotion resource name that identifies a promotion. The format is 'partners/{partner_id}/promotions/{promotion_id}'.
        "type": "A String", # Output only. The type of the promotion for the spec.
      },
    ],
    "promotions": [ # Optional. Deprecated: consider using the top-level `promotion_specs` 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}'.
      "A String",
    ],
    "purchaseTime": "A String", # Optional. The timestamp when the user transaction was made with the Partner. Specify for the case of "bundle with choice", and it must be before the provision_time (when the user makes a selection).
    "redirectUri": "A 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.
    "renewalTime": "A String", # 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"
    "serviceLocation": { # Describes a location of an end user. # Required. The location that the service is provided as indicated by the partner.
      "postalCode": "A String", # The postal code this location refers to. Ex. "94043"
      "regionCode": "A String", # 2-letter ISO region code for current content region. Ex. “US” Please refers to: https://en.wikipedia.org/wiki/ISO_3166-1
    },
    "state": "A String", # Output only. Describes the state of the subscription. See more details at [the lifecycle of a subscription](/payments/reseller/subscription/reference/index/Receive.Notifications#payments-subscription-lifecycle).
    "updateTime": "A String", # Output only. System generated timestamp when the subscription is most recently updated. UTC timezone.
    "upgradeDowngradeDetails": { # Details about the previous subscription that this new subscription upgrades/downgrades from. # 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.
      "billingCycleSpec": "A String", # Required. Specifies the billing cycle spec for the new upgraded/downgraded subscription.
      "previousSubscriptionId": "A String", # Required. The previous subscription id to be replaced. This is not the full resource name, use the subscription_id segment only.
    },
  },
}