samlich / peertube-plugin-web-monetization

Apache License 2.0
13 stars 3 forks source link

Include receipt validation data in stats view #5

Open vingle opened 2 years ago

vingle commented 2 years ago

Setting 'Add receipt service to payment pointer (to verify payments)' to true gives the following output for the monetization tag:

<meta name="monetization" content="$webmonetization.org/api/receipts/%24ilp.uphold.com%2FQ7aBGRqKQ7Dx" id="peertube-plugin-web-monetization-meta">

The coil browser plugin still gives a green light suggesting payment is being made, but nothing is received in the Uphold wallet, and when I checked the markup I got the above metatag. Videos where the receipt service field is left blank show a correct wallet address.

samlich commented 2 years ago

The way the receipt verification works is the payment first goes to a service which provides a receipt for each payment to forward to the server as proof. Then the service forwards the payment to your payment pointer. So, to use the receipt service, the payment pointer is changed as you've described (example` here).

The payments wont appear immediately in Uphold, and they have to sum to at least a cent. So, to test this you'd have to not have any payments for a few days. Add the tag with the receipt service and send at least one cent, then wait a few days for Uphold to deposit (or for nothing to be deposited), before trying without the receipt service.

However, the receipt verification isn't really visible in the UI, so I need to fix that. And while the database does differentiate between verified and unverified payments, it doesn't differentiate why they were unverified (no receipt provided, receipt verification failed, or receipt verification returned negative result) and whether they were expected to be verified (was receipt verification enabled by uploader at the time of payment).

So, I need to add that distinction in the database. Add some knobs to stats display to show payment verification status. And then I'll add a debug switch in the stats panel which will ask the server to give feedback on each receipt, and then put data for all the payments in a text box. I can hopefully get to this a month from now.

There also needs to be a UI to allow for reconciliation, so I've opened #6.

vingle commented 2 years ago

Thanks @samlich – all that sounds great - and my apology for not realising this was the intended behaviour for the receipt service.

It was definitely more than a cent - I left videos running for 15+mins and didn't receive anything. I pushed a number of videos live during the WebMonetiation experiment at Mozfest, and other than some donations, got so little streamed income I wondered if it was all still working as intended (I know it used to from tests).

Anyway, thanks for your work with this plugin.