1. Are you ready for the Galaxy S20? Here is everything we know so far!

The problem with billing! (advice, please)

Discussion in 'Android Development' started by justcuriousuk, Mar 3, 2020.

  1. justcuriousuk

    justcuriousuk Lurker
    Thread Starter

    I've finally reached the alpha testing phase of my first Android project and what a rollercoaster ride it has been getting this far! But I'm now experiencing a few difficulties with the billing aspect.

    My project is a database records app and the plan is to offer the app for free, but with access to only a small number of records so that people can try before they buy. If they like the app, there is an in-app purchase for unlimited records (or Go Pro).

    I've set it up in the Play console with a closed track test using a list of approved testers (currently me with a couple of Google accounts) and this allows me to test the following:
    • Test card, always approves
    • Test card, always declines
    • Slow test card, eventually approves
    • Slow test card, eventually declines
    And this is where I'm having a problem.

    The first two options are OK. I'm able to capture the event correctly and the app behaves as it should.
    But the slow test cards are causing me a headache and I'm looking for any help or advice that's on offer.
    What happens is that the purchase gets flagged as 'PENDING', and although I've triggered the acknowledge function, when checking the purchase status, 'acknowledged' remains false.

    According to Google, purchases will remain as 'PENDING' unless they are acknowledged within 3 days. The implication being purchases that fail late will be locked out for 3 days or more! As a user (and a developer) that would infuriate me and I would turn to another app.

    I have been able to cancel the payment with 'ConsumeAsync' when I've detected that it is in a PENDING state, but this is not consistently successful.

    If the payment is eventually successful, the app automatically picks this up through the Billing API 'queryPurchases' method, so although there is a delay, the user is not significantly inconvenienced.

    However, as far as I can tell, if the payment fails, the purchaseState remains at 2 (PENDING) and unless I can find a way to establish that the payment has failed, the user will have a long wait before they can try again. As you likely know, trying the purchase again while the state is pending results in an 'item already owned' error.

    So finally to my questions:
    1. In the real world, do failed payments often get reported late in this way and if so, how often (how big a problem is it likely to be)?
    2. What is the best way to handle the 'Slow test card, eventually declines' scenario
    Any suggestions, solutions or help of any kind will be very much appreciated.

    Kind regards


Share This Page