locked
C# Xamarin Forms inApp purchase subscription with InAppBillingPlugin RRS feed

  • Question

  • User388390 posted

    I am using InAppBillingPlugin and I am going throu the exceptions to try and see how can I manage purchasing of subscritpions. Now, regarding the code, everything works fine. No need any samples or any code help. My problem is here; I can purchase and consume consumable items but I am wondering how will I deal with subscriptions. When trying to purchase an item already owned, Google Play billing will return an error as followed;

    BILLINGRESPONSERESULTITEMALREADY_OWNED 7 Failure to purchase since item is already owned which will work fine for checking the subscription I guess.

    In the library of jamesmontemagno, the hyperlink above, in the error checking section, this error is not covered. Hence I can not get to know when a user will be able to purchase the subscription again. Without having that error checked, user will be charged everythime he clicks on purchase even if he already owns the purchase. Or is Google Play Billing going to block it since the user has already purchased the subscription and it is still active?

    If it is the case, the best thing is to check all the available errors and if it is not in the existing list provided by the library, then take it as already owned item? I know my question is very vague and I am sorry if it confusing. It is confusing for me also.

    Link to the library: https://jamesmontemagno.github.io/InAppBillingPlugin/HandlingExceptions.html

    Friday, January 24, 2020 10:25 PM

All replies

  • User176749 posted

    i cannot answer james library because I am using now my own coding using IAP V2 using BillingClient. What i do is to call You querypurchases to retrieve users all available purchases and check by iap type if there is any subscription. Google play only returns active subscription only. Beside that yes using BillingClient purchase function, it returns error as AlreadyOwned. Maybe in older AIDL it wasnt.

    Saturday, January 25, 2020 12:21 AM
  • User388390 posted

    @batmaci said: i cannot answer james library because I am using now my own coding using IAP V2 using BillingClient. What i do is to call You querypurchases to retrieve users all available purchases and check by iap type if there is any subscription. Google play only returns active subscription only. Beside that yes using BillingClient purchase function, it returns error as AlreadyOwned. Maybe in older AIDL it wasnt.

    Can you help with an example? It would be kind and would save me a bit of time. P.S. I managed doing it by getting the purchased items with james library. BTW, what happens when trying to purchase a subscription already purchased and running?

    Saturday, January 25, 2020 4:55 PM
  • User176749 posted

    His library also had a function to query purchases. i believe that you get an error if you try to purchase another subscription. I tested long time ago but you can always test using test account. here you can fine how to test with test credit card and account. https://developer.android.com/google/play/billing/billing_testing

    Saturday, January 25, 2020 11:41 PM
  • User176749 posted

    hey, i have published this package. it i using the latest version of android billingclient. you can try if you like https://www.nuget.org/packages/XFInAppBilling/

    Monday, February 17, 2020 11:19 PM
  • User374133 posted

    @batmaci said: hey, i have published this package. it i using the latest version of android billingclient. you can try if you like

    Thank you. The community is in dire need of a new InAppBilling plugin since James had stopped maintaining his and Google is deprecating AIDL. I will be using this for the Android side of my app first, then migrate iOS to it as well.

    One suggestion I have for you is to add the keyword "InAppBilling" to your Nuget project description. When I searched for "InAppBilling", which I think most people do, this project did not come up. Hopefully you can get more recognition and community support for the long term future of this plugin. Cheers.

    Sunday, May 31, 2020 4:49 AM