- Resource: SubscriptionPurchaseV2
- SubscriptionState
- PausedStateContext
- CanceledStateContext
- UserInitiatedCancellation
- CancelSurveyResult
- CancelSurveyReason
- SystemInitiatedCancellation
- DeveloperInitiatedCancellation
- ReplacementCancellation
- TestPurchase
- AcknowledgementState
- ExternalAccountIdentifiers
- SubscribeWithGoogleInfo
- SubscriptionPurchaseLineItem
- AutoRenewingPlan
- SubscriptionItemPriceChangeDetails
- PriceChangeMode
- PriceChangeState
- InstallmentPlan
- PendingCancellation
- PrepaidPlan
- OfferDetails
- DeferredItemReplacement
- SignupPromotion
- OneTimeCode
- VanityCode
- Methods
Resource: SubscriptionPurchaseV2
Indicates the status of a user's subscription purchase.
JSON representation |
---|
{ "kind": string, "regionCode": string, "lineItems": [ { object ( |
Fields | |
---|---|
kind |
This kind represents a SubscriptionPurchaseV2 object in the androidpublisher service. |
region |
ISO 3166-1 alpha-2 billing country/region code of the user at the time the subscription was granted. |
line |
Item-level info for a subscription purchase. The items in the same purchase should be either all with AutoRenewingPlan or all with PrepaidPlan. |
start |
Time at which the subscription was granted. Not set for pending subscriptions (subscription was created but awaiting payment during signup). A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
subscription |
The current state of the subscription. |
latest |
The order id of the latest order associated with the purchase of the subscription. For autoRenewing subscription, this is the order id of signup order if it is not renewed yet, or the last recurring order id (success, pending, or declined order). For prepaid subscription, this is the order id associated with the queried purchase token. |
linked |
The purchase token of the old subscription if this subscription is one of the following: * Re-signup of a canceled but non-lapsed subscription * Upgrade/downgrade from a previous subscription. * Convert from prepaid to auto renewing subscription. * Convert from an auto renewing subscription to prepaid. * Topup a prepaid subscription. |
paused |
Additional context around paused subscriptions. Only present if the subscription currently has subscriptionState SUBSCRIPTION_STATE_PAUSED. |
canceled |
Additional context around canceled subscriptions. Only present if the subscription currently has subscriptionState SUBSCRIPTION_STATE_CANCELED or SUBSCRIPTION_STATE_EXPIRED. |
test |
Only present if this subscription purchase is a test purchase. |
acknowledgement |
The acknowledgement state of the subscription. |
external |
User account identifier in the third-party service. |
subscribe |
User profile associated with purchases made with 'Subscribe with Google'. |
SubscriptionState
The potential states a subscription can be in, for example whether it is active or canceled. The items within a subscription purchase can either be all auto renewing plans or prepaid plans.
Enums | |
---|---|
SUBSCRIPTION_STATE_UNSPECIFIED |
Unspecified subscription state. |
SUBSCRIPTION_STATE_PENDING |
Subscription was created but awaiting payment during signup. In this state, all items are awaiting payment. |
SUBSCRIPTION_STATE_ACTIVE |
Subscription is active. - (1) If the subscription is an auto renewing plan, at least one item is autoRenewEnabled and not expired. - (2) If the subscription is a prepaid plan, at least one item is not expired. |
SUBSCRIPTION_STATE_PAUSED |
Subscription is paused. The state is only available when the subscription is an auto renewing plan. In this state, all items are in paused state. |
SUBSCRIPTION_STATE_IN_GRACE_PERIOD |
Subscription is in grace period. The state is only available when the subscription is an auto renewing plan. In this state, all items are in grace period. |
SUBSCRIPTION_STATE_ON_HOLD |
Subscription is on hold (suspended). The state is only available when the subscription is an auto renewing plan. In this state, all items are on hold. |
SUBSCRIPTION_STATE_CANCELED |
Subscription is canceled but not expired yet. The state is only available when the subscription is an auto renewing plan. All items have autoRenewEnabled set to false. |
SUBSCRIPTION_STATE_EXPIRED |
Subscription is expired. All items have expiryTime in the past. |
SUBSCRIPTION_STATE_PENDING_PURCHASE_CANCELED |
Pending transaction for subscription is canceled. If this pending purchase was for an existing subscription, use linkedPurchaseToken to get the current state of that subscription. |
PausedStateContext
Information specific to a subscription in paused state.
JSON representation |
---|
{ "autoResumeTime": string } |
Fields | |
---|---|
auto |
Time at which the subscription will be automatically resumed. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
CanceledStateContext
Information specific to a subscription in the SUBSCRIPTION_STATE_CANCELED or SUBSCRIPTION_STATE_EXPIRED state.
JSON representation |
---|
{ // Union field |
Fields | |
---|---|
Union field cancellation_reason . The reason why a subscription was canceled. cancellation_reason can be only one of the following: |
|
user |
Subscription was canceled by user. |
system |
Subscription was canceled by the system, for example because of a billing problem. |
developer |
Subscription was canceled by the developer. |
replacement |
Subscription was replaced by a new subscription. |
UserInitiatedCancellation
Information specific to cancellations initiated by users.
JSON representation |
---|
{
"cancelSurveyResult": {
object ( |
Fields | |
---|---|
cancel |
Information provided by the user when they complete the subscription cancellation flow (cancellation reason survey). |
cancel |
The time at which the subscription was canceled by the user. The user might still have access to the subscription after this time. Use lineItems.expiry_time to determine if a user still has access. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
CancelSurveyResult
Result of the cancel survey when the subscription was canceled by the user.
JSON representation |
---|
{
"reason": enum ( |
Fields | |
---|---|
reason |
The reason the user selected in the cancel survey. |
reason |
Only set for CANCEL_SURVEY_REASON_OTHERS. This is the user's freeform response to the survey. |
CancelSurveyReason
The reason the user selected in the cancel survey.
Enums | |
---|---|
CANCEL_SURVEY_REASON_UNSPECIFIED |
Unspecified cancel survey reason. |
CANCEL_SURVEY_REASON_NOT_ENOUGH_USAGE |
Not enough usage of the subscription. |
CANCEL_SURVEY_REASON_TECHNICAL_ISSUES |
Technical issues while using the app. |
CANCEL_SURVEY_REASON_COST_RELATED |
Cost related issues. |
CANCEL_SURVEY_REASON_FOUND_BETTER_APP |
The user found a better app. |
CANCEL_SURVEY_REASON_OTHERS |
Other reasons. |
SystemInitiatedCancellation
This type has no fields.
Information specific to cancellations initiated by Google system.
DeveloperInitiatedCancellation
This type has no fields.
Information specific to cancellations initiated by developers.
ReplacementCancellation
This type has no fields.
Information specific to cancellations caused by subscription replacement.
TestPurchase
This type has no fields.
Whether this subscription purchase is a test purchase.
AcknowledgementState
The possible acknowledgement states for a subscription.
Enums | |
---|---|
ACKNOWLEDGEMENT_STATE_UNSPECIFIED |
Unspecified acknowledgement state. |
ACKNOWLEDGEMENT_STATE_PENDING |
The subscription is not acknowledged yet. |
ACKNOWLEDGEMENT_STATE_ACKNOWLEDGED |
The subscription is acknowledged. |
ExternalAccountIdentifiers
User account identifier in the third-party service.
JSON representation |
---|
{ "externalAccountId": string, "obfuscatedExternalAccountId": string, "obfuscatedExternalProfileId": string } |
Fields | |
---|---|
external |
User account identifier in the third-party service. Only present if account linking happened as part of the subscription purchase flow. |
obfuscated |
An obfuscated version of the id that is uniquely associated with the user's account in your app. Present for the following purchases: * If account linking happened as part of the subscription purchase flow. * It was specified using https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedaccountid when the purchase was made. |
obfuscated |
An obfuscated version of the id that is uniquely associated with the user's profile in your app. Only present if specified using https://developer.android.com/reference/com/android/billingclient/api/BillingFlowParams.Builder#setobfuscatedprofileid when the purchase was made. |
SubscribeWithGoogleInfo
Information associated with purchases made with 'Subscribe with Google'.
JSON representation |
---|
{ "profileId": string, "profileName": string, "emailAddress": string, "givenName": string, "familyName": string } |
Fields | |
---|---|
profile |
The Google profile id of the user when the subscription was purchased. |
profile |
The profile name of the user when the subscription was purchased. |
email |
The email address of the user when the subscription was purchased. |
given |
The given name of the user when the subscription was purchased. |
family |
The family name of the user when the subscription was purchased. |
SubscriptionPurchaseLineItem
Item-level info for a subscription purchase.
JSON representation |
---|
{ "productId": string, "expiryTime": string, // Union field |
Fields | |
---|---|
product |
The purchased product ID (for example, 'monthly001'). |
expiry |
Time at which the subscription expired or will expire unless the access is extended (ex. renews). A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
Union field plan_type . The subscription plan type. plan_type can be only one of the following: |
|
auto |
The item is auto renewing. |
prepaid |
The item is prepaid. |
offer |
The offer details for this item. |
Union field deferred_item_change . The field is present when a item has a deferred change. It can either be removed or replaced. deferred_item_change can be only one of the following: |
|
deferred |
Information for deferred item replacement. |
signup |
Promotion details about this item. Only set if a promotion was applied during signup. |
AutoRenewingPlan
Information related to an auto renewing plan.
JSON representation |
---|
{ "autoRenewEnabled": boolean, "priceChangeDetails": { object ( |
Fields | |
---|---|
auto |
If the subscription is currently set to auto-renew, e.g. the user has not canceled the subscription |
price |
The information of the last price change for the item since subscription signup. |
installment |
The installment plan commitment and state related info for the auto renewing plan. |
SubscriptionItemPriceChangeDetails
Price change related information of a subscription item.
JSON representation |
---|
{ "newPrice": { object ( |
Fields | |
---|---|
new |
New recurring price for the subscription item. |
price |
Price change mode specifies how the subscription item price is changing. |
price |
State the price change is currently in. |
expected |
The renewal time at which the price change will become effective for the user. This is subject to change(to a future time) due to cases where the renewal time shifts like pause. This field is only populated if the price change has not taken effect. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
PriceChangeMode
The mode of the price change.
Enums | |
---|---|
PRICE_CHANGE_MODE_UNSPECIFIED |
Price change mode unspecified. This value should never be set. |
PRICE_DECREASE |
If the subscription price is decreasing. |
PRICE_INCREASE |
If the subscription price is increasing and the user needs to accept it. |
OPT_OUT_PRICE_INCREASE |
If the subscription price is increasing with opt out mode. |
PriceChangeState
The state of the price change.
Enums | |
---|---|
PRICE_CHANGE_STATE_UNSPECIFIED |
Price change state unspecified. This value should not be used. |
OUTSTANDING |
Waiting for the user to agree for the price change. |
CONFIRMED |
The price change is confirmed to happen for the user. |
APPLIED |
The price change is applied, i.e. the user has started being charged the new price. |
InstallmentPlan
Information to a installment plan.
JSON representation |
---|
{
"initialCommittedPaymentsCount": integer,
"subsequentCommittedPaymentsCount": integer,
"remainingCommittedPaymentsCount": integer,
"pendingCancellation": {
object ( |
Fields | |
---|---|
initial |
Total number of payments the user is initially committed for. |
subsequent |
Total number of payments the user will be committed for after each commitment period. Empty means the installment plan will fall back to a normal auto-renew subscription after initial commitment. |
remaining |
Total number of committed payments remaining to be paid for in this renewal cycle. |
pending |
If present, this installment plan is pending to be canceled. The cancellation will happen only after the user finished all committed payments. |
PendingCancellation
This type has no fields.
This is an indicator of whether there is a pending cancellation on the virtual installment plan. The cancellation will happen only after the user finished all committed payments.
PrepaidPlan
Information related to a prepaid plan.
JSON representation |
---|
{ "allowExtendAfterTime": string } |
Fields | |
---|---|
allow |
If present, this is the time after which top up purchases are allowed for the prepaid plan. Will not be present for expired prepaid plans. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
OfferDetails
Offer details information related to a purchase line item.
JSON representation |
---|
{ "offerTags": [ string ], "basePlanId": string, "offerId": string } |
Fields | |
---|---|
offer |
The latest offer tags associated with the offer. It includes tags inherited from the base plan. |
base |
The base plan ID. Present for all base plan and offers. |
offer |
The offer ID. Only present for discounted offers. |
DeferredItemReplacement
Information related to deferred item replacement.
JSON representation |
---|
{ "productId": string } |
Fields | |
---|---|
product |
The productId going to replace the existing productId. |
SignupPromotion
The promotion applied on this item when purchased.
JSON representation |
---|
{ // Union field |
Fields | |
---|---|
Union field promotion_type . The type of promotion applied to the item. promotion_type can be only one of the following: |
|
one |
A one-time code was applied. |
vanity |
A vanity code was applied. |
OneTimeCode
This type has no fields.
A single use promotion code.
VanityCode
A multiple use, predefined promotion code.
JSON representation |
---|
{ "promotionCode": string } |
Fields | |
---|---|
promotion |
The promotion code. |
Methods |
|
---|---|
|
Get metadata about a subscription |
|
Revoke a subscription purchase for the user. |