I use Bubblewrap to turn my PWA into a TWA app on Android and have Google Billing properly enabled. Everything works fine on my Android 11 device, but when I open my app on devices that run Android 6, the PaymentRequest.canMakePayment()
method returns false with the error message:
Unable to download payment manifest "https://play.google.com/billing".
Since I can't find any documentation online about how Google Play Billing works with the web Payment Request API, I have no information about the requirements to make it work. I'm also pretty sure that it used to work and I managed to make payments on older Android devices.
Any help would be appreciated!
This is my code:
const getBillingService = async () => {
if (window.PaymentRequest !== undefined) {
const dummyMethods = [
{
supportedMethods: "https://play.google.com/billing",
},
];
const dummyDetails = {
total: {
label: `Total`,
amount: { currency: `USD`, value: `0` },
},
};
const dummyRequest = new PaymentRequest(dummyMethods, dummyDetails);
const possible = await dummyRequest.canMakePayment();
//true inside my app on newer Android versions, false in older ones
//with the error Unable to download payment manifest "https://play.google.com/billing".
}
};
All the requirements to make the Google Play Billing API work are satisfied as far as I know: https context, app downloaded from the Play Store... and it does work on newer devices.