Basic Web Monetization
Get started with Fundme.js.
Fundme.js will add meta tag for Web Monetization API onto your page. If the meta tag already exists, it will update the Web Monetization receiver's payment pointer address instead.
Normal use case for fundme.js is to import function fund() from package fundme you've installed from NPM. The library uses bundler's threesaking feature to minimize its size. Because of that, in case you're not using bundlers' into your web development setup, you need to import fundme.js differently than the usual (see HTML without script module example).
JavaScript
in HTML (with ES Modules)
in HTML (without script module)
1
import { fund } from "fundme";
2
โ€‹
3
fund("$wallet.example.com/test");
Copied!
1
<script type="module">
2
import { fund } from "https://cdn.pika.dev/fundme";
3
4
fund("$wallet.example.com/testing");
5
</script>
Copied!
1
<script src="https://cdn.jsdelivr.net/npm/fundme/dist/fundme-iife.js"></script>
2
<script>
3
fundme.fund("$wallet.example.com/my-address");
4
</script>
Copied!
By default, function fund() will take a single string for its parameter and Web Monetization will activated for the payment pointer called. But fundme.js is flexible, as you can use other methods you prefer with more options to control your Web Monetization, such as extending it with Revenue Sharing feature and more!
Last modified 1yr ago
Copy link