Skip to content

Lib not giving base plan info for the new google play subscription structure #366

@marianolc

Description

@marianolc

Base on how subscriptions works now:

https://support.google.com/googleplay/android-developer/answer/12124625?sjid=10922029906795459446-EU

Where everything should be in the same subscription:

1O4B580sKFSrmTgbPhHxpIRzj0qYeioCUDTx

For example, a doing a iap.getPurchaseData(result) from a validation I get the following information:

[
   {
      "service":"google",
      "status":0,
      "packageName":"app.yyyy",
      "productId":"yyyy",
      "purchaseToken":"xxxx",
      "startTimeMillis":1709565742304,
      "expiryTimeMillis":1709568021739,
      "autoRenewing":false,
      "priceCurrencyCode":"USD",
      "priceAmountMicros":10770000,
      "countryCode":"XX",
      "developerPayload":null,
      "cancelReason":1,
      "orderId":"GPA.0000-0000-0000-00000..6",
      "purchaseType":0,
      "acknowledgementState":1,
      "kind":"androidpublisher#subscriptionPurchase",
      "transactionId":"xxxx",
      "quantity":1,
      "expirationDate":"1709568021739",
      "cancellationDate":"1709568021739"
   }
]

If I call the subscriptionV2 api from google:

https://androidpublisher.googleapis.com/androidpublisher/v3/applications/${packageName}/purchases/subscriptionsv2/tokens/${purchaseToken}

In the response there is an array of "LineItems" that I guess is what is mapped to get the previous object. In the line items the basePlanId is there:

{
   "kind":"androidpublisher#subscriptionPurchaseV2",
   "startTime":"2024-03-04T15:22:22.696Z",
   "regionCode":"XX",
   "subscriptionState":"SUBSCRIPTION_STATE_EXPIRED",
   "latestOrderId":"GPA.0000-0000-0000-00000..6",
   "canceledStateContext":{
      "systemInitiatedCancellation":{
         
      }
   },
   "testPurchase":{
      
   },
   "acknowledgementState":"ACKNOWLEDGEMENT_STATE_ACKNOWLEDGED",
   "lineItems":[
      {
         "productId":"yyyy",
         "expiryTime":"2024-03-04T16:00:21.739Z",
         "autoRenewingPlan":{
            
         },
         "offerDetails":{
            "basePlanId":"BASE_PLAN_ID",
            "offerId":"starter",
            "offerTags":[
               "monthly",
               "starter",
               "starter-test"
            ]
         }
      }
   ]
}

This value is important because is the only way to recognize "gold" / "silver" plan for example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions