IAP Badger: a unified approach to in-app purchases

I probably mistyped the version. It’s 3105 not 3015.

Rob

I’ve just uploaded version 10 to the plug-in and Github hosted versions of the library.

It fixes a crash bag on the simulator caused when  verboseDebugOutput is set to  true and you simulate a cancelled or failed purchase/restore operation.

Simon

Argghhhhh last week my IAP purchase works well on android, today it doesn’t work !! I changed nothing in the code or on the store !! Is anything change in IAP BADGER ? i just use the last corona version : Corona Simulator 2017.3135 But before that, i was with : Corona 2017.3121 And everything was ok.

Hi there,

No changes at my end, I’m afraid.  Something else must be going on.

Simon :slight_smile:

Simon,

With the daily build 2017. 3117 i used since a couple of week , no pb, when you make a purchase on ANDROID it works like a charm, like always :

iap.purchase(idButton, purchaseListener)

But exactly, same code, same id, same everything, i built with the last official build  2017.3135 , and impossible to buy everything on ANDROID only :

iap.purchase(idButton, purchaseListener)

any clue ?

can you test if you have the same trouble with ANDROID ?

Very important : Note that the 2017. 3117 version was release AFTER the “Important Google IAP Plugin Update” that is already take into account by the IAP BADGER plugin.

Before we can begin to help you, we need more information. Just saying “It’s broken” doesn’t tell us any thing. How do you know it’s not working? Are you getting errors? Are there messages in the device’s console log (please don’t filter just for Corona messages since IAP is a different activity)?

Have you dropped back to 3121 and tried?

Can you reproduce the error or are you depending on user reports?

Please help us help you.

Rob

ooopssss… i am a dummy… i think the pb is that if i want to test IAP on android i must before upload the APK on the store (at least alpha) before trying to buy one, i can’t do it if i juste transfer the APK on a phone without having publish it before… not sure, but it should be the clue… i try… sorry :slight_smile:

if it can help people in futur…

it was the problem  you have to publish on android, before…

Hi Simon,

When you make a purchase on ios, a window purpose you to BUY or CANCEL, and of course the transaction could FAILED.

This 3 event are manage by IAP BADGER, and when you try it with the emulator with an iphone emulator, everything is ok : there is a prompt with “buy, cancel, failed” and you CAN’T close this window in another way.

Things are different with android : on a real android, and on the emulator (with a samsung), there is a little cross on the window and then you can : BUY, CANCEL, or CLOSE THE WINDOW !

And, on the android emulator (if you just close the window), or on a REAL android (if you clic outside the window) : it close the window and NO EVENT is send ! there is no CANCEL or FAILED event… so we don’t know that the player has CANCEL his purchase buy clicking outside the window (on real device) or on the cross at top right (on emulator android), and i am not able to go on my code…

Do you know this pb ? I don’t know how to bypass it… :frowning:

Here is the 2 windows for both ios and android device on the emulator.

The problem is that you can close the android window (what is true on a real device because you can close the window only by clicking outside of it, what doesn’t work on ios), and when you close it, no CANCEL or FAILED event are generated so you can’t manage to code something to do when the user CLOSE the window on android…

The original pb come from a real device : the user click outside the purchase window on his samsung to close it, and then… nothing happens after that… game is blocked… coz no failed, success, or cancel event are launched…

Hi again,

The images you’ve posted are of IAP Badger running in test mode.  In test mode, IAP Badger emulates responses from the App Store/Google etc. so you can test your code without actually having to contact an real store.

When you turn testing mode off, and run your app on an actual device, IAP Badger will start using real store code and initiate real transactions with the App Store/Google.  At this point, you’ll get messages from iOS/Android about these purchases that will look very different to your images.

So, if the user cancels the transaction, Corona will return a ‘cancelled’ event, which IAP Badger will then process.

From your screenshots, I think what might be happening here is that IAP Badger isn’t handling the ‘X’ on the dialog properly on the Windows simulator.  However, this won’t be an issue when you turn testing mode off, because the user will never see that dialog.

Try turning off testing mode, and hook up IAP Badger to real products in Google Play.  Install your app on a real device and try it out.  If the problem remains, don’t hesitate to get back in touch. 

First, thanks for replying Simon.

In production, on devices, of course ‘test mode is off’, and i don’t see these debug windows.

But here is the windows i have on ios and android on real devices purchasing on real store.

(Sorry, windows are in french.)

Result is :

