androidsubscriptionin-app-subscription

Verify Google Subscription on backend - get base plan


Recently Google introduces base plans to subscriptions. Base plans are used to introduce different billing period (you end up with single subscription and couple of base plans for example: monthly, weekly, yearly) https://support.google.com/googleplay/android-developer/answer/12154973?hl=en

When I verify subscription on backend I would like to know which base plan user selected but I cannot find any way to get that. Previously I was getting all necessary informations from:

https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions

when Google introduced Base plans they also released purchases.subscriptionsv2:

https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2

but both only returns productId which is subscription id and no base plan id. Any idea how to get that with service account authentication?

On the other hand I can see on Google Play Console under order details productId and selected base plan, so I know subscription is configured correctly


Solution

  • Google added new field offerDetails with basePlanId, offerId and offerTags into lineItems (https://developer.android.com/google/play/billing/compatibility#subscriptionpurchasev2-fields). Fields not documented yet in https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2, but already come in response.