Recompiled the apk and signed/zaligned it.
During the install, I can now see, Network Communications Billing as a permission. (great!)
Inside main.py I imported the mods as...
Here's the thing... I don't think this code posted online is going to work.
Export your public key:
export BILLING_PUBKEY="Your public key here"
Setup some In-App product to buy. Let's say you've created a product with the id "org.kivy.gopremium"
In your application, you can use the billing module like this:
from android_billing import BillingService
from kivy.clock import Clock
class MyBillingService(object):
def __init__(self):
super(MyBillingService, self).__init__()
# Start the billing service, and attach our callback
self.service = BillingService(billing_callback)
# Start a clock to check billing service message every seconds
Clock.schedule_interval(self.service.check, 1)
def billing_callback(self, action, *largs):
'''Callback that will receive all the event from the Billing service
'''
if action == BillingService.BILLING_ACTION_ITEMSCHANGED:
items = largs[0]
if 'org.kivy.gopremium' in items:
print 'Congratulation, you have a premium acess'
else:
print 'Unfortunately, you dont have premium access'
def buy(self, sku):
# Method to buy something.
self.service.buy(sku)
def get_purchased_items(self):
# Return all the items purchased
return self.service.get_purchased_items()
To initiate a in-app purchase, just call the buy method:
# Note: start the service at the start, and never twice!
bs = MyBillingService()
bs.buy('org.kivy.gopremium')
# Later, when you get the notification that items have been changed, you
# can still check all the items you bought:
print bs.get_purchased_items()
{'org.kivy.gopremium': {'qt: 1}}
You'll receive all the notification about the billing process in the callback.
Last step, create your application with --with-billing $BILLING_PUBKEY:
./build.py ... --with-billing $BILLING_PUBKEY
Reason I think it won't work is because this code is calling "buy" to buy an item. When looking inside the billing modules buildozer creates, there is no buy method for BillingService but there is a RequestPurchase method which takes three arguments I believe. One being the item, one being the payload and I forgot the third argument.