libgdx/gdx-pay

Pending purchases

piotr-j opened this issue · 4 comments

Issue details, reproduction steps/code

Currently there is no callback for 'pending' purchase, only 'completed'. At least Google and Apple SDKs have states like that. Was there a particular reason for the omission? Simplicity?

Where I think it would be useful, is for handling 'slow card' or interrupted purchases. Eg on Android when you initiate purchase and press home it is cancelled, but there is no callback in that case. If I want to show a dialog with purchase progress it is kinda annoying. Im not sure how realistic or common is the 'slow card' test scenario for Android, but knowing that the purchase actually did start would be useful.

Perhaps Im overthinking this stuff, happy path seems to work fine.

At any rate, Ill PR something if you think that is sensible.

Version of gdx-pay and/or relevant dependencies

1.3.2

Please select the affected platforms and payment service implementation

  • Amazon
  • googlebilling
  • apple robovm
  • Huawei

At least for Google, Pending purchases came in after the platform implementation. It might be the same for iOS.
Does not seem to be an issue but if you want to tackle this, no one will stop you. :)

I have it working for iOS and Google, however there doesnt seem to be equivalent api for Amazon or Huawei. What do you think is better, calling handlePurchasePending callback just before handlePurchase with same Transaction or not at all?

Additionally only Android seems problematic, with the dumb home button that silently cancels stuff. It works in a more sensible way on iOS.

Ive upgraded billing to 4/5.0.0 and I do get cancelled after returning from stopped() state, so perhaps that is a better idea. However they introduced quantity to purchases and handling that would require some extra changes.

Ive upgraded billing to 3.0.3 from 3.0.1 and there is 'cancelled' after stop! That sounds like least breaking thing to do right now since it is still supported and solves the exact problem.

What do you think is better, calling handlePurchasePending callback just before handlePurchase with same Transaction or not at all?

I am not really into the topic, so do like you think is best

Closing stale issues. If someone needs it, feel free to implement PR for it