Search code examples
androidgoogle-play-consolebillingclient

Check SkuDetails subscription billing frequency


In Android development with Google Billing, how do I get the billing frequency for a Subscription

SkuDetails.subscriptionPeriod() returns a date string. Is there a way to get the billing frequency for example monthly or yearly or am I going to have to just cleverly code this to match what I have in console?


Solution

  • I was wrong to assume truth from searching through other posts. I have debugged and found out that:

    SkuDetails.subscriptionPeriod() returns something like P1Y, or P1M, or whatever else as a string.

    • P1M: Per 1 Month
    • P1Y: Per 1 Year
    • etc depending on what subscription frequency you have set up

    I am now using those abbreviations for reference.