Android Question In App Billing for B4A Default nor B4XPages

Markos

Well-Known Member
Licensed User
Longtime User
Hi All,

I am now ready to implements InApp Billing for Googleplay. I have the example provided by Erel and I want to confirm a few aspects as relates to Default B4A Not B4XPages

Steps to setup programatically

1) Add to the manifest
B4X:
CreateResourceFromFile(Macro, GooglePlayBilling.GooglePlayBilling)
2) Create a BillingClient object in the starter service and initialize it. or can it be in the Main sub
B4X:
billing.Initialize("billing")
3) The PurchasesUpdated is the only event that needs to be handled in its own sub and that sub must be in the same module where BillingClient was initialized does this mean in the Starter Service module
4) What does consume a purchase vs acknowledge and is consume necessary to accept the payment as valid?

A simple overview of what I want to implement
1) Customer Pays for an InApp product (in this case usage credit)
2) I verify the in App purchase was successful
3) I topup the customer usage credit

I would be most grateful to dummy it up for me to fast track my understanding.

Cheers

Mark
 

asales

Expert
Licensed User
Longtime User
OK
2) Create a BillingClient object in the starter service and initialize it. or can it be in the Main sub
B4X:
billing.Initialize("billing")
In my previous apps that use Activity, I put the code in the Starter. I think this can also be used in the main module, but since all my apps today are B4xpages, I can't confirm. But you can test it in both modules.
3) The PurchasesUpdated is the only event that needs to be handled in its own sub and that sub must be in the same module where BillingClient was initialized does this mean in the Starter Service module
OK
Check this line in the library: "Consuming a purchase removes it from the 'purchased' products."
When you use the `consume` method, the user can buy the item again, so you need to change the code to handle this (control the credit of the customer).
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…