Coins — Pay to Win

Paul Frischknecht
2 min readJan 10, 2023

--

Update: Also check out Scrolls — Subscribe to Win

Over the last few weeks, I have been investing some hours looking into Progressive Web App development and integration of payment solutions.

The goal was to get an “installable” app deployed publicly on the Web and in the Google Play Store as an Android app, all built from a single codebase. Furthermore, the app should feature simple user accounts and be able to accept and count payments.

It turns out that Google requires that apps in their Google Play Store use their payment system:

Google Play’s billing system is required for developers offering in-app purchases of digital goods and services distributed on Google Play. (source)

Play-distributed apps requiring or accepting payment for access to in-app features or services, including any app functionality, digital content or goods (collectively “in-app purchases”), must use Google Play’s billing system for those transactions […] (source)

Google now provides access to the native Android Google Play billing system though APIs that can be used from JavaScript in the right context, making it possible to use this system from a Web app.

Outside of the context of running as an Android app (more specifically, a “Trusted Web Activity”), these APIs are not available and thus a second payment system must be integrated.

This also means that you have to abstract these payment systems enough to be able to count payments from both. Other complications involve accepting payment methods that are only cleared minutes, hours or even days after the payment happened (I call them pending payments).

Another goal was that all components of the app (specifically the backend services hosted on the cloud) don’t incur any costs when the app is not in use by anyone (scale to zero).

I will write another day about how exactly I achieved all of those goals (maybe that’s enough material for a short course), but for now, please feel free to check out the app and leave a tip here or there ;) :

--

--