I am working on a new twa that is close to launching but I am currently a bit lost on how to get subscription base plans to work in a bubble wrap twa.
It seems that base plans are not supported in a bubble wrap TWA. You can only query the base plan selected as backwards compatible.
I have enabled google play billing during bubblewrap setup. Like described here. This is also the guide I am following to implement the payment request.
So I have a subscription (in the google play console) with the id: premium_membership
.
This subscription has 3 base plans:
premium-membership
premium-membership-half-yearly
premium-membership-yearly
The premium-membership
base plan is the one marked as the backwards compatible base plan for the premium_membership
subscription.
I expected that I would be able to query the information about the base plans like this:
const service = await window.getDigitalGoodsService('https://play.google.com/billing');
const details = await service.getDetails(['premium-membership', 'premium-membership-half-yearly', 'premium-membership-yearly']);
console.log(details); // empty list
But this does not work. You can only do getDetails
for the subscription id. In this case that is premium_membership
.
A PaymentRequest
also does not work with base plans. You get an error if you try to make an payment request with a base plan. See below.
To Reproduce
Steps to reproduce the behavior:
First do this setup:
- Go to the developer console
- Make a subscription
- Make a couple base plans
Then: Try to query the details for a baseplan with the code above.
Or try to subscribe to a baseplan with something like
await new PaymentRequest([{supportedMethods: "https://play.google.com/billing", data:{ sku: 'premium-membership-half-yearly' }}], {}).show();
You will get Payment app returned RESULT_CANCELED code. This is how payment apps can close their activity programmatically.
The PaymentRequest
only works with the subscription id, which in this case is premium_membership
. This payment request will give you the base plan that you have marked as backwards compatible in the google play console. To me it seems currently impossible to subscribe to other base plans of a subscription in a bubble wrap twa. Does anyone know if this is true?
Work around
As I currently do not know how to access the base plans besides the backwards compatible one. You would be forced to make different subscriptions for each subscription duration. This is really inconvenient because these different subscriptions are not really linked in any way. This means that it makes it impossible for a subscriber to upgrade or downgrade their current subscription without canceling it and resubscribing to a different subscription.
Smartphone:
- OS: Android 13
- Browser Chrome
- Version: 116
Additional context
On the android website it says:
By November 1, 2023, all updates to existing apps must use Billing Library version 5 or newer.
Does this mean I can not publish updates to my app after November 1? Or is the twa actually using using version 5 but the javascript interface just has not been updated yet? I also found this project: android-browser-helper which seems to be included in the build.grade
generated by bubblewrap. I looked at this for a bit and it seems that this project actually provides the javascript bridge to the android Billing Library version 5. Is it correct that this the actual thing that needs to be updated in order to subscribe to base plans?
Am I missing something? I could not find anyone talking about not being able to select a base plan in a bubblewrap twa.