IOS DEVICE ON APPLE STORE (i should enter my pass on this window but the result will be the same with 2 buttons) :

  • a CANCEL (“annuler” in french) button : cancel event sent

  • a BUY (“acheter” in french) button : purchase event sent

  • and if i click outside this window, it do nothing : it’s a modal window, i only have the choice to click on BUY or CANCEL

ANDROID DEVICE ON GOOGLE PLAY :

  • a BUY (“acheter” in french) button : purchase event sent

  • and if i click outside this window, it just CLOSE the window, it is not a modal window, and the worst of all is that : no cancel event is sent ! At this point, no code can be launched…

note that i think that the CANCEL button will appear later, when i will click on BUY (“acheter” in french) button, then i should have to confirm : buy or cancel.

if you have an android, maybe you can test and purchase something on your app and then cancel it by clicking outside the window… you’ll see that the code in cancelledListener or failedListener will never be launched :frowning:

I wasn’t aware of this.

So, just to check:

* On Android, if you click outside of the window you show above, the window disappears…

* …but no event comes back (either cancelled or failed)

* …so the code hangs.

Simon

That’s it
Can someone else confirm ?

News :

https://android-developers.googleblog.com/2017/09/google-play-billing-library-10-released.html?m=1

Android billing code may change soon…

Hopefully the coders at Corona will make this a super simple update for us :slight_smile:

Hi, Simon.

Great work on iap_badger!

I have a couple of questions.   

1)  on a product restore - the Success and Timeout give me a response through the callbacks and, therefore, an ability to cancel a spinner (as written in your sample code).  A Cancel and Failed dont give me the same access.  I see in verbose mode that you have the event message (since you display it).  Can I get access to it somehow so I can turn the darn spinner off? Never mind this one  RTFM, RTFM, RTFM  :huh:  added them as inline in the init options.

2)  non-consumable product (removeAds): how is a refund handled.  It seems to be handled in the silent portion of your code where you update the inventory.  I have added a call to a function that resets the values into the onRefund function in the corresponding product entry in the catalogue.  I don’t see a way to test this.  Is this the proper place to put it - or is there somewhere better?

  1. Any plans to handle recurring subscriptions?  I see that @RoamingGamer says that he added support for iOS a while back, but I was hoping not to have to write it.  After reading the Android and iOS docs a couple of times, I found myself chasing little pretty colored spots.  :slight_smile:

Dave

Hi everyone,

Just updated the plug-in to version 12 based on some requests I’ve had from the community.

Version 12:

Handling Invalid Product IDs

In the past, any unknown product ID would cause IAP Badger to halt the app.

This is problematic for those of you who have zombie product IDs floating around - which could happen if you’ve got test users who’ve bought an IAP during an early phase of development, then later that product was deleted.  Even though the product has been deleted from the console, the product ID will still keep coming up during restore cycles.

So I’ve downgraded the status of invalid product IDs generally.  When IAP Badger encounters an unknown product ID, now you’ll just get an error message in the console.

Also, by adding  handleInvalidProductIDs=true  to your initialisation table in iap.init(), you can tell IAP Badger to tell the relevant app store that it’s processed the product, when in reality it’s done nothing.

Restoring consumable products

In the past, it made no sense to allow consumable products to be restored so IAP Badger ignored these (most likely malicious) attempts to do so.

However, in Google Play, promo codes for consumables can now appear in the restore cycle.  If you would like to specify that a consumable product can be restored, set  allowRestore=true for the product in the catalogue.  See the updated ‘restore’ section of the tutorial for an example.

Other changes

  • I’ve stripped out some of the comments at the top of the Github version of IAP Badger; initially, they were intended as the documentation, but comments there are out of date and the library is now properly documented on our website anyway.
  • I’ve improved some of the debug output detail when  verboseDebugOutput is set to true
  • I’ve fixed some incorrect error messages coming out of IAP Badger on Google Play consume events

Simon :slight_smile:

PS - for more detail, so the documentation.

Hi Dave,

In answer to your questions:

  1. For refunds, I just reset the quantity in the user’s inventory.  Amazon’s devices are best for testing this - you have a separate app for simulating purchases/refunds etc.  I think on Google Play and iOS you have to actually physically run a refund from the console; and someone else on the forums noticed that refunded on Google Play prevented the user from re-purchasing the IAP at a later date.

  2. I’m happy to include subscriptions if someone’s willing to share their code with me.  I’m not actively developing apps any more, and have never had the need for a subscription product, so that’s why they’re not included.

Simon

Thanks, Simon.

We’ll move handling subscriptions to an update and take the time to dig into it after our initial release.  

Dave