Android Question Google Billing: How to detect subscription "In grace period" and "Cancelled" states

toby

Well-Known Member
Licensed User
Longtime User
According to Google documentation, subscriptions automatically renew until they are canceled. A subscription can go through the following states:
  1. Active: User is in good standing and has access to the subscription.
  2. In grace period: User experienced a payment issue but still has access while Google is retrying the payment method.
  3. Cancelled: User has cancelled but still has access until expiration.
  4. On hold: User experienced a payment issue and no longer has access while Google is retrying the payment method.
  5. Paused: User paused their access and does not have access until they resume.
  6. Expired: User has cancelled and lost access to the subscription. The user is considered churned at expiration.
My app checks the state periodically and denies user's access to paid content if the state is not one of the first three above.

As shown below, current Google Billing v5 implementation contains 3 states (Purchase.STATE_PENDING, Purchase.STATE_PURCHASED and Purchase.STATE_UNSPECIFIED
):
checking subscription state:
    Wait For (billing.ConnectIfNeeded) Billing_Connected (Result As BillingResult)
    If Result.IsSuccess Then
        Wait For (billing.QueryPurchases("subs")) Billing_PurchasesQueryCompleted (Result As BillingResult, Purchases As List)
        If Result.IsSuccess Then
            For Each Purchase As Purchase In Purchases
                Log(Purchase.PurchaseToken)
                Log(Purchase.IsAutoRenewing)
                Log(Purchase.PurchaseState)
                Log(Purchase.Sku)
                Log(Purchase.Signature)
                Log(Purchase.PurchaseState) 'no sevice for states" cancelled, pending, paused, expired
                Select Purchase.PurchaseState
                    Case Purchase.STATE_PENDING
                    Case Purchase.STATE_PURCHASED 'I assume that this corresponds to Google billing api's active state.
                    Case Purchase.STATE_UNSPECIFIED
                    Case Else          
                End Select
            Next
        End If
    End If

How do I check for "in grace period" and "cancelled" states so that my app can allow user access to paid content?

TIA
 
Last edited:

toby

Well-Known Member
Licensed User
Longtime User
Cancelled orders will not returned by QueryPurchases.
According to Google documentation, After a user cancels his/her subscription, he/she doesn't get a refund for the remainder of the current subscription cycle, instead he/she is entitled to continue to use up his/her already paid subscription; Google billing is supposed to return "cancelled" state which means that the user has cancelled the subscription which is not expired yet and that the user should be treated as a regular subscriber.

How do I deal with this cancelled but not yet expired state?

TIA
 
Upvote 0

Hamied Abou Hulaikah

Well-Known Member
Licensed User
Longtime User
"in grace period"
always returns active state.
"cancelled"
As their docs, he/she will remain in active state functionality until period elapsed.
Because there is option for subscriber to go back to active without payment again.
Cancelled orders will not returned by QueryPurchases
After subscription period elapsed! I don't sure!
 
Upvote 0
Top