Late subscription renewal real-time developer notification with Google Play Billing Library 2

1.5k Views Asked by At

When using Google Play Billing Library(GPBL) 2 in the client, the first renewal real-time developer notification(RTDN) arrives 22 hours after the subscription expiration.

Such gap might cause denial of our services for the user.

With GPBL 1.2.2 in the client, the renewal RTDN arrives 2 hours prior to the subscription expiration.

Steps to reproduce:

Use any GPBL version 2+ in an android client app. (Tested with GPBL 2.0.3, 2.1.0, 2.2.0)

1) Purchase a subscription on Google Play (in the client)

Tested with:

  • 7-day trial Paid subscription.

  • 5min, 15min, 30min Test subscriptions (For Test subscriptions the RTDN arrives 10 seconds after the expiration when using GPBL 2, as opposed to 2 minutes before the expiration when using GPBL 1.)

5min Test subscription used in the following example:

2) Verify the purchase (backend)

GET https://www.googleapis.com/androidpublisher/v3/applications/[packageName]/purchases/subscriptions/[subscriptionId]/tokens/[token]
  • Response:
{
  "expiryTimeMillis": 1584703350967, // "2020-03-20T11:22:30.967Z"
  "autoRenewing": true,
  "priceCurrencyCode": "CZK",
  "priceAmountMicros": 159990000,
  "paymentState": 1,
  "orderId": "GPA.3399-3829-9285-87596",
  "acknowledgementState": 0
}

3) Acknowledge the purchase (backend)

POST https://www.googleapis.com/androidpublisher/v3/applications/[packageName]/purchases/subscriptions/[subscriptionId]/tokens/[token]:acknowledge

{
  "developerPayload": null
}
  • Response 200 (empty body)

4) Wait for a renewal notification (backend)

  • Received at 1584703361173 epoch millis // "2020-03-20T11:22:41.173Z"
{
  "countryCode":"CZ",
  "developerPayload":"",
  "kind":"androidpublisher#subscriptionPurchase",
  "orderId":"GPA.3399-3829-9285-87596..0",
  "priceCurrencyCode":"CZK",
  "autoRenewing":true,
  "expiryTimeMillis":1584703770967, // "2020-03-20T11:29:30.967Z"
  "startTimeMillis":1584702935111, // "2020-03-20T11:15:35.111Z"
  "priceAmountMicros":159990000,
  "paymentState":1,
  "purchaseType":0
}

The notification arrived 10 seconds later than the original expiration time!

The only difference I'm aware of is the different GPBL version in the Android client and the purchase acknowledgement call which is required by the GPBL 2.

Only the first renewal notification is delayed. Subsequent renewal notifications are on-time, 2 minutes prior to each expiration.

Question:

Is there anything to do to get the first renewal notification before the expiration?

Thanks for any hint or advice!

0

There are 0 best solutions below