Hey all, I've just built an interesting little experiment!
Using the Web Monetization JavaScript API, I tried listening for micropayments coming through on individual articles, and creating a running total of micropayments received. This gives a fairly accurate picture of how much money each individual article has received.
Writers can claim earnings
Even if an author has not created a payment pointer, we can track how much they earn, and send it them! I didn't have much time, but recorded a quick video to show how this is working:
At the moment, it's experimental and needs some tidying up, but I already have it running live on Prototypr.
It solves a problem @blackforestboi previously highlighted in the Memex project update:
Who comes first: The creator implementing WM or the consumer paying with WM?
There is the classic chicken-egg problem to be solved. Who comes first: The creator implementing WM or the consumer paying with WM?
If there was a (centralised in the beginning?) database that logs and arbitrates the payments to creators, urls, domains or social accounts that haven't set up the payment pointers yet, it may create an economic incentive for those creators to claim their savings at a later point in time and start using WM from then on. The assumption is that this may also lead to those creators pulling in their communities, adding a lot more people to pay with WM.
Other bits
- It also tracks the different currencies, in case payment pointer for an article is changed
- It can be optimised by using localstorage and less database requests - at the moment I'm sending every WM event to the database. [✅ DONE - see throttling in Improvements section below]
- I'm using Supabase, it's fine on the free tier, because they allow unlimited read and writes
Let me know what you think! I'll document how to set it up, and the different pieces that are working later when I get chance.
Fixes:
Just found some fixes to make (might not make sense, but I'm writing here to remind myself):
- the first time it copies over to the payouts table, it should clear the current total of the session or it's gonna add the same on top incorrectly [update: DONE!✅]
- doesn't seem to be an API for tips, so I can't add the tips onto the total received for each post
Improvements Made:
(updated later the same day)
- ✅ Instead of sending every WM micropayment event (there's around ~2-3 per second), now it bunches them together and throttles it to send 1 update every 2 seconds..seems to work well!
Top comments (0)