Android Question In-App billing get subscription expiry ?

Discussion in 'Android Questions' started by somed3v3loper, Jun 12, 2019.

  1. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    Hello all,

    As far as I know , In-App billing library does not return subscription expiry date so I am asking what can we do to get it ?

    I have a mysql users table where I would like to store the expiry date in

    How do you guys deal with subscription expiry ?

    Thanks in advance
     
  2. DonManfred

    DonManfred Expert Licensed User

    i guess you do define it in the billing settings, right?
    Store a list of all your products (using their id) with the defined expire time. Use the known list when checking the used products.

    Never used in-app-billing in my apps so it is just a guess/suggestion
     
  3. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    Thanks Don ,
    But I am not sure I understand your suggestion
    Billing library does not return expiry date of the in-app subscription
     
  4. DonManfred

    DonManfred Expert Licensed User

    but you are able to build such a list by yourself and implement the list in your app to know what ID which expiry have....
     
  5. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    You mean I should get the current time and send it to my server ? What if the time was not correct ?
     
  6. DonManfred

    DonManfred Expert Licensed User

    this is a TOTALLY other issue!

    What if in app billing returns a expiredate? What will you do others then checking the actual time???????
     
  7. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    probably store it in server and make a check in server too?
     
  8. DonManfred

    DonManfred Expert Licensed User

    i would use my server to get the actual time. Ignoring timezone differences you should be able to compare it to the device time if it can be "correct".
     
    somed3v3loper likes this.
  9. rboeck

    rboeck Well-Known Member Licensed User

    But you can get .PurchaseTime? If you have fixed time periods it would be easy to calculate?
     
  10. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    Right I have fixed time periods but I think I read that this time won't change even if user has re-subscribe so in this case how can I know the new expiry date ?
     
  11. rboeck

    rboeck Well-Known Member Licensed User

    10 minutes before i thought, i have to consume the oldest purchase and then i get the next one, but in the meantime i found out, that's impossible to consume an subscription.
     
  12. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    Yes , I think subscriptions are a bit complicated
     
  13. rboeck

    rboeck Well-Known Member Licensed User

    somed3v3loper likes this.
  14. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    Thank you very much @rboeck , I think I would go with storing a record in MySql table + some php comparisons to check if time is still in future
     
  15. Computersmith64

    Computersmith64 Well-Known Member Licensed User

    Or you could just check the status of the subscription when the app starts...

    - Colin.
     
    somed3v3loper likes this.
  16. Computersmith64

    Computersmith64 Well-Known Member Licensed User

    That's because a subscription is valid until the expiry date, even if the user has canceled it. You don't need to consume it anyway because renewals are handled by Play Store, not your app.

    All you need to do is check the status of the subscription when the app starts & take action in the app accordingly.

    - Colin.
     
    somed3v3loper and rboeck like this.
  17. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    If I want my premium content to be available offline , what do you suggest ?
     
  18. Computersmith64

    Computersmith64 Well-Known Member Licensed User

    Well I save a copy of the subscription status on the device & use it as a fallback if I can't get a status from Play Store. Every time the app starts I try to check the status & if I get a response from Play Store I update my local copy of the status. If I can't get a response, I use the last known state. I don't go as far as storing it in a database, I just write it to a config file in DirInternal. I figure the average user doesn't have the knowledge to hack DirInternal to try & get a free subscription - & even if they do, the subscription state will get updated every time they start the app.

    - Colin.
     
    somed3v3loper likes this.
  19. somed3v3loper

    somed3v3loper Well-Known Member Licensed User

    Thanks a lot
    you just save that the user is subscribed ?
    like a boolean value?
     
  20. Computersmith64

    Computersmith64 Well-Known Member Licensed User

    Yeah - well actually I have 1 month, 6 month, 12 month & lifetime subscriptions, so I save a boolean value for each one.

    - Colin.
     
    somed3v3loper likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice